mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
ifcwrap/CMakeLists.txt: as PYTHONLIBS_FOUND and PYTHONINTERP_FOUND cannot seem to be trusted, perform further checks to see whether the packages were actually found or not.
E.g. one can doo set PYTHONHOME=C:/NoPythonHere and when running CMake it will happily report: -- Found PythonLibs: C:/NoPythonHere/libs/python34.lib
This commit is contained in:
committed by
Thomas Krijnen
parent
7fdbc9811d
commit
dd8ee915c3
@@ -33,18 +33,20 @@ IF(NOT "$ENV{PYTHON_LIBRARY}" STREQUAL "")
|
|||||||
MESSAGE(STATUS "Looking for Python library file in: ${PYTHON_LIBRARY}")
|
MESSAGE(STATUS "Looking for Python library file in: ${PYTHON_LIBRARY}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# NOTE PYTHONLIBS_FOUND and PYTHONINTERP_FOUND cannot seem to be trusted so
|
||||||
|
# we need further checks to see whether the packages were actually found or not.
|
||||||
FIND_PACKAGE(PythonLibs)
|
FIND_PACKAGE(PythonLibs)
|
||||||
IF(NOT PYTHONLIBS_FOUND)
|
IF(NOT PYTHONLIBS_FOUND OR "$PYTHON_INCLUDE_DIRS}" STREQUAL "")
|
||||||
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
|
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
SET(CMAKE_SWIG_FLAGS "")
|
SET(CMAKE_SWIG_FLAGS "")
|
||||||
# NOTE Workaround for most likely missing debug Python libraries on Windows (requires Python built from the source).
|
# NOTE Workaround for most likely missing debug Python libraries on Windows (requires Python built from the source).
|
||||||
# Python 3.5 intaller and onwards will have an option to install the debug libraries too.
|
# Python 3.5 intaller and onwards will have an option to install the debug libraries too.
|
||||||
|
# NOTE PYTHON_DEBUG_LIBRARIES appears to be a deprecated variable
|
||||||
IF (WIN32 AND NOT PYTHON_DEBUG_LIBRARIES)
|
IF (WIN32 AND NOT PYTHON_DEBUG_LIBRARIES)
|
||||||
MESSAGE(STATUS "PYTHON_DEBUG_LIBRARIES not found, defining SWIG_PYTHON_INTERPRETER_NO_DEBUG workaround for IfcWrap.")
|
MESSAGE(STATUS "PYTHON_DEBUG_LIBRARIES not found, defining SWIG_PYTHON_INTERPRETER_NO_DEBUG workaround for IfcWrap.")
|
||||||
ADD_DEFINITIONS(-DSWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
ADD_DEFINITIONS(-DSWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
||||||
@@ -67,7 +69,7 @@ endif()
|
|||||||
# Try to find the Python interpreter to get the site-packages
|
# Try to find the Python interpreter to get the site-packages
|
||||||
# directory in which the wrapper can be installed.
|
# directory in which the wrapper can be installed.
|
||||||
FIND_PACKAGE(PythonInterp)
|
FIND_PACKAGE(PythonInterp)
|
||||||
IF(PYTHONINTERP_FOUND)
|
IF(PYTHONINTERP_FOUND AND NOT "${PYTHON_EXECUTABLE}" STREQUAL "")
|
||||||
EXECUTE_PROCESS(
|
EXECUTE_PROCESS(
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
|
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
|
OUTPUT_VARIABLE python_package_dir
|
||||||
|
|||||||
Reference in New Issue
Block a user