Skip to content

Commit

Permalink
feat: add VIENNAPS_PACKAGE_PYTHON
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Apr 18, 2024
1 parent a0918c2 commit e9071fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ project(
option(VIENNAPS_USE_DOUBLE "Use double precision floating point numbers in application" OFF)
option(VIENNAPS_BUILD_APPLICATION "Build application" OFF)

option(VIENNAPS_PACKAGE_PYTHON "Build python bindings with intent to publish wheel" OFF)
option(VIENNAPS_BUILD_PYTHON "Build python bindings" OFF)

option(VIENNAPS_BUILD_EXAMPLES "Build examples" OFF)
option(VIENNAPS_BUILD_TESTS "Build tests" OFF)

Expand All @@ -33,6 +35,16 @@ list(APPEND CMAKE_PREFIX_PATH ${VIENNAPS_LOOKUP_DIRS})
# link against the vtk-python libs
# --------------------------------------------------------------------------------------------------------

if(VIENNAPS_PACKAGE_PYTHON)
message(
STATUS
"[ViennaPS] Skipping system dependencies due to 'VIENNALS_PACKAGE_PYTHON', the build will take a long time!"
)

set(CPM_DOWNLOAD_ALL ON)
set(VIENNAPS_BUILD_PYTHON ON)
endif()

if(VIENNAPS_BUILD_PYTHON)
set(CMAKE_PLATFORM_NO_VERSIONED_SONAME ON)
endif()
Expand Down
15 changes: 6 additions & 9 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ add_custom_target(${PROJECT_NAME} ALL)
# --------------------------------------------------------------------------------------------------------

set(CMAKE_MACOSX_RPATH ON)

set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)

if(NOT APPLE)
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN")
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../vtkmodules")
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../viennals.libs")
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/../viennaps.libs")
else()
list(APPEND CMAKE_INSTALL_RPATH "@loader_path")
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../vtkmodules")
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../viennals.libs")
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../viennaps.libs")
endif()

Expand Down Expand Up @@ -77,23 +81,16 @@ setup_binding(viennaps3d -DVIENNAPS_PYTHON_DIMENSION=3)
set(VIENNAPS_LIB_FOLDER "${VIENNAPS_LIBRARY_OUTPUT_DIR}/viennaps.libs")
set(VIENNAPS_USE_LIB_FOLDER OFF)

if(NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_EMBREE)
if(VIENNAPS_PACKAGE_PYTHON OR (NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_EMBREE))
set(VIENNAPS_USE_LIB_FOLDER ON)
setup_embree_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}")
endif()

if(NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_TBB)
if(VIENNAPS_PACKAGE_PYTHON OR (NOT VIENNAPS_SYSTEM_VIENNARAY AND NOT VIENNARAY_SYSTEM_TBB))
set(VIENNAPS_USE_LIB_FOLDER ON)
setup_tbb_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}")
endif()

if(NOT VIENNAPS_SYSTEM_VIENNALS
AND (APPLE OR WIN32)
AND NOT VIENNALS_SYSTEM_VTK)
set(VIENNAPS_USE_LIB_FOLDER ON)
setup_vtk_env(${MODULE_NAME} "${VIENNAPS_LIB_FOLDER}")
endif()

if(VIENNAPS_USE_LIB_FOLDER)
install(DIRECTORY "${VIENNAPS_LIB_FOLDER}" DESTINATION .)
endif()

0 comments on commit e9071fb

Please sign in to comment.