cmake: Update to LLVM 19.

Co-authored-by: David Rubin <daviru007@icloud.com>
This commit is contained in:
Alex Rønne Petersen 2024-08-23 01:09:12 +02:00 committed by Andrew Kelley
parent 8b82a0e0fc
commit dd095e506a
4 changed files with 31 additions and 30 deletions

View File

@ -137,9 +137,9 @@ else()
set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig") set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
endif() endif()
find_package(llvm 18) find_package(llvm 19)
find_package(clang 18) find_package(clang 19)
find_package(lld 18) find_package(lld 19)
if(ZIG_STATIC_ZLIB) if(ZIG_STATIC_ZLIB)
if (MSVC) if (MSVC)

View File

@ -17,10 +17,10 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
if(${LLVM_LINK_MODE} STREQUAL "shared") if(${LLVM_LINK_MODE} STREQUAL "shared")
find_library(CLANG_LIBRARIES find_library(CLANG_LIBRARIES
NAMES NAMES
libclang-cpp.so.18 libclang-cpp.so.19
libclang-cpp.so.18.1 libclang-cpp.so.19.1
clang-cpp-18.0 clang-cpp-19.0
clang-cpp180 clang-cpp190
clang-cpp clang-cpp
NAMES_PER_DIR NAMES_PER_DIR
HINTS "${LLVM_LIBDIRS}" HINTS "${LLVM_LIBDIRS}"
@ -68,6 +68,7 @@ else()
FIND_AND_ADD_CLANG_LIB(clangToolingCore) FIND_AND_ADD_CLANG_LIB(clangToolingCore)
FIND_AND_ADD_CLANG_LIB(clangExtractAPI) FIND_AND_ADD_CLANG_LIB(clangExtractAPI)
FIND_AND_ADD_CLANG_LIB(clangSupport) FIND_AND_ADD_CLANG_LIB(clangSupport)
FIND_AND_ADD_CLANG_LIB(clangInstallAPI)
endif() endif()
if (MSVC) if (MSVC)

View File

@ -9,21 +9,21 @@
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
HINTS ${LLVM_INCLUDE_DIRS} HINTS ${LLVM_INCLUDE_DIRS}
PATHS PATHS
/usr/lib/llvm-18/include /usr/lib/llvm-19/include
/usr/local/llvm180/include /usr/local/llvm190/include
/usr/local/llvm18/include /usr/local/llvm19/include
/usr/local/opt/llvm@18/include /usr/local/opt/llvm@19/include
/opt/homebrew/opt/llvm@18/include /opt/homebrew/opt/llvm@19/include
/mingw64/include) /mingw64/include)
find_library(LLD_LIBRARY NAMES lld-18.0 lld180 lld NAMES_PER_DIR find_library(LLD_LIBRARY NAMES lld-19.0 lld190 lld NAMES_PER_DIR
HINTS ${LLVM_LIBDIRS} HINTS ${LLVM_LIBDIRS}
PATHS PATHS
/usr/lib/llvm-18/lib /usr/lib/llvm-19/lib
/usr/local/llvm180/lib /usr/local/llvm190/lib
/usr/local/llvm18/lib /usr/local/llvm19/lib
/usr/local/opt/llvm@18/lib /usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@18/lib /opt/homebrew/opt/llvm@19/lib
) )
if(EXISTS ${LLD_LIBRARY}) if(EXISTS ${LLD_LIBRARY})
set(LLD_LIBRARIES ${LLD_LIBRARY}) set(LLD_LIBRARIES ${LLD_LIBRARY})
@ -34,11 +34,11 @@ else()
HINTS ${LLVM_LIBDIRS} HINTS ${LLVM_LIBDIRS}
PATHS PATHS
${LLD_LIBDIRS} ${LLD_LIBDIRS}
/usr/lib/llvm-18/lib /usr/lib/llvm-19/lib
/usr/local/llvm180/lib /usr/local/llvm190/lib
/usr/local/llvm18/lib /usr/local/llvm19/lib
/usr/local/opt/llvm@18/lib /usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@18/lib /opt/homebrew/opt/llvm@19/lib
/mingw64/lib /mingw64/lib
/c/msys64/mingw64/lib /c/msys64/mingw64/lib
c:/msys64/mingw64/lib) c:/msys64/mingw64/lib)

View File

@ -17,12 +17,12 @@ if(ZIG_USE_LLVM_CONFIG)
# terminate when the right LLVM version is not found. # terminate when the right LLVM version is not found.
unset(LLVM_CONFIG_EXE CACHE) unset(LLVM_CONFIG_EXE CACHE)
find_program(LLVM_CONFIG_EXE find_program(LLVM_CONFIG_EXE
NAMES llvm-config-18 llvm-config-18.0 llvm-config180 llvm-config18 llvm-config NAMES_PER_DIR NAMES llvm-config-19 llvm-config-19.0 llvm-config190 llvm-config19 llvm-config NAMES_PER_DIR
PATHS PATHS
"/mingw64/bin" "/mingw64/bin"
"/c/msys64/mingw64/bin" "/c/msys64/mingw64/bin"
"c:/msys64/mingw64/bin" "c:/msys64/mingw64/bin"
"C:/Libraries/llvm-18.0.0/bin") "C:/Libraries/llvm-19.0.0/bin")
if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND") if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "") if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
@ -40,9 +40,9 @@ if(ZIG_USE_LLVM_CONFIG)
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY) get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 18 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 19 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 19) if("${LLVM_CONFIG_VERSION}" VERSION_LESS 19 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 20 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 20)
# Save the error message, in case this is the last llvm-config we find # Save the error message, in case this is the last llvm-config we find
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 18.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}") list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 19.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
# Ignore this directory and try the search again # Ignore this directory and try the search again
list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}") list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
@ -66,9 +66,9 @@ if(ZIG_USE_LLVM_CONFIG)
if (LLVM_CONFIG_ERROR) if (LLVM_CONFIG_ERROR)
# Save the error message, in case this is the last llvm-config we find # Save the error message, in case this is the last llvm-config we find
if (ZIG_SHARED_LLVM) if (ZIG_SHARED_LLVM)
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 18.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library") list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
else() else()
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 18.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library") list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
endif() endif()
# Ignore this directory and try the search again # Ignore this directory and try the search again