Skip to content

Commit 32f7bed

Browse files
committed
fix GHA build issues
1 parent 74b75bd commit 32f7bed

File tree

7 files changed

+34
-36
lines changed

7 files changed

+34
-36
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,33 @@ jobs:
1717
fail-fast: false
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
with:
2222
submodules: recursive
2323

2424
- name: Update CMake
25-
uses: jwlawson/actions-setup-cmake@v1.13
25+
uses: jwlawson/actions-setup-cmake@v2
2626

27-
- uses: actions/setup-python@v4
27+
- uses: actions/setup-python@v5
2828
name: Install Python
2929
with:
30-
python-version: '3.9'
31-
32-
- name: Prepare compiler environment for Windows
33-
if: runner.os == 'Windows'
34-
uses: ilammy/msvc-dev-cmd@v1
35-
with:
36-
arch: x64
30+
python-version: '3.12'
3731

3832
- name: Install dependencies on Linux
3933
if: runner.os == 'Linux'
40-
run: sudo apt-get install -y xorg-dev libglu1-mesa-dev
34+
run: sudo apt-get install -y xorg-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev libdbus-1-dev
4135

42-
- name: Configure
43-
run: >
44-
cmake -S . -B build "-DPython_EXECUTABLE=$(python3 -c 'import sys; print(sys.executable)')"
36+
- name: Configure (Windows)
37+
if: runner.os == 'Windows'
38+
run: |
39+
cmake -S . -B build -G "Visual Studio 17 2022" `
40+
"-DPython_EXECUTABLE=$(python -c 'import sys; print(sys.executable)')"
41+
42+
- name: Configure (Linux)
43+
if: runner.os == 'Linux'
44+
run: |
45+
cmake -S . -B build \
46+
"-DPython_EXECUTABLE=$(python3 -c 'import sys; print(sys.executable)')"
4547
4648
- name: Build C++
47-
run: cmake --build build -j 2
49+
run: cmake --build build -j 2 --config Release

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ endif()
172172

173173
# Use C++17, visibility=hidden by default, interprocedural optimization
174174
set(CMAKE_CXX_STANDARD 17)
175+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
175176
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
176177

177178
# Prefer libc++ in conjunction with Clang

include/nanogui/vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ template <typename Value_, size_t Size_> struct Matrix {
468468
}
469469

470470
/// Initialize from columns
471-
template <typename... Args, std::enable_if_t<(std::is_same_v<Args, Column> && ...), int> = 0>
471+
template <typename... Args, std::enable_if_t<std::conjunction_v<std::is_same<Args, Column>...>, int> = 0>
472472
Matrix(const Args&... args) : m{args...} { }
473473

474474
friend Matrix operator*(const Matrix &a, const Matrix &b) {

src/common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ file_dialog(Widget *parent,
319319
case FileDialogType::Save: {
320320
nfdsavedialogu8args_t args = {};
321321
args.filterList = nfd_filters.data();
322-
args.filterCount = nfd_filters.size();
322+
args.filterCount = (nfdfiltersize_t) nfd_filters.size();
323323
args.defaultPath = nfd_default_path;
324324
args.parentWindow = parent_window;
325325
result = NFD_SaveDialogU8_With(&out_path, &args);
@@ -330,7 +330,7 @@ file_dialog(Widget *parent,
330330
case FileDialogType::OpenMultiple: {
331331
nfdopendialogu8args_t args = {};
332332
args.filterList = nfd_filters.data();
333-
args.filterCount = nfd_filters.size();
333+
args.filterCount = (nfdfiltersize_t) nfd_filters.size();
334334
args.defaultPath = nfd_default_path;
335335
args.parentWindow = parent_window;
336336

src/python/vector.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ auto register_vector_type(nb::module_ &m, const char *name) {
2626
for (size_t i = 0, size = std::min(Vector::Size, nb::len(arr)); i < size; ++i)
2727
(*v)[i] = nb::cast<Value>(arr[i]);
2828
})
29-
.def("__len__", [](const Vector &) { return Size; })
29+
.def("__len__", [](const Vector &) -> size_t { return Vector::Size; })
3030
.def(-nb::self)
3131
.def(nb::self == nb::self)
3232
.def(nb::self != nb::self)
@@ -107,19 +107,17 @@ auto register_matrix_type(nb::module_ &m, const char *name) {
107107
.def(nb::init<const Matrix &>());
108108

109109
type.def("__init__",
110-
[](Matrix *m, const nb::ndarray<Value, nb::f_contig, nb::shape<Size, Size>, nb::ro, nb::device::cpu> &array) {
110+
[](Matrix *m, const nb::ndarray<Value, nb::shape<Size, Size>, nb::ro, nb::device::cpu> &array) {
111111
new (m) Matrix();
112-
memcpy(m->m, array.data(), sizeof(Value)*Size*Size);
113-
})
114-
.def("__init__",
115-
[](Matrix *m, const nb::ndarray<Value, nb::c_contig, nb::shape<Size, Size>, nb::ro, nb::device::cpu> &array) {
116-
new (m) Matrix();
117-
memcpy(m->m, array.data(), sizeof(Value)*Size*Size);
118-
*m = m->T();
112+
for (size_t i = 0; i < Matrix::Size; ++i) {
113+
for (size_t j = 0; j < Matrix::Size; ++j) {
114+
m->m[j][i] = array(i, j); // Column-major storage
115+
}
116+
}
119117
})
120118
.def_prop_ro("T", &Matrix::T)
121119
.def("__matmul__", [](const Matrix &a, const Matrix &b) { return a * b; }, nb::is_operator())
122-
.def("__len__", [](const Matrix &) { return Size; })
120+
.def("__len__", [](const Matrix &) -> size_t { return Matrix::Size; })
123121
.def("__getitem__", [](const Matrix &m, size_t index) -> const Vector& {
124122
if (index >= Vector::Size)
125123
throw nb::index_error();
@@ -137,7 +135,7 @@ auto register_matrix_type(nb::module_ &m, const char *name) {
137135
delete (Matrix *) p;
138136
});
139137

140-
return nb::ndarray<float>(&t->m, {Size, Size}, owner);
138+
return nb::ndarray<float>(&t->m, {Matrix::Size, Matrix::Size}, owner);
141139
})
142140
.def("__repr__", [](const Matrix &m) {
143141
std::ostringstream oss;

src/quad.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,9 @@ TexturedQuad::TexturedQuad(RenderPass *render_pass, BlendMode blend_mode)
175175
3, 2, 0
176176
};
177177

178-
set_buffer("position", VariableType::Float32, 2,
179-
(size_t[]){4, 3}, positions);
180-
set_buffer("uv", VariableType::Float32, 2,
181-
(size_t[]){4, 2}, uvs);
182-
set_buffer("indices", VariableType::UInt32, 1,
183-
(size_t[]){6}, indices);
178+
set_buffer("position", VariableType::Float32, { 4, 3 }, positions);
179+
set_buffer("uv", VariableType::Float32, { 4, 2 }, uvs);
180+
set_buffer("indices", VariableType::UInt32, { 6 }, indices);
184181
set_uniform("mvp",
185182
Matrix4f(-1, 0, 0, 0,
186183
0, 1, 0, 0,

0 commit comments

Comments
 (0)