Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake Warning FindPythonInterp and FindPythonLibs modules are removed #486

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
cmake_minimum_required(VERSION 3.16)
project(OPENXR)

find_package(PythonInterp 3)
find_package(Python3 COMPONENTS Interpreter)
include(CTest)

# Enable IDE GUI folders. "Helper targets" that don't have interesting source code should set their FOLDER property to this
Expand All @@ -44,7 +44,7 @@ option(
OFF
)

if(BUILD_FORCE_GENERATION AND NOT PYTHON_EXECUTABLE)
if(BUILD_FORCE_GENERATION AND NOT Python3_EXECUTABLE)
message(FATAL_ERROR "BUILD_FORCE_GENERATION requires Python")
endif()

Expand Down
1 change: 1 addition & 0 deletions changes/sdk/pr.486.gh.OpenXR-SDK-Source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improvement: Migrate CMake build system away from using `find_package(PythonInterpreter)`, deprecated since CMake 3.12. Use `find_package(Python3 COMPONENTS Interpreter)` instead.
2 changes: 1 addition & 1 deletion include/openxr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ else()
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${output}"
COMMAND
"${CMAKE_COMMAND}" -E env "PYTHONPATH=${CODEGEN_PYTHON_PATH}"
"${PYTHON_EXECUTABLE}"
"${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/specification/scripts/genxr.py" -registry
"${PROJECT_SOURCE_DIR}/specification/registry/xr.xml" -o
"${CMAKE_CURRENT_BINARY_DIR}" ${output}
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ macro(run_xr_xml_generate dependency output)
)
list(APPEND GENERATED_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${output}")
else()
if(NOT PYTHON_EXECUTABLE)
if(NOT Python3_EXECUTABLE)
message(
FATAL_ERROR
"Python 3 not found, but pre-generated ${CMAKE_CURRENT_SOURCE_DIR}/${output} not found"
Expand All @@ -439,7 +439,7 @@ macro(run_xr_xml_generate dependency output)
OUTPUT "${output}"
COMMAND
"${CMAKE_COMMAND}" -E env "PYTHONPATH=${CODEGEN_PYTHON_PATH}"
"${PYTHON_EXECUTABLE}"
"${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/src/scripts/src_genxr.py" -registry
"${PROJECT_SOURCE_DIR}/specification/registry/xr.xml"
"${output}"
Expand All @@ -453,7 +453,7 @@ macro(run_xr_xml_generate dependency output)
${ARGN}
VERBATIM
COMMENT
"Generating ${output} using ${PYTHON_EXECUTABLE} on ${dependency}"
"Generating ${output} using ${Python3_EXECUTABLE} on ${dependency}"
)
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
list(APPEND GENERATED_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${output}")
Expand All @@ -475,7 +475,7 @@ macro(
OUTPUT "${filename}"
COMMAND
"${CMAKE_COMMAND}" -E env "PYTHONPATH=${CODEGEN_PYTHON_PATH}"
"${PYTHON_EXECUTABLE}"
"${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/src/scripts/generate_api_layer_manifest.py"
-f "${filename}" -n ${layername} -l ${libfile} -a ${MAJOR}.${MINOR}
-v ${version} ${genbad} -d ${desc}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/loader_test/test_runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ macro(gen_xr_runtime_json filename libfile)
add_custom_command(
OUTPUT ${filename}
COMMAND
"${PYTHON_EXECUTABLE}"
"${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/src/scripts/generate_runtime_manifest.py" -f
${filename} -l ${libfile} ${ARGN}
DEPENDS "${PROJECT_SOURCE_DIR}/src/scripts/generate_runtime_manifest.py"
Expand Down
Loading