Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions pygmds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 ()
#==============================================================================