Commit 3882ce4f4b

Andrew Kelley <andrew@ziglang.org>
2023-08-11 02:08:59
update cmake files to LLVM 17
1 parent ee4ced9
cmake/Findclang.cmake
@@ -17,9 +17,9 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
 if(${LLVM_LINK_MODE} STREQUAL "shared")
   find_library(CLANG_LIBRARIES
     NAMES
-      libclang-cpp.so.16
-      clang-cpp-16.0
-      clang-cpp160
+      libclang-cpp.so.17
+      clang-cpp-17.0
+      clang-cpp170
       clang-cpp
     NAMES_PER_DIR
     HINTS "${LLVM_LIBDIRS}"
cmake/Findlld.cmake
@@ -9,21 +9,21 @@
 find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
     HINTS ${LLVM_INCLUDE_DIRS}
     PATHS
-        /usr/lib/llvm-16/include
-        /usr/local/llvm160/include
-        /usr/local/llvm16/include
-        /usr/local/opt/llvm@16/include
-        /opt/homebrew/opt/llvm@16/include
+        /usr/lib/llvm-17/include
+        /usr/local/llvm170/include
+        /usr/local/llvm17/include
+        /usr/local/opt/llvm@17/include
+        /opt/homebrew/opt/llvm@17/include
         /mingw64/include)
 
-find_library(LLD_LIBRARY NAMES lld-16.0 lld160 lld NAMES_PER_DIR
+find_library(LLD_LIBRARY NAMES lld-17.0 lld170 lld NAMES_PER_DIR
     HINTS ${LLVM_LIBDIRS}
     PATHS
-        /usr/lib/llvm-16/lib
-        /usr/local/llvm160/lib
-        /usr/local/llvm16/lib
-        /usr/local/opt/llvm@16/lib
-        /opt/homebrew/opt/llvm@16/lib
+        /usr/lib/llvm-17/lib
+        /usr/local/llvm170/lib
+        /usr/local/llvm17/lib
+        /usr/local/opt/llvm@17/lib
+        /opt/homebrew/opt/llvm@17/lib
 )
 if(EXISTS ${LLD_LIBRARY})
     set(LLD_LIBRARIES ${LLD_LIBRARY})
@@ -34,11 +34,11 @@ else()
             HINTS ${LLVM_LIBDIRS}
             PATHS
                 ${LLD_LIBDIRS}
-                /usr/lib/llvm-16/lib
-                /usr/local/llvm160/lib
-                /usr/local/llvm16/lib
-                /usr/local/opt/llvm@16/lib
-                /opt/homebrew/opt/llvm@16/lib
+                /usr/lib/llvm-17/lib
+                /usr/local/llvm170/lib
+                /usr/local/llvm17/lib
+                /usr/local/opt/llvm@17/lib
+                /opt/homebrew/opt/llvm@17/lib
                 /mingw64/lib
                 /c/msys64/mingw64/lib
                 c:/msys64/mingw64/lib)
cmake/Findllvm.cmake
@@ -14,12 +14,12 @@ if(ZIG_USE_LLVM_CONFIG)
   while(1)
     unset(LLVM_CONFIG_EXE CACHE)
     find_program(LLVM_CONFIG_EXE
-        NAMES llvm-config-16 llvm-config-16.0 llvm-config160 llvm-config16 llvm-config NAMES_PER_DIR
+        NAMES llvm-config-17 llvm-config-17.0 llvm-config170 llvm-config17 llvm-config NAMES_PER_DIR
         PATHS
             "/mingw64/bin"
             "/c/msys64/mingw64/bin"
             "c:/msys64/mingw64/bin"
-            "C:/Libraries/llvm-16.0.0/bin")
+            "C:/Libraries/llvm-17.0.0/bin")
 
     if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
       if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
@@ -37,9 +37,9 @@ if(ZIG_USE_LLVM_CONFIG)
       OUTPUT_STRIP_TRAILING_WHITESPACE)
 
     get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
-    if("${LLVM_CONFIG_VERSION}" VERSION_LESS 16 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 17 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 17)
+    if("${LLVM_CONFIG_VERSION}" VERSION_LESS 17 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 18 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 18)
       # Save the error message, in case this is the last llvm-config we find
-      list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 16.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+      list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 17.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
 
       # Ignore this directory and try the search again
       list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
@@ -63,9 +63,9 @@ if(ZIG_USE_LLVM_CONFIG)
       if (LLVM_CONFIG_ERROR) 
         # Save the error message, in case this is the last llvm-config we find
         if (ZIG_SHARED_LLVM)
-          list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 16.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
+          list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 17.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
         else()
-          list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 16.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
+          list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 17.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
         endif()
 
         # Ignore this directory and try the search again
CMakeLists.txt
@@ -131,9 +131,9 @@ else()
     set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
 endif()
 
-find_package(llvm 16)
-find_package(clang 16)
-find_package(lld 16)
+find_package(llvm 17)
+find_package(clang 17)
+find_package(lld 17)
 
 if(ZIG_STATIC_ZLIB)
     if (MSVC)