CMake: Use find_package(Python3) (#6675)
Fixes the CMake CMP0148 warning at configure time. find_package(Python3) is supported since CMake 3.12, and DXC requires at least CMake 3.17
This commit is contained in:
Родитель
73d3ccf399
Коммит
1f8f79688e
|
@ -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}"
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 ()
|
||||
|
|
Загрузка…
Ссылка в новой задаче