Skip to content

Commit

Permalink
enable deactivation of the blocking component in pygmds
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslg committed Mar 27, 2024
1 parent f3f4d97 commit 3c80e76
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
35 changes: 27 additions & 8 deletions pygmds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,40 @@ 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}
)
# it should not be necessary
add_dependencies(gmds ${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
Expand Down
4 changes: 4 additions & 0 deletions pygmds/src/gmds_facade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
21 changes: 17 additions & 4 deletions pygmds/tst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 ()
#==============================================================================

0 comments on commit 3c80e76

Please sign in to comment.