Skip to content

Commit 3b19a2f

Browse files
committed
enable deactivation of the blocking component in pygmds
1 parent f3f4d97 commit 3b19a2f

File tree

3 files changed

+48
-12
lines changed

3 files changed

+48
-12
lines changed

pygmds/CMakeLists.txt

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@ cmake_minimum_required(VERSION 3.10)
33

44
find_package(pybind11 REQUIRED)
55

6-
pybind11_add_module(gmds
7-
src/binding_math.cpp
8-
src/binding_mesh.cpp
9-
src/binding_geometry.cpp
10-
src/binding_blocking.cpp
11-
src/gmds_facade.cpp
12-
)
6+
if(ENABLE_BLOCKING)
7+
pybind11_add_module(gmds
8+
src/binding_math.cpp
9+
src/binding_mesh.cpp
10+
src/binding_geometry.cpp
11+
src/binding_blocking.cpp
12+
src/gmds_facade.cpp
13+
)
14+
else ()
15+
pybind11_add_module(gmds
16+
src/binding_math.cpp
17+
src/binding_mesh.cpp
18+
src/binding_geometry.cpp
19+
src/gmds_facade.cpp
20+
)
21+
endif ()
1322

1423
target_link_libraries(gmds PRIVATE
1524
${LIB_GMDS_IG}
1625
${LIB_GMDS_CADFAC}
17-
LIB_GMDS_BLOCKING
1826
${LIB_GMDS_IO}
1927
)
28+
if(ENABLE_BLOCKING)
29+
target_link_libraries(gmds PRIVATE
30+
LIB_GMDS_BLOCKING
31+
)
32+
# it should not be necessary
33+
# add_dependencies(gmds LIB_GMDS_BLOCKING)
34+
endif ()
35+
2036
target_compile_definitions(gmds PUBLIC cxx_std_14)
37+
if(ENABLE_BLOCKING)
38+
target_compile_definitions(gmds PUBLIC ENABLE_BLOCKING=1)
39+
endif ()
2140

2241
install(TARGETS gmds
2342
COMPONENT python

pygmds/src/gmds_facade.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ namespace py = pybind11;
66
void bind_math(py::module &);
77
void bind_mesh(py::module &);
88
void bind_geometry(py::module &);
9+
#if ENABLE_BLOCKING
910
void bind_blocking(py::module &);
11+
#endif
1012
/*----------------------------------------------------------------------------*/
1113
// ig is the submodule name
1214
PYBIND11_MODULE(gmds, m)
@@ -22,6 +24,8 @@ PYBIND11_MODULE(gmds, m)
2224
bind_mesh(sub_mesh);
2325
auto sub_geom = m.def_submodule("cad", "cad interface");
2426
bind_geometry(sub_geom);
27+
#if ENABLE_BLOCKING
2528
auto sub_block = m.def_submodule("blocking", "blocking kernel");
2629
bind_blocking(sub_block);
30+
#endif
2731
}

pygmds/tst/CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
#==============================================================================
22
message("ENVIRONMENT ENVPYTHONPATH $ENV{PYTHONPATH}")
33

4-
add_test(NAME test_pygmds
5-
COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR} ${TEST_SAMPLES_DIR} -v
6-
)
7-
set_tests_properties(test_pygmds
4+
add_test(NAME test_pygmds_geometry
5+
COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_mesh.py ${TEST_SAMPLES_DIR} -v
6+
)
7+
add_test(NAME test_pygmds_mesh
8+
COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_geometry.py ${TEST_SAMPLES_DIR} -v
9+
)
10+
set_tests_properties(test_pygmds_geometry
11+
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}")
12+
set_tests_properties(test_pygmds_mesh
813
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}")
14+
15+
if (ENABLE_BLOCKING)
16+
add_test(NAME test_pygmds_blocking
17+
COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_blocking.py ${TEST_SAMPLES_DIR} -v
18+
)
19+
set_tests_properties(test_pygmds_blocking
20+
PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/pygmds:$ENV{PYTHONPATH}")
21+
endif ()
922
#==============================================================================

0 commit comments

Comments
 (0)