mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
Let CMake find python interpreter for schema compilation and installation dir
Remove unused compiled schema in cpp installation target
This commit is contained in:
+24
-16
@@ -54,21 +54,29 @@ SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON)
|
||||
SWIG_ADD_MODULE(ifcopenshell_wrapper python IfcPython.i)
|
||||
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper IfcParse IfcGeom ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${ICU_LIBRARIES})
|
||||
|
||||
# To install IfcPython let's get the site-packages dir from python
|
||||
EXECUTE_PROCESS(COMMAND
|
||||
python -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"
|
||||
OUTPUT_VARIABLE python_package_dir)
|
||||
# Try to find the Python interpreter to get the site-packages
|
||||
# directory in which the wrapper can be installed.
|
||||
FIND_PACKAGE(PythonInterp)
|
||||
IF(PYTHONINTERP_FOUND)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
|
||||
IF("${python_package_dir}" STREQUAL "")
|
||||
MESSAGE(FATAL_ERROR "Python executable not in PATH, aborting")
|
||||
IF("${python_package_dir}" STREQUAL "")
|
||||
MESSAGE(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")
|
||||
ELSE()
|
||||
INSTALL(FILES
|
||||
"${CMAKE_BINARY_DIR}/ifcwrap/ifcopenshell_wrapper.py"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/__init__.py"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/guid.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
INSTALL(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/occ_utils.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell/geom")
|
||||
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(WARNING "No Python interpreter found, unable to install the Python wrapper")
|
||||
ENDIF()
|
||||
|
||||
INSTALL(FILES
|
||||
"${CMAKE_BINARY_DIR}/ifcwrap/ifcopenshell_wrapper.py"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/__init__.py"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/guid.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
INSTALL(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell/geom")
|
||||
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
|
||||
Reference in New Issue
Block a user