@@ -274,53 +274,53 @@ if(BUILD_PYTHON)
274274 message (STATUS "Subdirectory 'extern/pybind11' added." )
275275 endif ()
276276
277- # Build the Python module
278- pybind11_add_module (daisy pybinds/setup.cpp )
277+ # Build the Python module as daisy._core
278+ pybind11_add_module (daisy_core pybinds/setup.cpp )
279+ set_target_properties (daisy_core PROPERTIES
280+ OUTPUT_NAME "_core"
281+ PREFIX "" # no 'lib' prefix, produce _core.cpython-*.so
282+ LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR} /daisy"
283+ )
279284 if (DEBUG_MSG)
280- message (STATUS "Python module 'daisy' created from pybinds/setup.cpp." )
285+ message (STATUS "Python module 'daisy._core ' created from pybinds/setup.cpp." )
281286 endif ()
282287
283- target_link_libraries (daisy PRIVATE dino_lib )
288+ target_link_libraries (daisy_core PRIVATE dino_lib )
284289 if (DEBUG_MSG)
285- message (STATUS "Python module 'daisy' linked to 'dino_lib'." )
290+ message (STATUS "Python module 'daisy._core ' linked to 'dino_lib'." )
286291 endif ()
287292
288293 # Pass BUILD_SING_ENABLED definition to Python module
289294 if (BUILD_SING_AVAILABLE)
290- target_compile_definitions (daisy PRIVATE SING_CUDA_ENABLED=1 )
295+ target_compile_definitions (daisy_core PRIVATE SING_CUDA_ENABLED=1 )
291296 if (DEBUG_MSG)
292- message (STATUS "Python module 'daisy' compiled with SING_CUDA_ENABLED=1." )
297+ message (STATUS "Python module 'daisy._core ' compiled with SING_CUDA_ENABLED=1." )
293298 endif ()
294299 else ()
295- target_compile_definitions (daisy PRIVATE SING_CUDA_ENABLED=0 )
300+ target_compile_definitions (daisy_core PRIVATE SING_CUDA_ENABLED=0 )
296301 if (DEBUG_MSG)
297- message (STATUS "Python module 'daisy' compiled with SING_CUDA_ENABLED=0." )
302+ message (STATUS "Python module 'daisy._core ' compiled with SING_CUDA_ENABLED=0." )
298303 endif ()
299304 endif ()
300305
306+ # Link Python module 'daisy._core' with MPI when Odyssey is available
301307 if (BUILD_ODYSSEY_AVAILABLE)
302308 if (DEBUG_MSG)
303- message (STATUS "Linking Python module 'daisy' with MPI." )
309+ message (STATUS "Linking Python module 'daisy._core ' with MPI." )
304310 endif ()
305- target_link_libraries (daisy PRIVATE ${MPI_CXX_LIBRARIES} )
306- target_include_directories (daisy PRIVATE ${MPI_CXX_INCLUDE_DIRS} )
311+ target_link_libraries (daisy_core PRIVATE ${MPI_CXX_LIBRARIES} )
312+ target_include_directories (daisy_core PRIVATE ${MPI_CXX_INCLUDE_DIRS} )
307313 if (DEBUG_MSG)
308314 message (DEBUG "MPI Libraries: ${MPI_CXX_LIBRARIES} " )
309315 message (DEBUG "MPI Includes: ${MPI_CXX_INCLUDE_DIRS} " )
310316 endif ()
311317 else ()
312318 if (DEBUG_MSG)
313- message (STATUS "BUILD_ODYSSEY_AVAILABLE is FALSE. Python module 'daisy' will NOT be linked with MPI." )
319+ message (STATUS "BUILD_ODYSSEY_AVAILABLE is FALSE. Python module 'daisy._core ' will NOT be linked with MPI." )
314320 endif ()
315- endif ()
316-
317- # Set output directory for the .so file (demos/ so that import daisy finds daisy.*.so when run from demos)
318- set_target_properties (daisy PROPERTIES
319- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR} /demos"
320- )
321- if (DEBUG_MSG)
322- message (STATUS "Python module 'daisy' output directory set to: ${CMAKE_SOURCE_DIR} /demos" )
323321 endif ()
322+
323+ # (Python module 'daisy._core' already configured to output into ${PROJECT_SOURCE_DIR}/daisy above)
324324else ()
325325 if (DEBUG_MSG)
326326 message (STATUS "BUILD_PYTHON is OFF. Skipping Python bindings." )
0 commit comments