forked from OSchip/llvm-project
[CMake] Find python before searching for python modules
In the top-level llvm `CMakeLists.txt`, we need to call `find_package(Python3)` *before* including `config-ix.cmake`, otherwise the latter will not be able to successfully search for python modules using `find_python_module()`. Also set `LLVM_MINIMUM_PYTHON_VERSION` before calling `find_package(Python3)`, moving it to `CMakeLists.txt` from `HandleLLVMOptions.cmake`. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D131191
This commit is contained in:
parent
809b416641
commit
45c056b1fb
|
@ -762,6 +762,19 @@ set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_defa
|
|||
set(LLVM_PROFDATA_FILE "" CACHE FILEPATH
|
||||
"Profiling data file to use when compiling in order to improve runtime performance.")
|
||||
|
||||
if(LLVM_INCLUDE_TESTS)
|
||||
# Lit test suite requires at least python 3.6
|
||||
set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
|
||||
else()
|
||||
# FIXME: it is unknown if this is the actual minimum bound
|
||||
set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
|
||||
endif()
|
||||
|
||||
# Find python before including config-ix, since it needs to be able to search
|
||||
# for python modules.
|
||||
find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
|
||||
COMPONENTS Interpreter)
|
||||
|
||||
# All options referred to from HandleLLVMOptions have to be specified
|
||||
# BEFORE this include, otherwise options will not be correctly set on
|
||||
# first cmake run
|
||||
|
@ -808,9 +821,6 @@ endif()
|
|||
|
||||
include(HandleLLVMOptions)
|
||||
|
||||
find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
|
||||
COMPONENTS Interpreter)
|
||||
|
||||
######
|
||||
|
||||
# Configure all of the various header file fragments LLVM uses which depend on
|
||||
|
|
|
@ -1253,11 +1253,3 @@ if(LLVM_USE_RELATIVE_PATHS_IN_FILES)
|
|||
append_if(SUPPORTS_FFILE_PREFIX_MAP "-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
|
||||
endif()
|
||||
|
||||
if(LLVM_INCLUDE_TESTS)
|
||||
# Lit test suite requires at least python 3.6
|
||||
set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
|
||||
else()
|
||||
# FIXME: it is unknown if this is the actual minimum bound
|
||||
set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue