diff --git a/pygmds/CMakeLists.txt b/pygmds/CMakeLists.txt index 27859f12b..5180ca986 100644 --- a/pygmds/CMakeLists.txt +++ b/pygmds/CMakeLists.txt @@ -3,21 +3,38 @@ cmake_minimum_required(VERSION 3.10) find_package(pybind11 REQUIRED) -pybind11_add_module(gmds - src/binding_math.cpp - src/binding_mesh.cpp - src/binding_geometry.cpp - src/binding_blocking.cpp - src/gmds_facade.cpp - ) +if(ENABLE_BLOCKING) + pybind11_add_module(gmds + src/binding_math.cpp + src/binding_mesh.cpp + src/binding_geometry.cpp + src/binding_blocking.cpp + src/gmds_facade.cpp + ) +else () + pybind11_add_module(gmds + src/binding_math.cpp + src/binding_mesh.cpp + src/binding_geometry.cpp + src/gmds_facade.cpp + ) +endif () target_link_libraries(gmds PRIVATE ${LIB_GMDS_IG} ${LIB_GMDS_CADFAC} - LIB_GMDS_BLOCKING ${LIB_GMDS_IO} ) +if(ENABLE_BLOCKING) + target_link_libraries(gmds PRIVATE + LIB_GMDS_BLOCKING + ) +endif () + target_compile_definitions(gmds PUBLIC cxx_std_14) +if(ENABLE_BLOCKING) + target_compile_definitions(gmds PUBLIC ENABLE_BLOCKING=1) +endif () install(TARGETS gmds COMPONENT python diff --git a/pygmds/src/gmds_facade.cpp b/pygmds/src/gmds_facade.cpp index 4585a846f..c17681368 100644 --- a/pygmds/src/gmds_facade.cpp +++ b/pygmds/src/gmds_facade.cpp @@ -6,7 +6,9 @@ namespace py = pybind11; void bind_math(py::module &); void bind_mesh(py::module &); void bind_geometry(py::module &); +#if ENABLE_BLOCKING void bind_blocking(py::module &); +#endif /*----------------------------------------------------------------------------*/ // ig is the submodule name PYBIND11_MODULE(gmds, m) @@ -22,6 +24,8 @@ PYBIND11_MODULE(gmds, m) bind_mesh(sub_mesh); auto sub_geom = m.def_submodule("cad", "cad interface"); bind_geometry(sub_geom); +#if ENABLE_BLOCKING auto sub_block = m.def_submodule("blocking", "blocking kernel"); bind_blocking(sub_block); +#endif } diff --git a/pygmds/tst/CMakeLists.txt b/pygmds/tst/CMakeLists.txt index c339d844a..9d33702bf 100644 --- a/pygmds/tst/CMakeLists.txt +++ b/pygmds/tst/CMakeLists.txt @@ -1,9 +1,22 @@ #============================================================================== message("ENVIRONMENT ENVPYTHONPATH $ENV{PYTHONPATH}") -add_test(NAME test_pygmds - COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR} ${TEST_SAMPLES_DIR} -v - ) -set_tests_properties(test_pygmds +add_test(NAME test_pygmds_geometry + COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_mesh.py ${TEST_SAMPLES_DIR} -v +) +add_test(NAME test_pygmds_mesh + COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_geometry.py ${TEST_SAMPLES_DIR} -v +) +set_tests_properties(test_pygmds_geometry + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}") +set_tests_properties(test_pygmds_mesh PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}") + +if (ENABLE_BLOCKING) + add_test(NAME test_pygmds_blocking + COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_blocking.py ${TEST_SAMPLES_DIR} -v + ) + set_tests_properties(test_pygmds_blocking + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}") +endif () #==============================================================================