diff --git a/CMakeLists.txt b/CMakeLists.txt index 15097b8473..6fb0a9bf5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -447,7 +447,7 @@ set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") include(HandleLLVMOptions) # Verify that we can find a Python 3 interpreter and force cmake to use it. -find_package(PythonInterp 3 REQUIRED) +find_package(Python3 REQUIRED) ###### # LLVMBuild Integration @@ -481,7 +481,7 @@ endif (LLVM_USE_OPROFILE) message(STATUS "Constructing LLVMBuild project information") execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL} + COMMAND ${Python3_EXECUTABLE} ${LLVMBUILDTOOL} --native-target Unknown --enable-targets "${LLVM_TARGETS_TO_BUILD}" --enable-optional-components "${LLVMOPTIONALCOMPONENTS}" diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 32820635e8..b3c88ca65d 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1,5 +1,6 @@ include(LLVMProcessSources) include(LLVM-Config) +find_package(Python3 REQUIRED) function(llvm_update_compile_flags name) get_property(sources TARGET ${name} PROPERTY SOURCES) @@ -107,7 +108,7 @@ function(add_llvm_symbol_exports target_name export_file) set(native_export_file "${target_name}.def") add_custom_command(OUTPUT ${native_export_file} - COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print(''.join(['EXPORTS\\n']+sys.stdin.readlines(),))" + COMMAND ${Python3_EXECUTABLE} -c "import sys;print(''.join(['EXPORTS\\n']+sys.stdin.readlines(),))" < ${export_file} > ${native_export_file} DEPENDS ${export_file} VERBATIM @@ -867,7 +868,6 @@ function(configure_lit_site_cfg input output) # SHLIBDIR points the build tree. string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} SHLIBDIR "${LLVM_SHLIB_OUTPUT_INTDIR}") - set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) # FIXME: "ENABLE_SHARED" doesn't make sense, since it is used just for # plugins. We may rename it. if(LLVM_ENABLE_PLUGINS) @@ -902,7 +902,7 @@ function(add_lit_target target comment) list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR}) endif () if (LLVM_MAIN_SRC_DIR) - set (LIT_COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) + set (LIT_COMMAND ${Python3_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) else() find_program(LIT_COMMAND llvm-lit) endif () diff --git a/cmake/modules/HCT.cmake b/cmake/modules/HCT.cmake index 10dc803698..b7bc8a3fef 100644 --- a/cmake/modules/HCT.cmake +++ b/cmake/modules/HCT.cmake @@ -101,7 +101,7 @@ function(add_hlsl_hctgen mode) endif() add_custom_command(OUTPUT ${temp_output} - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${hctgen} ${force_lf} ${mode} --output ${temp_output} ${input_flag} ${format_cmd} diff --git a/tools/clang/lib/Basic/CMakeLists.txt b/tools/clang/lib/Basic/CMakeLists.txt index f06b10eeb7..2b2af8af26 100644 --- a/tools/clang/lib/Basic/CMakeLists.txt +++ b/tools/clang/lib/Basic/CMakeLists.txt @@ -102,7 +102,7 @@ if ( HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO ) set(GET_GIT_COMMIT_SCRIPT ${PROJECT_SOURCE_DIR}/utils/GetCommitInfo.py) add_custom_command( OUTPUT ${GIT_COMMIT_INFO_FILE} - COMMAND ${PYTHON_EXECUTABLE} ${GET_GIT_COMMIT_SCRIPT} + COMMAND ${Python3_EXECUTABLE} ${GET_GIT_COMMIT_SCRIPT} ${PROJECT_SOURCE_DIR} ${GIT_COMMIT_INFO_FILE} DEPENDS ${GET_GIT_COMMIT_SCRIPT} GIT_COMMIT_INFO_ALWAYS_REBUILD COMMENT "Collect Git commit info for versioning" diff --git a/utils/version/CMakeLists.txt b/utils/version/CMakeLists.txt index 6cc875ca70..a5519bba8d 100644 --- a/utils/version/CMakeLists.txt +++ b/utils/version/CMakeLists.txt @@ -6,7 +6,7 @@ macro(generate_version_include name input_file output_file gen_flags) add_custom_command( OUTPUT ${gen_file} COMMAND echo Generating version - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen_version.py ${gen_flags} > ${gen_file} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen_version.py ${gen_flags} > ${gen_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_version.py ) else ()