Skip to content

Commit

Permalink
Allowed for separation of python installation path to support conda p…
Browse files Browse the repository at this point in the history
…ackage.
  • Loading branch information
mparno committed Aug 16, 2022
1 parent 75af247 commit 36ba9ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ option(MPART_MATLAB "Build matlab bindings with pybind11" ON)
option(MPART_JULIA "Build julia bindings with CxxWrap.jl" ON)
option(MPART_FETCH_DEPS "If CMake should be allowed to fetch and build external dependencies that weren't found." ON)

##############################################################
# Installation path configuration
Include(SetInstallPaths)

##############################################################
# Compiler configuration

Expand Down
4 changes: 2 additions & 2 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pybind11_add_module(pympart SHARED NO_EXTRAS ${PYTHON_BINDING_SOURCES})
target_link_libraries(pympart PRIVATE mpart Kokkos::kokkos Eigen3::Eigen)

# Add an installation target for the python bindings
install(TARGETS pympart DESTINATION python/mpart)
install(DIRECTORY package/ DESTINATION python/mpart)
install(TARGETS pympart DESTINATION "${PYTHON_INSTALL_PREFIX}/mpart")
install(DIRECTORY package/ DESTINATION "${PYTHON_INSTALL_PREFIX}/mpart")
10 changes: 10 additions & 0 deletions cmake/SetInstallPaths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


if(PYTHON_INSTALL_PREFIX)
message(STATUS "PYTHON_INSTALL_PREFIX was set by user to be ${PYTHON_INSTALL_PREFIX}.")
else()
message(STATUS "PYTHON_INSTALL_PREFIX was not set by user, defaulting to CMAKE_INSTALL_PREFIX/python.")
set(PYTHON_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/python)
endif()

message(STATUS "Python packages will be installed to ${PYTHON_INSTALL_PREFIX}.")

0 comments on commit 36ba9ec

Please sign in to comment.