2020-03-27 14:49:12 +08:00
|
|
|
# MS Utils
|
|
|
|
#
|
|
|
|
|
|
|
|
function(find_python_package out_inc out_lib)
|
|
|
|
# Use PYTHON_EXECUTABLE if it is defined, otherwise default to python
|
2021-01-23 20:20:31 +08:00
|
|
|
if("${PYTHON_EXECUTABLE}" STREQUAL "")
|
2020-03-27 14:49:12 +08:00
|
|
|
set(PYTHON_EXECUTABLE "python3")
|
|
|
|
else()
|
|
|
|
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"
|
|
|
|
RESULT_VARIABLE result
|
|
|
|
OUTPUT_VARIABLE inc)
|
|
|
|
string(STRIP "${inc}" inc)
|
|
|
|
set(${out_inc} ${inc} PARENT_SCOPE)
|
2021-01-23 20:20:31 +08:00
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
execute_process(
|
2021-03-21 15:25:28 +08:00
|
|
|
COMMAND "${PYTHON_EXECUTABLE}" -c "import distutils.sysconfig as sysconfig; import os; \
|
|
|
|
print(os.path.join(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')))"
|
2020-03-27 14:49:12 +08:00
|
|
|
RESULT_VARIABLE result
|
|
|
|
OUTPUT_VARIABLE lib)
|
|
|
|
string(STRIP "${lib}" lib)
|
|
|
|
set(${out_lib} ${lib} PARENT_SCOPE)
|
|
|
|
endfunction()
|