Skip to content

Commit

Permalink
Added logic to handle installation to a user-defined location
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuponitskiy-duality committed Jul 2, 2024
1 parent 031e128 commit 1666eb1
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,24 @@ find_package(PythonInterp REQUIRED)

# Check Python version
if(${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER_EQUAL 10)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c "from sys import exec_prefix; print(exec_prefix)"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c "from sys import exec_prefix; print(exec_prefix)"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
execute_process(
COMMAND "${Python_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()



message(STATUS "Python site packages directory: ${PYTHON_SITE_PACKAGES}")
install(TARGETS openfhe LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(Python_Install_Location "${PYTHON_SITE_PACKAGES}")
else()
set(Python_Install_Location "${CMAKE_INSTALL_PREFIX}")
endif()
message("***** INSTALL IS AT ${Python_Install_Location}; to change, run cmake with -DCMAKE_INSTALL_PREFIX=/your/path")
install(TARGETS openfhe LIBRARY DESTINATION ${Python_Install_Location})

0 comments on commit 1666eb1

Please sign in to comment.