1
- if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
2
- # pybind11 logic for setting up a debug build when both a debug and release
3
- # python interpreter are present in the system seems to be pretty much broken.
4
- # This works around the issue.
5
- set (PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES} " )
6
- endif ()
7
-
8
-
9
1
if (USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
10
- if (${CMAKE_VERSION} VERSION_LESS "3.12.0" )
11
- execute_process (
12
- COMMAND "${PYTHON_EXECUTABLE} " -c "if True:
13
- from distutils import sysconfig as sc
14
- print(sc.get_python_lib(plat_specific=True))"
15
- OUTPUT_VARIABLE Python3_SITEARCH
16
- OUTPUT_STRIP_TRAILING_WHITESPACE)
17
- else ()
18
- # Get install variable from Python3 module
19
- # Python3_SITEARCH is available from 3.12 on, workaround if needed:
2
+ if (NOT Python3_SITEARCH)
3
+ # Get variable from Python3 module
20
4
find_package (Python3 COMPONENTS Interpreter)
21
5
endif ()
22
6
31
15
set (GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR} /python)
32
16
endif ()
33
17
34
- set (GZ_PYTHON_EXECUTABLE ${Python3_EXECUTABLE} )
35
18
set (GZ_PYTHON_INSTALL_PATH "${GZ_PYTHON_INSTALL_PATH} /gz" )
36
19
37
20
# Set the build location and install location for a CPython extension
@@ -101,7 +84,7 @@ if (BUILD_TESTING)
101
84
world_TEST
102
85
)
103
86
104
- execute_process (COMMAND "${GZ_PYTHON_EXECUTABLE } " -m pytest --version
87
+ execute_process (COMMAND "${Python3_EXECUTABLE } " -m pytest --version
105
88
OUTPUT_VARIABLE PYTEST_output
106
89
ERROR_VARIABLE PYTEST_error
107
90
RESULT_VARIABLE PYTEST_result)
@@ -115,10 +98,10 @@ if (BUILD_TESTING)
115
98
foreach (test ${python_tests} )
116
99
if (pytest_FOUND)
117
100
add_test (NAME ${test} COMMAND
118
- "${GZ_PYTHON_EXECUTABLE } " -m pytest "${CMAKE_SOURCE_DIR} /python/test/${test} .py" --junitxml "${CMAKE_BINARY_DIR} /test_results/UNIT_${test} .xml" )
101
+ "${Python3_EXECUTABLE } " -m pytest "${CMAKE_SOURCE_DIR} /python/test/${test} .py" --junitxml "${CMAKE_BINARY_DIR} /test_results/UNIT_${test} .xml" )
119
102
else ()
120
103
add_test (NAME ${test} COMMAND
121
- "${GZ_PYTHON_EXECUTABLE } " "${CMAKE_SOURCE_DIR} /python/test/${test} .py" )
104
+ "${Python3_EXECUTABLE } " "${CMAKE_SOURCE_DIR} /python/test/${test} .py" )
122
105
endif ()
123
106
124
107
set (_env_vars)
0 commit comments