mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
build: make sure LLVM is exactly correct
* check the version to be the correct major version * ensure that it has all the default targets enabled
This commit is contained in:
parent
2b2bf53a49
commit
7843c96df8
@ -15,14 +15,50 @@ find_program(LLVM_CONFIG_EXE
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-7.0.0/bin")
|
||||
|
||||
if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
|
||||
message(FATAL_ERROR "unable to find llvm-config")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --version
|
||||
OUTPUT_VARIABLE LLVM_CONFIG_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(LLVM_CONFIG_VERSION VERSION_LESS 7)
|
||||
message(FATAL_ERROR "expected LLVM version >=7 but found ${LLVM_CONFIG_VERSION}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 7)
|
||||
message(FATAL_ERROR "expected LLVM 7.x but found ${LLVM_CONFIG_VERSION}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 8)
|
||||
message(FATAL_ERROR "expected LLVM 7.x but found ${LLVM_CONFIG_VERSION}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 8)
|
||||
message(FATAL_ERROR "expected LLVM 7.x but found ${LLVM_CONFIG_VERSION}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --targets-built
|
||||
OUTPUT_VARIABLE LLVM_TARGETS_BUILT_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_TARGETS_BUILT "${LLVM_TARGETS_BUILT_SPACES}")
|
||||
function(NEED_TARGET TARGET_NAME)
|
||||
list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index)
|
||||
if (${_index} EQUAL -1)
|
||||
message(FATAL_ERROR "LLVM is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
|
||||
endif()
|
||||
endfunction(NEED_TARGET)
|
||||
NEED_TARGET("AArch64")
|
||||
NEED_TARGET("AMDGPU")
|
||||
NEED_TARGET("ARM")
|
||||
NEED_TARGET("BPF")
|
||||
NEED_TARGET("Hexagon")
|
||||
NEED_TARGET("Lanai")
|
||||
NEED_TARGET("Mips")
|
||||
NEED_TARGET("MSP430")
|
||||
NEED_TARGET("NVPTX")
|
||||
NEED_TARGET("PowerPC")
|
||||
NEED_TARGET("Sparc")
|
||||
NEED_TARGET("SystemZ")
|
||||
NEED_TARGET("X86")
|
||||
NEED_TARGET("XCore")
|
||||
|
||||
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug") OR ZIG_STATIC)
|
||||
execute_process(
|
||||
|
Loading…
Reference in New Issue
Block a user