Skip to content

Commit

Permalink
Update github actions (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
qnzhou authored Oct 23, 2024
1 parent a9c454e commit ffec583
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/recipes/external/poissonrecon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ std::unique_ptr<MeshType> 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<bool, 2> orientations;
std::array<bool, 2> orientations{false, false};
size_t count = 0;
mesh.foreach_facets_around_edge(ei, [&](Index fid) {
orientations[count] = get_orientation(e[0], e[1], fid);
Expand Down
9 changes: 9 additions & 0 deletions modules/core/include/lagrange/utils/warning.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// @}
5 changes: 3 additions & 2 deletions modules/core/include/lagrange/utils/warnoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'
Expand Down
27 changes: 15 additions & 12 deletions modules/core/src/compute_normal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <lagrange/internal/find_attribute_utils.h>
#include <lagrange/utils/function_ref.h>
#include <lagrange/utils/geometry3d.h>
#include <lagrange/utils/warning.h>
#include <lagrange/views.h>

#include "internal/bucket_sort.h"
Expand Down Expand Up @@ -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();
});
Expand Down Expand Up @@ -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<Scalar, Index>( \
SurfaceMesh<Scalar, Index> & mesh, \
function_ref<bool(Index)>, \
span<const Index>, \
NormalOptions); \
SurfaceMesh<Scalar, Index> & mesh, \
function_ref<bool(Index)>, \
span<const Index>, \
NormalOptions); \
template LA_CORE_API AttributeId compute_normal<Scalar, Index>( \
SurfaceMesh<Scalar, Index> & mesh, \
function_ref<bool(Index, Index)>, \
span<const Index>, \
NormalOptions); \
SurfaceMesh<Scalar, Index> & mesh, \
function_ref<bool(Index, Index)>, \
span<const Index>, \
NormalOptions); \
template LA_CORE_API AttributeId compute_normal<Scalar, Index>( \
SurfaceMesh<Scalar, Index> & mesh, \
Scalar, \
span<const Index>, \
SurfaceMesh<Scalar, Index> & mesh, \
Scalar, \
span<const Index>, \
NormalOptions);
LA_SURFACE_MESH_X(compute_normal, 0)

Expand Down
7 changes: 5 additions & 2 deletions modules/core/src/compute_vertex_normal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <lagrange/compute_weighted_corner_normal.h>
#include <lagrange/internal/find_attribute_utils.h>
#include <lagrange/utils/Error.h>
#include <lagrange/utils/warning.h>
#include <lagrange/views.h>

#include "internal/compute_weighted_corner_normal.h"
Expand Down Expand Up @@ -51,8 +52,10 @@ AttributeId compute_vertex_normal(SurfaceMesh<Scalar, Index>& 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();
});
Expand Down Expand Up @@ -93,9 +96,9 @@ AttributeId compute_vertex_normal(SurfaceMesh<Scalar, Index>& 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<Scalar, Index>( \
SurfaceMesh<Scalar, Index>&, \
SurfaceMesh<Scalar, Index>&, \
VertexNormalOptions);
LA_SURFACE_MESH_X(compute_vertex_normal, 0)

Expand Down
7 changes: 5 additions & 2 deletions modules/core/src/compute_weighted_corner_normal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <lagrange/compute_weighted_corner_normal.h>
#include <lagrange/internal/find_attribute_utils.h>
#include <lagrange/utils/assert.h>
#include <lagrange/utils/warning.h>
#include <lagrange/views.h>

#include "internal/compute_weighted_corner_normal.h"
Expand Down Expand Up @@ -46,15 +47,17 @@ AttributeId compute_weighted_corner_normal(
la_debug_assert(static_cast<Index>(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<Scalar, Index>( \
SurfaceMesh<Scalar, Index>&, \
SurfaceMesh<Scalar, Index>&, \
CornerNormalOptions);
LA_SURFACE_MESH_X(compute_weighted_corner_normal, 0)

Expand Down
9 changes: 9 additions & 0 deletions modules/core/src/thicken_and_close_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <lagrange/internal/visit_attribute.h>
#include <lagrange/utils/invalid.h>
#include <lagrange/utils/safe_cast.h>
#include <lagrange/utils/warning.h>
#include <lagrange/views.h>

namespace lagrange {
Expand Down Expand Up @@ -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) {
Expand All @@ -92,6 +95,7 @@ void offset_vertices_fixed(
for (Index is = 1; is < num_segments; ++is) {
Scalar offset_ratio = static_cast<Scalar>(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
Expand All @@ -103,6 +107,7 @@ void offset_vertices_fixed(
mirror_vector,
offset_direction,
offset_ratio);
LA_IGNORE_ARRAY_BOUNDS_END
}
}
}
Expand All @@ -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) {
Expand All @@ -142,11 +149,13 @@ void offset_vertices_normals(
for (Index is = 1; is < num_segments; ++is) {
Scalar offset_ratio = static_cast<Scalar>(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
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions modules/core/tests/test_isoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <lagrange/utils/fmt_eigen.h>
#include <lagrange/utils/range.h>
#include <lagrange/views.h>
#include <lagrange/utils/warning.h>

#include <catch2/matchers/catch_matchers_floating_point.hpp>

Expand Down Expand Up @@ -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<Scalar> 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)) {
Expand Down
3 changes: 3 additions & 0 deletions modules/core/tests/test_marching_triangles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <lagrange/marching_triangles.h>
#include <lagrange/utils/range.h>
#include <lagrange/utils/safe_cast.h>
#include <lagrange/utils/warning.h>

namespace {

Expand Down Expand Up @@ -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<Scalar, 1, 3> pt(iscaled, jscaled, 0);
vertices.row(j * n + i) = pt.head(num_dims);
LA_IGNORE_ARRAY_BOUNDS_END
}
}
for (auto i : range(n - 1)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/io/src/load_assimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ SceneType load_simple_scene_assimp(const aiScene& scene, const LoadOptions& opti
}
std::function<void(aiNode*, AffineTransform)> 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<AffineTransform>(node->mTransformation);
Expand Down
3 changes: 3 additions & 0 deletions modules/io/src/load_fbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <lagrange/utils/assert.h>
#include <lagrange/utils/safe_cast.h>
#include <lagrange/utils/utils.h>
#include <lagrange/utils/warning.h>

#include <ufbx.h>

Expand Down Expand Up @@ -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<AffineTransform>(node->node_to_world);
LA_IGNORE_ARRAY_BOUNDS_END
lscene.add_instance({Index(mesh_idx), t});
}
}
Expand Down
4 changes: 4 additions & 0 deletions modules/poisson/src/mesh_from_oriented_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
#define MULTI_THREADING_INCLUDED
using namespace lagrange::poisson::threadpool;

// clang-format off
#include <lagrange/utils/warnoff.h>
#include <PreProcessor.h>
#include <Reconstructors.h>
#include <lagrange/utils/warnon.h>
// clang-format on

namespace lagrange::poisson {

Expand Down

0 comments on commit ffec583

Please sign in to comment.