Skip to content

Commit

Permalink
Fix Python (#1401)
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-h authored Mar 8, 2024
1 parent f50d674 commit 4f37872
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,18 @@ if (COMPILER_SUPPORTS_EXTRA_SEMI_WARNING)
add_compile_options("-Wextra-semi")
endif()

if(${CMAKE_VERSION} VERSION_LESS_EQUAL "3.12")
find_package(PythonInterp 3 REQUIRED)
else ()
find_package(Python COMPONENTS Interpreter REQUIRED)
endif ()
find_package(Python COMPONENTS Interpreter REQUIRED)

if (SHADERC_ENABLE_COPYRIGHT_CHECK)
add_custom_target(check-copyright ALL
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
--check
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Check copyright")
endif()

add_custom_target(add-copyright
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Add copyright")

Expand Down Expand Up @@ -134,7 +130,7 @@ if(${SHADERC_ENABLE_EXAMPLES})
endif()

add_custom_target(build-version
${PYTHON_EXECUTABLE}
${Python_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
Expand Down
6 changes: 1 addition & 5 deletions cmake/setup_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ if (ANDROID)
find_host_package(PythonInterp 3 REQUIRED)
find_host_package(BISON)
else()
if(${CMAKE_VERSION} VERSION_LESS_EQUAL "3.12")
find_package(PythonInterp 3 REQUIRED)
else ()
find_package(Python COMPONENTS Interpreter REQUIRED)
endif ()
find_package(Python COMPONENTS Interpreter REQUIRED)
endif()

option(DISABLE_RTTI "Disable RTTI in builds")
Expand Down
6 changes: 3 additions & 3 deletions glslc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# limitations under the License.

add_test(NAME shaderc_expect_unittests
COMMAND ${PYTHON_EXECUTABLE} -m unittest expect_unittest.py
COMMAND ${Python_EXECUTABLE} -m unittest expect_unittest.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME shaderc_glslc_test_framework_unittests
COMMAND ${PYTHON_EXECUTABLE} -m unittest glslc_test_framework_unittest.py
COMMAND ${Python_EXECUTABLE} -m unittest glslc_test_framework_unittest.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

if(${SHADERC_ENABLE_TESTS})
add_test(NAME glslc_tests
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/glslc_test_framework.py
$<TARGET_FILE:glslc_exe> $<TARGET_FILE:spirv-dis>
--test-dir ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down

0 comments on commit 4f37872

Please sign in to comment.