diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4aa86580ff6524c819fcf249e3b223eb107f787c..ba8bfa7326e585ff0ba94699e36d9876211836ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,8 @@ image: hello-world:latest stages: - - build-img +# - build-img +# - spack-test - test workflow: @@ -9,30 +10,19 @@ workflow: - if: $CI_MERGE_REQUEST_ID # Execute jobs in merge request context - if: $CI_COMMIT_BRANCH == 'main' # Execute jobs when a new commit is pushed to main branch - -build-img: - stage: build-img - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - script: - - mkdir -p /kaniko/.docker - - DOCKER_AUTH=$(echo -n "$DOCKER_HUB_USR:$DOCKER_HUB_PASS" | base64) - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1/\":{\"auth\":\"$DOCKER_AUTH\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --cache=true --context $CI_PROJECT_DIR --dockerfile ./Dockerfile --destination $CI_REGISTRY_IMAGE:latest - tags: - - docker +variables: + CI_REGISTRY_IMAGE: ${CI_REGISTRY}/exa/mfix/nvcc ###### Test jobs ##### .test:cmake: &cmake_def stage: test - image: $CI_REGISTRY_IMAGE:latest - needs: ['build-img'] + image: $CI_REGISTRY_IMAGE script: - cmake -S. -Bbuild -GNinja + -DCMAKE_MODULE_PATH=$PWD/build -DCMAKE_BUILD_TYPE=Debug -DCSG_CGAL_ENABLED=${ENABLE_CGAL} -DCMAKE_CXX_FLAGS="-pedantic-errors" @@ -52,34 +42,35 @@ test:no_cgal: ENABLE_CGAL: "OFF" <<: *cmake_def -.test:spack: &spack_def - stage: test - image: $CI_REGISTRY_IMAGE:latest - needs: ['build-img'] - when: manual - script: - - /usr/local/spack/bin/spack repo add .spack/repo - - /usr/local/spack/bin/spack install csg-eb ${NO_CSG} - tags: - - docker +# .spack-test:spack: &spack_def +# stage: test +# image: $CI_REGISTRY_IMAGE:latest +# needs: ['build-img'] +# when: manual +# script: +# - /usr/local/spack/bin/spack repo add .spack/repo +# - /usr/local/spack/bin/spack install csg-eb ${NO_CSG} +# tags: +# - docker -spack:cgal: - variables: - NO_CSG: "" - <<: *spack_def +# spack-test:cgal: +# variables: +# NO_CSG: "" +# <<: *spack_def -spack:no_cgal: - variables: - NO_CSG: "~cgal" - <<: *spack_def +# spack-test:no_cgal: +# variables: +# NO_CSG: "~cgal" +# <<: *spack_def .test:gnumake: &gnumake_def stage: test variables: - image: $CI_REGISTRY_IMAGE:latest - needs: ['build-img'] + BUILD: ${CI_PROJECT_DIR}/build + + image: $CI_REGISTRY_IMAGE script: - - make install DESTDIR=the_destination + - make tags: - docker diff --git a/src/csg/cgal_helper_polyhedron.cpp b/src/csg/cgal_helper_polyhedron.cpp index 68e790461338d47ed8aca83c2e79af2d9e88c307..bafc6889a9e1cc390a9e25a69f0986786c8dcbee 100644 --- a/src/csg/cgal_helper_polyhedron.cpp +++ b/src/csg/cgal_helper_polyhedron.cpp @@ -2,7 +2,6 @@ #include "csg_exception.hpp" #include -#include #include #include #include @@ -11,6 +10,12 @@ #include #include +#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(6,0,0) +#include +#else +#include +#endif + namespace { typedef cgal_helper::Polyhedron::HalfedgeDS HalfedgeDS; diff --git a/src/csg/tests/CMakeLists.txt b/src/csg/tests/CMakeLists.txt index 3f4d07535dbb0a33339b351d4d8dd3f7e71264eb..3a708e7437edd683fd53a04bb9777392cd37f956 100644 --- a/src/csg/tests/CMakeLists.txt +++ b/src/csg/tests/CMakeLists.txt @@ -17,7 +17,6 @@ list(APPEND unit_tests_csg_SOURCES parser/other.t.cpp parser/primitives.t.cpp parser/transform.t.cpp - unit_tests_csg.main.cpp ) if (CSG_CGAL_ENABLED) @@ -28,17 +27,17 @@ if (CSG_CGAL_ENABLED) endif() add_executable(unit_tests_csg EXCLUDE_FROM_ALL - ${unit_tests_csg_SOURCES} + ${unit_tests_csg_SOURCES} ) target_include_directories(unit_tests_csg PRIVATE ${CMAKE_SOURCE_DIR}/src ) -find_package(Catch2 REQUIRED) +find_package(Catch2 3 REQUIRED) include(Catch) target_link_libraries(unit_tests_csg - Catch2::Catch2 + Catch2::Catch2WithMain csg-eb ) diff --git a/src/csg/tests/levelset/boolean.t.cpp b/src/csg/tests/levelset/boolean.t.cpp index f39af1da76a6e8cdf63b7c17896fcabb12795a6f..2ae1ed2359b72a73fb1d2303fc070dd25e23644f 100644 --- a/src/csg/tests/levelset/boolean.t.cpp +++ b/src/csg/tests/levelset/boolean.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/empty.t.cpp b/src/csg/tests/levelset/empty.t.cpp index e03b8ffc07e516489dba4a354ca03757b8f36f2d..b9d4baa9b3733e3ffc064d89456a6c44082ac9a4 100644 --- a/src/csg/tests/levelset/empty.t.cpp +++ b/src/csg/tests/levelset/empty.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/extrude.t.cpp b/src/csg/tests/levelset/extrude.t.cpp index b53656d82abe2bb43f26230fff5f26d62f08b6b9..5b8de87dd142cc01a4f91b6de1cdfb2357acf9b4 100644 --- a/src/csg/tests/levelset/extrude.t.cpp +++ b/src/csg/tests/levelset/extrude.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/hull.t.cpp b/src/csg/tests/levelset/hull.t.cpp index da63ffb83c68917fd6dd295ba7de65d41fa4f713..f0a334c3a3aab56f0dee528a5dee1e03b8103ab3 100644 --- a/src/csg/tests/levelset/hull.t.cpp +++ b/src/csg/tests/levelset/hull.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/internal_flow.t.cpp b/src/csg/tests/levelset/internal_flow.t.cpp index b85efdb05ce3bd81926bf7e6dc154a10f89c0b3f..4e340b1cfdcfcead5931507a98d465903c8f2159 100644 --- a/src/csg/tests/levelset/internal_flow.t.cpp +++ b/src/csg/tests/levelset/internal_flow.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/primitives.t.cpp b/src/csg/tests/levelset/primitives.t.cpp index ca409d75e2042e7af54f95f9e59876cc5fd1a523..8e56b989ff86d5ed11e1ff0edf81260a12fc7ed9 100644 --- a/src/csg/tests/levelset/primitives.t.cpp +++ b/src/csg/tests/levelset/primitives.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/levelset/transform.t.cpp b/src/csg/tests/levelset/transform.t.cpp index 22d41480615d37c0592fc19820abf43be72b3a39..8b929311e3548c7ce56b222bee9a3ad4883ac56d 100644 --- a/src/csg/tests/levelset/transform.t.cpp +++ b/src/csg/tests/levelset/transform.t.cpp @@ -1,6 +1,8 @@ #include -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/boolean.t.cpp b/src/csg/tests/parser/boolean.t.cpp index 8a563511a876d204aaa477c578d00cf0fea4201b..c339cc6fe5a873aa7dd874b5500a9de65b7a9627 100644 --- a/src/csg/tests/parser/boolean.t.cpp +++ b/src/csg/tests/parser/boolean.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/empty.t.cpp b/src/csg/tests/parser/empty.t.cpp index 60a3b60cbc4d89102e58e9867bb57313c0d8f933..df183024bcd1364c5ec7d756ea8eda65b7633e1c 100644 --- a/src/csg/tests/parser/empty.t.cpp +++ b/src/csg/tests/parser/empty.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/extrude.t.cpp b/src/csg/tests/parser/extrude.t.cpp index c37fd722a3d65c933e9abbb432685beab0452eac..c1a1a46e94cf839599557d639d0f4045864dbde4 100644 --- a/src/csg/tests/parser/extrude.t.cpp +++ b/src/csg/tests/parser/extrude.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include @@ -80,7 +82,7 @@ angle = 370 square(size = [2, 3], center = false); } )"), - Catch::Contains("action")); + Matchers::ContainsSubstring("action")); } TEST_CASE("extrude two shapes", "[csg]") { diff --git a/src/csg/tests/parser/hull.t.cpp b/src/csg/tests/parser/hull.t.cpp index 615f01b8cd8f1cfd3a89f8356b2b738ea82efd1c..629108bf1b8995388575457d4f05cc4cc60a83e3 100644 --- a/src/csg/tests/parser/hull.t.cpp +++ b/src/csg/tests/parser/hull.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include @@ -38,7 +40,7 @@ hull() { sphere($fn = 0, $fa = 12, $fs = 2, r = 4); } )"), - Catch::Contains("action")); + Matchers::ContainsSubstring("action")); } TEST_CASE("hull with three elements not supported", "[csg]") { @@ -51,7 +53,7 @@ hull() { sphere($fn = 0, $fa = 12, $fs = 2, r = 4); } )"), - Catch::Contains("action")); + Matchers::ContainsSubstring("action")); } TEST_CASE("hull with other shape combos not supported", "[csg]") { @@ -61,7 +63,7 @@ hull() { sphere($fn = 0, $fa = 12, $fs = 2, r = 4); } )"), - Catch::Contains("action")); + Matchers::ContainsSubstring("action")); } } // namespace diff --git a/src/csg/tests/parser/nest.cpp b/src/csg/tests/parser/nest.cpp index 6c9137da357a3e7c9eb0d95618726d6f528976be..0158c404db5fadb32f14285b7b6d73192c4eda07 100644 --- a/src/csg/tests/parser/nest.cpp +++ b/src/csg/tests/parser/nest.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/other.t.cpp b/src/csg/tests/parser/other.t.cpp index fee47796991b5acae4dffb147204aac151c739d3..8673532bd53c32c3f602861ee24d73d3e4ffacc8 100644 --- a/src/csg/tests/parser/other.t.cpp +++ b/src/csg/tests/parser/other.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/primitives.t.cpp b/src/csg/tests/parser/primitives.t.cpp index bc57dd426f4b6ffb9c7ba255c886134e5bca0501..54950dda64588823ea1065bb3fb8712fee22e761 100644 --- a/src/csg/tests/parser/primitives.t.cpp +++ b/src/csg/tests/parser/primitives.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/parser/transform.t.cpp b/src/csg/tests/parser/transform.t.cpp index e7fa6bca7d43b9070d4255f38b23323f57c1c378..86c44c08ce9ebe9b188080316106dff0403e0161 100644 --- a/src/csg/tests/parser/transform.t.cpp +++ b/src/csg/tests/parser/transform.t.cpp @@ -1,4 +1,6 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" + +using namespace Catch; #include #include diff --git a/src/csg/tests/unit_tests_csg.main.cpp b/src/csg/tests/unit_tests_csg.main.cpp deleted file mode 100644 index fc72584f1b1bd7c8bc9414ccee5fd417b547cae5..0000000000000000000000000000000000000000 --- a/src/csg/tests/unit_tests_csg.main.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CATCH_CONFIG_MAIN // Catch main() - only add to one cpp file -#include "catch2/catch.hpp" diff --git a/src/csg_cgal_helper.hpp b/src/csg_cgal_helper.hpp index 541b41cda1768ad6b1e70d9a99faba26ac9ae933..e6731db147a9b08122411a0f7c34732347950572 100644 --- a/src/csg_cgal_helper.hpp +++ b/src/csg_cgal_helper.hpp @@ -1,6 +1,7 @@ #ifndef CGAL_HELPER_H_ #define CGAL_HELPER_H_ +#include #include #include #include @@ -15,9 +16,16 @@ typedef CGAL::Polyhedron_3 Polyhedron; typedef CGAL::Polygon_2 Polygon; typedef CGAL::AABB_face_graph_triangle_primitive Primitive; -typedef CGAL::AABB_traits Traits; + +#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(6,0,0) + typedef CGAL::AABB_traits_3 Traits; +#else + typedef CGAL::AABB_traits Traits; +#endif + typedef CGAL::AABB_tree AABBTree; + std::shared_ptr create_polyhedron(const std::vector> &points, const std::vector> &faces);