From ffec58385f29eee6067287d12570f5bc1126c17b Mon Sep 17 00:00:00 2001 From: Qingnan Zhou Date: Wed, 23 Oct 2024 18:44:30 -0400 Subject: [PATCH] Update github actions (#46) --- .github/workflows/wheel.yaml | 4 +-- cmake/recipes/external/poissonrecon.cmake | 2 +- .../legacy/resolve_nonmanifoldness.h | 2 +- modules/core/include/lagrange/utils/warning.h | 9 +++++++ modules/core/include/lagrange/utils/warnoff.h | 5 ++-- modules/core/src/compute_normal.cpp | 27 ++++++++++--------- modules/core/src/compute_vertex_normal.cpp | 7 +++-- .../src/compute_weighted_corner_normal.cpp | 7 +++-- modules/core/src/thicken_and_close_mesh.cpp | 9 +++++++ modules/core/tests/test_isoline.cpp | 3 +++ .../core/tests/test_marching_triangles.cpp | 3 +++ modules/io/src/load_assimp.cpp | 2 +- modules/io/src/load_fbx.cpp | 3 +++ .../poisson/src/mesh_from_oriented_points.cpp | 4 +++ 14 files changed, 64 insertions(+), 23 deletions(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index fb9ba750..c6673dc8 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -26,11 +26,11 @@ jobs: xcode-version: '15.2' - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.21.3 env: CIBW_ARCHS_LINUX: auto64 CIBW_ARCHS_WINDOWS: auto64 - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 CIBW_SKIP: "*-musllinux* pp*" CIBW_TEST_COMMAND: "pytest {project}/modules" CIBW_TEST_REQUIRES: pytest diff --git a/cmake/recipes/external/poissonrecon.cmake b/cmake/recipes/external/poissonrecon.cmake index c4ba1474..3dadefc6 100644 --- a/cmake/recipes/external/poissonrecon.cmake +++ b/cmake/recipes/external/poissonrecon.cmake @@ -23,5 +23,5 @@ CPMAddPackage( ) add_library(poissonrecon::poissonrecon INTERFACE IMPORTED GLOBAL) -target_include_directories(poissonrecon::poissonrecon INTERFACE "${poissonrecon_SOURCE_DIR}/Src") +target_include_directories(poissonrecon::poissonrecon SYSTEM INTERFACE "${poissonrecon_SOURCE_DIR}/Src") target_compile_definitions(poissonrecon::poissonrecon INTERFACE "SANITIZED_PR") diff --git a/modules/core/include/lagrange/mesh_cleanup/legacy/resolve_nonmanifoldness.h b/modules/core/include/lagrange/mesh_cleanup/legacy/resolve_nonmanifoldness.h index 311a1f39..8c06df64 100644 --- a/modules/core/include/lagrange/mesh_cleanup/legacy/resolve_nonmanifoldness.h +++ b/modules/core/include/lagrange/mesh_cleanup/legacy/resolve_nonmanifoldness.h @@ -90,7 +90,7 @@ std::unique_ptr resolve_nonmanifoldness(MeshType& mesh) */ auto is_inconsistently_oriented = [&mesh, &get_orientation](const Index ei) -> bool { const auto e = mesh.get_edge_vertices(ei); - std::array orientations; + std::array orientations{false, false}; size_t count = 0; mesh.foreach_facets_around_edge(ei, [&](Index fid) { orientations[count] = get_orientation(e[0], e[1], fid); diff --git a/modules/core/include/lagrange/utils/warning.h b/modules/core/include/lagrange/utils/warning.h index 25292034..0d0a883a 100644 --- a/modules/core/include/lagrange/utils/warning.h +++ b/modules/core/include/lagrange/utils/warning.h @@ -142,6 +142,15 @@ /// @hideinitializer #define LA_IGNORE_RANGE_LOOP_ANALYSIS_END LA_DISABLE_WARNING_END +/// Ignore warning "out of bounds subscripts or offsets into arrays" +/// This is used to bypass the following GCC bug: +/// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106247 +/// @hideinitializer +#define LA_IGNORE_ARRAY_BOUNDS_BEGIN LA_DISABLE_WARNING_BEGIN \ + LA_DISABLE_WARNING_GCC(-Warray-bounds) +/// @hideinitializer +#define LA_IGNORE_ARRAY_BOUNDS_END LA_DISABLE_WARNING_END + // clang-format on /// @} diff --git a/modules/core/include/lagrange/utils/warnoff.h b/modules/core/include/lagrange/utils/warnoff.h index 31324c42..53b423c9 100644 --- a/modules/core/include/lagrange/utils/warnoff.h +++ b/modules/core/include/lagrange/utils/warnoff.h @@ -52,9 +52,9 @@ #pragma GCC diagnostic ignored "-Wclass-memaccess" #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" + #pragma GCC diagnostic ignored "-Wdeprecated" #pragma GCC diagnostic ignored "-Wdeprecated-copy" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #pragma GCC diagnostic ignored "-Wdeprecated" #pragma GCC diagnostic ignored "-Wextra-semi" #pragma GCC diagnostic ignored "-Wignored-qualifiers" #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" @@ -67,15 +67,16 @@ #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-aliasing" + #pragma GCC diagnostic ignored "-Wstringop-overflow" #pragma GCC diagnostic ignored "-Wswitch-default" #pragma GCC diagnostic ignored "-Wundef" #pragma GCC diagnostic ignored "-Wuninitialized" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" + #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-variable" - #pragma GCC diagnostic ignored "-Wunused-function" #elif defined(_MSC_VER) #pragma warning(push) #pragma warning(disable : 26439) // This kind of function may not throw. Declare it 'noexcept' diff --git a/modules/core/src/compute_normal.cpp b/modules/core/src/compute_normal.cpp index 7937e9e9..f76c61cc 100644 --- a/modules/core/src/compute_normal.cpp +++ b/modules/core/src/compute_normal.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "internal/bucket_sort.h" @@ -172,7 +173,9 @@ AttributeId compute_normal_internal( for (Index i = buckets.representative_offsets[r]; i < buckets.representative_offsets[r + 1]; ++i) { Index c = buckets.sorted_elements[i]; + LA_IGNORE_ARRAY_BOUNDS_BEGIN normal_values.row(r) += compute_weighted_corner_normal(c).transpose(); + LA_IGNORE_ARRAY_BOUNDS_END } normal_values.row(r).stableNormalize(); }); @@ -247,21 +250,21 @@ AttributeId compute_normal( return attr_id; } -#define LA_X_compute_normal(_, Scalar, Index) \ +#define LA_X_compute_normal(_, Scalar, Index) \ template LA_CORE_API AttributeId compute_normal( \ - SurfaceMesh & mesh, \ - function_ref, \ - span, \ - NormalOptions); \ + SurfaceMesh & mesh, \ + function_ref, \ + span, \ + NormalOptions); \ template LA_CORE_API AttributeId compute_normal( \ - SurfaceMesh & mesh, \ - function_ref, \ - span, \ - NormalOptions); \ + SurfaceMesh & mesh, \ + function_ref, \ + span, \ + NormalOptions); \ template LA_CORE_API AttributeId compute_normal( \ - SurfaceMesh & mesh, \ - Scalar, \ - span, \ + SurfaceMesh & mesh, \ + Scalar, \ + span, \ NormalOptions); LA_SURFACE_MESH_X(compute_normal, 0) diff --git a/modules/core/src/compute_vertex_normal.cpp b/modules/core/src/compute_vertex_normal.cpp index 85c914d3..5ccf0525 100644 --- a/modules/core/src/compute_vertex_normal.cpp +++ b/modules/core/src/compute_vertex_normal.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "internal/compute_weighted_corner_normal.h" @@ -51,8 +52,10 @@ AttributeId compute_vertex_normal(SurfaceMesh& mesh, VertexNormal if (mesh.has_edges()) { tbb::parallel_for(Index(0), num_vertices, [&](Index vi) { mesh.foreach_corner_around_vertex(vi, [&](Index ci) { + LA_IGNORE_ARRAY_BOUNDS_BEGIN normals.row(vi) += internal::compute_weighted_corner_normal(mesh, ci, options.weight_type); + LA_IGNORE_ARRAY_BOUNDS_END }); normals.row(vi).stableNormalize(); }); @@ -93,9 +96,9 @@ AttributeId compute_vertex_normal(SurfaceMesh& mesh, VertexNormal return id; } -#define LA_X_compute_vertex_normal(_, Scalar, Index) \ +#define LA_X_compute_vertex_normal(_, Scalar, Index) \ template LA_CORE_API AttributeId compute_vertex_normal( \ - SurfaceMesh&, \ + SurfaceMesh&, \ VertexNormalOptions); LA_SURFACE_MESH_X(compute_vertex_normal, 0) diff --git a/modules/core/src/compute_weighted_corner_normal.cpp b/modules/core/src/compute_weighted_corner_normal.cpp index f9473548..de851f29 100644 --- a/modules/core/src/compute_weighted_corner_normal.cpp +++ b/modules/core/src/compute_weighted_corner_normal.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "internal/compute_weighted_corner_normal.h" @@ -46,15 +47,17 @@ AttributeId compute_weighted_corner_normal( la_debug_assert(static_cast(normals.rows()) == num_corners); tbb::parallel_for(Index(0), num_corners, [&](Index ci) { + LA_IGNORE_ARRAY_BOUNDS_BEGIN normals.row(ci) += internal::compute_weighted_corner_normal(mesh, ci, options.weight_type); + LA_IGNORE_ARRAY_BOUNDS_END }); return id; } -#define LA_X_compute_weighted_corner_normal(_, Scalar, Index) \ +#define LA_X_compute_weighted_corner_normal(_, Scalar, Index) \ template LA_CORE_API AttributeId compute_weighted_corner_normal( \ - SurfaceMesh&, \ + SurfaceMesh&, \ CornerNormalOptions); LA_SURFACE_MESH_X(compute_weighted_corner_normal, 0) diff --git a/modules/core/src/thicken_and_close_mesh.cpp b/modules/core/src/thicken_and_close_mesh.cpp index fce17d79..d7c970bb 100644 --- a/modules/core/src/thicken_and_close_mesh.cpp +++ b/modules/core/src/thicken_and_close_mesh.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include namespace lagrange { @@ -78,8 +79,10 @@ void offset_vertices_fixed( auto offset_vertices = matrix_ref(vertices_); for (Index v = 0; v < num_input_vertices; ++v) { const Vector3s vertex = offset_vertices.row(v).template head<3>(); +LA_IGNORE_ARRAY_BOUNDS_BEGIN offset_vertices.row(num_input_vertices + v) = compute_vertex(vertex, offset_vector, mirror_vector, offset_direction, Scalar(1.0)); +LA_IGNORE_ARRAY_BOUNDS_END } if (num_segments > 1) { @@ -92,6 +95,7 @@ void offset_vertices_fixed( for (Index is = 1; is < num_segments; ++is) { Scalar offset_ratio = static_cast(is) * segment_increment; la_debug_assert(offset_ratio < 1.0); +LA_IGNORE_ARRAY_BOUNDS_BEGIN offset_vertices.row( num_input_vertices * 2 + // original + offset vertices vi * (num_segments - 1) + // segment row @@ -103,6 +107,7 @@ void offset_vertices_fixed( mirror_vector, offset_direction, offset_ratio); +LA_IGNORE_ARRAY_BOUNDS_END } } } @@ -127,8 +132,10 @@ void offset_vertices_normals( for (Index v = 0; v < num_input_vertices; ++v) { const Vector3s vertex = offset_vertices.row(v).template head<3>(); const Vector3s offset_vector = -normals.row(v).template head<3>() * offset_amount; +LA_IGNORE_ARRAY_BOUNDS_BEGIN offset_vertices.row(num_input_vertices + v) = compute_vertex(vertex, offset_vector, Scalar(1.0)); +LA_IGNORE_ARRAY_BOUNDS_END } if (num_segments > 1) { @@ -142,11 +149,13 @@ void offset_vertices_normals( for (Index is = 1; is < num_segments; ++is) { Scalar offset_ratio = static_cast(is) * segment_increment; la_debug_assert(offset_ratio < 1.0); +LA_IGNORE_ARRAY_BOUNDS_BEGIN offset_vertices.row( num_input_vertices * 2 + // original + offset vertices vi * (num_segments - 1) + // segment row is - 1 // index in the boundary ) = compute_vertex(vertex, offset_vector, offset_ratio); +LA_IGNORE_ARRAY_BOUNDS_END } } } diff --git a/modules/core/tests/test_isoline.cpp b/modules/core/tests/test_isoline.cpp index f2176d16..29492c6b 100644 --- a/modules/core/tests/test_isoline.cpp +++ b/modules/core/tests/test_isoline.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -50,8 +51,10 @@ create_grid(const Index n, const Index m, const Index num_dims, const Scalar del for (auto j : lagrange::range(m)) { const Scalar iscaled = Scalar(i) / (n - 1); const Scalar jscaled = Scalar(j) / (m - 1); +LA_IGNORE_ARRAY_BOUNDS_BEGIN Eigen::RowVector3 pt(iscaled, jscaled, 0); vertices.row(j * n + i) = pt.head(num_dims); +LA_IGNORE_ARRAY_BOUNDS_END } } for (auto i : lagrange::range(n - 1)) { diff --git a/modules/core/tests/test_marching_triangles.cpp b/modules/core/tests/test_marching_triangles.cpp index c76629b1..f3cd6e0b 100644 --- a/modules/core/tests/test_marching_triangles.cpp +++ b/modules/core/tests/test_marching_triangles.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace { @@ -126,8 +127,10 @@ create_square(const int n, const int m, const Index num_dims, const Scalar delta for (auto j : range(m)) { const Scalar iscaled = Scalar(i) / (n - 1); const Scalar jscaled = Scalar(j) / (m - 1); +LA_IGNORE_ARRAY_BOUNDS_BEGIN Eigen::Matrix pt(iscaled, jscaled, 0); vertices.row(j * n + i) = pt.head(num_dims); +LA_IGNORE_ARRAY_BOUNDS_END } } for (auto i : range(n - 1)) { diff --git a/modules/io/src/load_assimp.cpp b/modules/io/src/load_assimp.cpp index 35e5d5c2..d6b4329e 100644 --- a/modules/io/src/load_assimp.cpp +++ b/modules/io/src/load_assimp.cpp @@ -332,7 +332,7 @@ SceneType load_simple_scene_assimp(const aiScene& scene, const LoadOptions& opti } std::function visit_node; visit_node = [&](aiNode* node, const AffineTransform& parent_transform) -> void { - AffineTransform node_transform; + AffineTransform node_transform(AffineTransform::Identity()); if constexpr (SceneType::Dim == 3) { node_transform = convert_transform_assimp_to_lagrange(node->mTransformation); diff --git a/modules/io/src/load_fbx.cpp b/modules/io/src/load_fbx.cpp index f3d9f773..ce7b3fd6 100644 --- a/modules/io/src/load_fbx.cpp +++ b/modules/io/src/load_fbx.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -309,8 +310,10 @@ SceneType load_simple_scene_fbx(const ufbx_scene* scene, const LoadOptions& opt) if (node->mesh) { size_t mesh_idx = element_index[node->mesh->element_id]; la_runtime_assert(mesh_idx != invalid_element_index); + LA_IGNORE_ARRAY_BOUNDS_BEGIN AffineTransform t = convert_transform_ufbx_to_lagrange(node->node_to_world); + LA_IGNORE_ARRAY_BOUNDS_END lscene.add_instance({Index(mesh_idx), t}); } } diff --git a/modules/poisson/src/mesh_from_oriented_points.cpp b/modules/poisson/src/mesh_from_oriented_points.cpp index ae9fe85e..3ce324d6 100644 --- a/modules/poisson/src/mesh_from_oriented_points.cpp +++ b/modules/poisson/src/mesh_from_oriented_points.cpp @@ -28,8 +28,12 @@ #define MULTI_THREADING_INCLUDED using namespace lagrange::poisson::threadpool; +// clang-format off +#include #include #include +#include +// clang-format on namespace lagrange::poisson {