mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Added USERSPACE_PYTHON_PREFIX cmake variable to allow install IfcPython in userspace instead of system-wide.
This commit is contained in:
committed by
Thomas Krijnen
parent
3e9fff6c19
commit
c76c72c017
@@ -49,6 +49,7 @@ endif()
|
||||
if (${BUILD_CONVERT})
|
||||
OPTION(GLTF_SUPPORT "Build IfcConvert with glTF support (requires json.hpp)." OFF)
|
||||
endif()
|
||||
OPTION(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF)
|
||||
|
||||
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
|
||||
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
|
||||
|
||||
@@ -68,10 +68,17 @@ endif()
|
||||
# directory in which the wrapper can be installed.
|
||||
FIND_PACKAGE(PythonInterp)
|
||||
IF(PYTHONINTERP_FOUND AND NOT "${PYTHON_EXECUTABLE}" STREQUAL "")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
IF (USERSPACE_PYTHON_PREFIX)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import site; sys.stdout.write(site.USER_SITE)"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ELSE ()
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF("${python_package_dir}" STREQUAL "")
|
||||
MESSAGE(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")
|
||||
|
||||
Reference in New Issue
Block a user