Changed python lib detection mechanism
This commit is contained in:
parent
87a41d890e
commit
ae1480a118
@ -7,8 +7,9 @@ include(GetGitRevisionDescription)
|
|||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
include(FindOpenMP)
|
include(FindOpenMP)
|
||||||
|
|
||||||
include(FindPythonLibs)
|
include(FindPythonInterp)
|
||||||
set(NumPy_FIND_REQUIRED TRUE)
|
set(NumPy_FIND_REQUIRED TRUE)
|
||||||
|
include(${CMAKE_SOURCE_DIR}/FindPyLibs.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
|
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
|
||||||
|
|
||||||
|
|
||||||
|
30
FindPyLibs.cmake
Normal file
30
FindPyLibs.cmake
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
||||||
|
"import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(os.path.join(v['LIBDIR'],v['LDLIBRARY']));"
|
||||||
|
RESULT_VARIABLE _PYLIB_SEARCH_SUCCESS
|
||||||
|
OUTPUT_VARIABLE _PYLIB_VALUES_OUTPUT
|
||||||
|
ERROR_VARIABLE _PYLIB_ERROR_VALUE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
||||||
|
"import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(v['INCLUDEPY']);"
|
||||||
|
RESULT_VARIABLE _PYINC_SEARCH_SUCCESS
|
||||||
|
OUTPUT_VARIABLE _PYINC_VALUES_OUTPUT
|
||||||
|
ERROR_VARIABLE _PYINC_ERROR_VALUE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
|
||||||
|
if(NOT _PYLIB_SEARCH_SUCCESS MATCHES 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PyLib search failure:\n${_PYLIB_ERROR_VALUE}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _PYINC_SEARCH_SUCCESS MATCHES 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PyInc search failure:\n${_PYINC_ERROR_VALUE}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set(PYTHON_LIBRARY ${_PYLIB_VALUES_OUTPUT} CACHE PATH "Python runtime library path")
|
||||||
|
set(PYTHON_INCLUDE_PATH ${_PYINC_VALUES_OUTPUT} CACHE PATH "Python runtime include path")
|
Loading…
Reference in New Issue
Block a user