diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89dc2b25a6027b90eb55e9c7a96a58555b58d0b0..5c1aec5bcb938d9ba7b2038b1b3c4a46a1f8f79b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,6 @@ test:cmake: - cmake -S. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug - cmake --build build --target unit_tests_csg - cd build - - ctest + - ctest --verbose tags: - mfix-exa diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d0c5ce56bdadd995ad4ebcc3ab95d4766104e7d..f6798e3de7a41a16651e4716ab25a7ef10609be2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,6 @@ if(CCACHE_FOUND) set( CMAKE_CXX_COMPILER_LAUNCHER ccache ) endif() -option(ENABLE_CSG "Build with CSG support" OFF) - # Download automatically, you can also just copy the conan.cmake file if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") @@ -37,7 +35,9 @@ include(Catch) add_subdirectory(src/csg) -target_include_directories(csg PRIVATE - ${CONAN_INCLUDE_DIRS_PEGTL}) +target_include_directories(csg + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CONAN_INCLUDE_DIRS_PEGTL} + ) target_compile_features(csg PRIVATE cxx_std_17) diff --git a/src/csg/csg.hpp b/include/csg.hpp similarity index 100% rename from src/csg/csg.hpp rename to include/csg.hpp diff --git a/src/inputs/solver.hpp b/include/solver.hpp similarity index 97% rename from src/inputs/solver.hpp rename to include/solver.hpp index 0245e1ddc24bbdb1954704fab5f45903cef1a737..de49c869b6cc8bbcedb238cd142266045ed4a851 100644 --- a/src/inputs/solver.hpp +++ b/include/solver.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include namespace solver { diff --git a/meson.build b/meson.build index 4cd3c5947e36d503e32b37c67aefaea7d241d6e7..a2fbacde50b732f683ef7ddb8bfde45682fd66f6 100644 --- a/meson.build +++ b/meson.build @@ -8,19 +8,7 @@ pegtl = dependency('pegtl', method: 'pkg-config') catch2 = dependency('catch2', method: 'pkg-config') cgal = dependency('cgal', method: 'pkg-config') -parser_inc = include_directories( - 'src/csg', - 'src/csg/impl', - 'src/inputs') +parser_inc = include_directories('include', 'src') subdir('src/csg') subdir('src/inputs') - -executable( - 'mfix-parser', - 'src/main.cpp', - include_directories: parser_inc, - link_with: [ - lib_csg_parser, - lib_inputs_parser, - ]) diff --git a/src/csg/CMakeLists.txt b/src/csg/CMakeLists.txt index 58162524645cf4a39d77f107df0c66ec13c9e722..52452ccc97a9730d2e4ed95cdb871a2767714cec 100644 --- a/src/csg/CMakeLists.txt +++ b/src/csg/CMakeLists.txt @@ -1,17 +1,14 @@ ################################################################################ # CSG Parser ################################################################################ -add_library(csg) - -target_sources(csg PRIVATE - impl/parser.cpp - impl/levelset_3d.cpp - impl/levelset_2d.cpp - impl/csg.cpp - impl/matrix_functions.cpp +add_library(csg + csg.cpp + levelset_2d.cpp + levelset_3d.cpp + matrix_functions.cpp + parser.cpp ) -target_include_directories(csg INTERFACE ${CMAKE_SOURCE_DIR}) target_link_libraries(csg PRIVATE stdc++fs CONAN_PKG::cgal diff --git a/src/csg/impl/csg.cpp b/src/csg/csg.cpp similarity index 98% rename from src/csg/impl/csg.cpp rename to src/csg/csg.cpp index 80fa8dd04b6933ce3aa051693eb86bee9fbdf559..8b7c17434a4d15c5683c09b2779a29462a98eb10 100644 --- a/src/csg/impl/csg.cpp +++ b/src/csg/csg.cpp @@ -2,7 +2,7 @@ #include #include -#include "../csg.hpp" +#include "csg.hpp" #include "csg_types.hpp" diff --git a/src/csg/impl/levelset_2d.cpp b/src/csg/levelset_2d.cpp similarity index 100% rename from src/csg/impl/levelset_2d.cpp rename to src/csg/levelset_2d.cpp diff --git a/src/csg/impl/levelset_3d.cpp b/src/csg/levelset_3d.cpp similarity index 100% rename from src/csg/impl/levelset_3d.cpp rename to src/csg/levelset_3d.cpp diff --git a/src/csg/impl/matrix_functions.cpp b/src/csg/matrix_functions.cpp similarity index 97% rename from src/csg/impl/matrix_functions.cpp rename to src/csg/matrix_functions.cpp index 4c0159d5d988a54290b85fe47e415b1f64ea4f9d..429471679832911831f3545844411cdce376b777 100644 --- a/src/csg/impl/matrix_functions.cpp +++ b/src/csg/matrix_functions.cpp @@ -1,4 +1,4 @@ -#include "matrix_functions.hpp" +#include "csg_matrix_functions.hpp" namespace { double determinant(const matrix::Mat2d &m) { diff --git a/src/csg/meson.build b/src/csg/meson.build index a65bc68d4a8b92292b025ffcbf5304028c0532bc..c9f7140ed7259a289720df49a5fceb3109da3885 100644 --- a/src/csg/meson.build +++ b/src/csg/meson.build @@ -1,10 +1,11 @@ lib_csg_parser = static_library( 'csg-parser', - 'impl/csg.cpp', - 'impl/levelset_3d.cpp', - 'impl/levelset_2d.cpp', - 'impl/parser.cpp', - 'impl/matrix_functions.cpp', + 'csg.cpp', + 'levelset_3d.cpp', + 'levelset_2d.cpp', + 'parser.cpp', + 'matrix_functions.cpp', + include_directories: parser_inc, dependencies: [pegtl, cgal], install : true) diff --git a/src/csg/impl/parser.cpp b/src/csg/parser.cpp similarity index 100% rename from src/csg/impl/parser.cpp rename to src/csg/parser.cpp diff --git a/src/csg/tests/CMakeLists.txt b/src/csg/tests/CMakeLists.txt index 5476ad70989482defa76cef2ef91410f0a012b12..7ba26c7ca9984aaa60ec00ead9ca38b0d89e9aa1 100644 --- a/src/csg/tests/CMakeLists.txt +++ b/src/csg/tests/CMakeLists.txt @@ -4,21 +4,21 @@ add_executable(unit_tests_csg EXCLUDE_FROM_ALL levelset/boolean.t.cpp + levelset/extrude.t.cpp levelset/primitives.t.cpp levelset/transform.t.cpp - levelset/extrude.t.cpp parser/boolean.t.cpp - parser/main.cpp + parser/extrude.t.cpp parser/nest.cpp parser/other.t.cpp parser/primitives.t.cpp parser/transform.t.cpp - parser/extrude.t.cpp + unit_tests_csg.main.cpp ) -target_include_directories(unit_tests_csg PRIVATE - .. - ../impl +target_include_directories(unit_tests_csg + PUBLIC ${CMAKE_SOURCE_DIR}/include + PRIVATE ${CMAKE_SOURCE_DIR}/src ${CONAN_INCLUDE_DIRS_CATCH2} ) diff --git a/src/csg/tests/levelset/extrude.t.cpp b/src/csg/tests/levelset/extrude.t.cpp index 6629bed95950ddcae36bd77531955bf00224360e..74404cf9d65c01acff45d1952ff3333cc492531a 100644 --- a/src/csg/tests/levelset/extrude.t.cpp +++ b/src/csg/tests/levelset/extrude.t.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace { diff --git a/src/csg/tests/levelset/transform.t.cpp b/src/csg/tests/levelset/transform.t.cpp index 14617503343e194f1d2082adf863f2dbd1b83a40..99bf3ef1cf19b2be9b253a969086738b9bf5c2cb 100644 --- a/src/csg/tests/levelset/transform.t.cpp +++ b/src/csg/tests/levelset/transform.t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include namespace { diff --git a/src/csg/tests/meson.build b/src/csg/tests/meson.build index b4f9e61677118253c23b3a3e465d6353f5aa8163..3051eab38b68a20003380649a7865d333298d53c 100644 --- a/src/csg/tests/meson.build +++ b/src/csg/tests/meson.build @@ -1,16 +1,16 @@ test_csg = executable( 'unit_tests_csg', 'levelset/boolean.t.cpp', + 'levelset/extrude.t.cpp', 'levelset/primitives.t.cpp', 'levelset/transform.t.cpp', - 'levelset/extrude.t.cpp', 'parser/boolean.t.cpp', - 'parser/main.cpp', + 'parser/extrude.t.cpp', 'parser/nest.cpp', 'parser/other.t.cpp', 'parser/primitives.t.cpp', 'parser/transform.t.cpp', - 'parser/extrude.t.cpp', + 'unit_tests_csg.main.cpp', include_directories: [parser_inc], dependencies: [catch2, cgal], link_with: lib_csg_parser, diff --git a/src/csg/tests/parser/main.cpp b/src/csg/tests/unit_tests_csg.main.cpp similarity index 100% rename from src/csg/tests/parser/main.cpp rename to src/csg/tests/unit_tests_csg.main.cpp diff --git a/src/csg/impl/matrix_functions.hpp b/src/csg_matrix_functions.hpp similarity index 100% rename from src/csg/impl/matrix_functions.hpp rename to src/csg_matrix_functions.hpp diff --git a/src/csg/impl/csg_types.hpp b/src/csg_types.hpp similarity index 99% rename from src/csg/impl/csg_types.hpp rename to src/csg_types.hpp index 0cf25494e37ca86160da2dca5fcc540e8b701a65..5077100942fe8e0a4c5185230a3e51804334700a 100644 --- a/src/csg/impl/csg_types.hpp +++ b/src/csg_types.hpp @@ -1,7 +1,7 @@ #ifndef CSG_TYPES_H_ #define CSG_TYPES_H_ -#include "matrix_functions.hpp" +#include "csg_matrix_functions.hpp" #include #include diff --git a/src/inputs/meson.build b/src/inputs/meson.build index 3e993c7f3c1acda088d6d430784399061e0e795c..ecc738394d6cad8c26466dabb75f11b485963478 100644 --- a/src/inputs/meson.build +++ b/src/inputs/meson.build @@ -5,7 +5,17 @@ lib_inputs_parser = static_library( 'parser.cpp', 'solver.cpp', 'time.cpp', + include_directories: parser_inc, dependencies: [pegtl], install : true) +executable( + 'mfix-parser', + 'mfix-parser.main.cpp', + include_directories: parser_inc, + link_with: [ + lib_csg_parser, + lib_inputs_parser, + ]) + subdir('tests') diff --git a/src/main.cpp b/src/inputs/mfix-parser.main.cpp similarity index 100% rename from src/main.cpp rename to src/inputs/mfix-parser.main.cpp diff --git a/src/inputs/tests/meson.build b/src/inputs/tests/meson.build index 0d0fa2409ffad2376f85d50c18bc449e7929ed42..68dfcaf0e2114b326b92b73141a58e93fb6ca936 100644 --- a/src/inputs/tests/meson.build +++ b/src/inputs/tests/meson.build @@ -2,7 +2,7 @@ test_inputs = executable( 'unit_tests_inputs', 'parser.t.cpp', 'solver.t.cpp', - 'main.cpp', + 'unit_tests_inputs.main.cpp', include_directories: [parser_inc], dependencies: [catch2], link_with: lib_inputs_parser diff --git a/src/inputs/tests/solver.t.cpp b/src/inputs/tests/solver.t.cpp index c7343f4fb9073b39da0237c36fc31775460c804c..580175235de25288e89016897517a2c8f5be2b9a 100644 --- a/src/inputs/tests/solver.t.cpp +++ b/src/inputs/tests/solver.t.cpp @@ -1,6 +1,6 @@ #include "catch2/catch.hpp" -#include +#include #include TEST_CASE("GeometrySettings", "[]") { diff --git a/src/inputs/tests/main.cpp b/src/inputs/tests/unit_tests_inputs.main.cpp similarity index 100% rename from src/inputs/tests/main.cpp rename to src/inputs/tests/unit_tests_inputs.main.cpp diff --git a/src/inputs/solver_impl.hpp b/src/solver_impl.hpp similarity index 100% rename from src/inputs/solver_impl.hpp rename to src/solver_impl.hpp diff --git a/src/inputs/inputs.hpp b/src/solver_inputs.hpp similarity index 100% rename from src/inputs/inputs.hpp rename to src/solver_inputs.hpp