Commit 308f72701a

Andrew Kelley <andrew@ziglang.org>
2022-02-03 21:38:48
update cmake files to LLVM 14
1 parent 3832b58
cmake/Findclang.cmake
@@ -9,31 +9,31 @@
 
 find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
   PATHS
-    /usr/lib/llvm/13/include
-    /usr/lib/llvm-13/include
-    /usr/lib/llvm-13.0/include
-    /usr/local/llvm130/include
-    /usr/local/llvm13/include
-    /usr/local/opt/llvm@13/include
-    /opt/homebrew/opt/llvm@13/include
+    /usr/lib/llvm/14/include
+    /usr/lib/llvm-14/include
+    /usr/lib/llvm-14.0/include
+    /usr/local/llvm140/include
+    /usr/local/llvm14/include
+    /usr/local/opt/llvm@14/include
+    /opt/homebrew/opt/llvm@14/include
     /mingw64/include
 )
 
 if(ZIG_PREFER_CLANG_CPP_DYLIB)
   find_library(CLANG_LIBRARIES
     NAMES
-      clang-cpp-13.0
-      clang-cpp130
+      clang-cpp-14.0
+      clang-cpp140
       clang-cpp
     PATHS
       ${CLANG_LIBDIRS}
-      /usr/lib/llvm/13/lib
-      /usr/lib/llvm/13/lib64
-      /usr/lib/llvm-13/lib
-      /usr/local/llvm130/lib
-      /usr/local/llvm13/lib
-      /usr/local/opt/llvm@13/lib
-      /opt/homebrew/opt/llvm@13/lib
+      /usr/lib/llvm/14/lib
+      /usr/lib/llvm/14/lib64
+      /usr/lib/llvm-14/lib
+      /usr/local/llvm140/lib
+      /usr/local/llvm14/lib
+      /usr/local/opt/llvm@14/lib
+      /opt/homebrew/opt/llvm@14/lib
   )
 endif()
 
@@ -43,13 +43,13 @@ if(NOT CLANG_LIBRARIES)
     find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
       PATHS
         ${CLANG_LIBDIRS}
-        /usr/lib/llvm/13/lib
-        /usr/lib/llvm-13/lib
-        /usr/lib/llvm-13.0/lib
-        /usr/local/llvm130/lib
-        /usr/local/llvm13/lib
-        /usr/local/opt/llvm@13/lib
-        /opt/homebrew/opt/llvm@13/lib
+        /usr/lib/llvm/14/lib
+        /usr/lib/llvm-14/lib
+        /usr/lib/llvm-14.0/lib
+        /usr/local/llvm140/lib
+        /usr/local/llvm14/lib
+        /usr/local/opt/llvm@14/lib
+        /opt/homebrew/opt/llvm@14/lib
         /mingw64/lib
         /c/msys64/mingw64/lib
         c:\\msys64\\mingw64\\lib
cmake/Findlld.cmake
@@ -8,20 +8,20 @@
 
 find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
     PATHS
-        /usr/lib/llvm-13/include
-        /usr/local/llvm130/include
-        /usr/local/llvm13/include
-        /usr/local/opt/llvm@13/include
-        /opt/homebrew/opt/llvm@13/include
+        /usr/lib/llvm-14/include
+        /usr/local/llvm140/include
+        /usr/local/llvm14/include
+        /usr/local/opt/llvm@14/include
+        /opt/homebrew/opt/llvm@14/include
         /mingw64/include)
 
-find_library(LLD_LIBRARY NAMES lld-13.0 lld130 lld
+find_library(LLD_LIBRARY NAMES lld-14.0 lld140 lld
     PATHS
-        /usr/lib/llvm-13/lib
-        /usr/local/llvm130/lib
-        /usr/local/llvm13/lib
-        /usr/local/opt/llvm@13/lib
-        /opt/homebrew/opt/llvm@13/lib
+        /usr/lib/llvm-14/lib
+        /usr/local/llvm140/lib
+        /usr/local/llvm14/lib
+        /usr/local/opt/llvm@14/lib
+        /opt/homebrew/opt/llvm@14/lib
 )
 if(EXISTS ${LLD_LIBRARY})
     set(LLD_LIBRARIES ${LLD_LIBRARY})
@@ -31,11 +31,11 @@ else()
         find_library(LLD_${_prettylibname_}_LIB NAMES ${_libname_}
             PATHS
                 ${LLD_LIBDIRS}
-                /usr/lib/llvm-13/lib
-                /usr/local/llvm130/lib
-                /usr/local/llvm13/lib
-                /usr/local/opt/llvm@13/lib
-                /opt/homebrew/opt/llvm@13/lib
+                /usr/lib/llvm-14/lib
+                /usr/local/llvm140/lib
+                /usr/local/llvm14/lib
+                /usr/local/opt/llvm@14/lib
+                /opt/homebrew/opt/llvm@14/lib
                 /mingw64/lib
                 /c/msys64/mingw64/lib
                 c:/msys64/mingw64/lib)
cmake/Findllvm.cmake
@@ -9,41 +9,41 @@
 
 find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h
   PATHS
-    /usr/lib/llvm/13/include
-    /usr/lib/llvm-13/include
-    /usr/lib/llvm-13.0/include
-    /usr/local/llvm13/include
-    /usr/local/llvm130/include
-    /usr/local/opt/llvm@13/include
-    /opt/homebrew/opt/llvm@13/include
+    /usr/lib/llvm/14/include
+    /usr/lib/llvm-14/include
+    /usr/lib/llvm-14.0/include
+    /usr/local/llvm14/include
+    /usr/local/llvm140/include
+    /usr/local/opt/llvm@14/include
+    /opt/homebrew/opt/llvm@14/include
     /mingw64/include
 )
 
 if(ZIG_PREFER_CLANG_CPP_DYLIB)
   find_library(LLVM_LIBRARIES
     NAMES
-      LLVM-13.0
-      LLVM-13
-      LLVM-130
+      LLVM-14.0
+      LLVM-14
+      LLVM-140
       LLVM
     PATHS
       ${LLVM_LIBDIRS}
-      /usr/lib/llvm/13/lib
-      /usr/lib/llvm/13/lib64
-      /usr/lib/llvm-13/lib
-      /usr/local/llvm13/lib
-      /usr/local/llvm130/lib
-      /usr/local/opt/llvm@13/lib
-      /opt/homebrew/opt/llvm@13/lib
+      /usr/lib/llvm/14/lib
+      /usr/lib/llvm/14/lib64
+      /usr/lib/llvm-14/lib
+      /usr/local/llvm14/lib
+      /usr/local/llvm140/lib
+      /usr/local/opt/llvm@14/lib
+      /opt/homebrew/opt/llvm@14/lib
   )
 
   find_program(LLVM_CONFIG_EXE
-      NAMES llvm-config-13 llvm-config-13.0 llvm-config130 llvm-config13 llvm-config
+      NAMES llvm-config-14 llvm-config-14.0 llvm-config140 llvm-config14 llvm-config
       PATHS
           "/mingw64/bin"
           "/c/msys64/mingw64/bin"
           "c:/msys64/mingw64/bin"
-          "C:/Libraries/llvm-13.0.0/bin")
+          "C:/Libraries/llvm-14.0.0/bin")
 
   if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
     message(FATAL_ERROR "unable to find llvm-config")
@@ -58,23 +58,23 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB)
     OUTPUT_VARIABLE LLVM_CONFIG_VERSION
     OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-  if("${LLVM_CONFIG_VERSION}" VERSION_LESS 13)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_LESS 14)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
-  if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 14)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 15)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
-  if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 14)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 15)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
 elseif(ZIG_USE_LLVM_CONFIG)
   find_program(LLVM_CONFIG_EXE
-      NAMES llvm-config-13 llvm-config-13.0 llvm-config130 llvm-config13 llvm-config
+      NAMES llvm-config-14 llvm-config-14.0 llvm-config140 llvm-config14 llvm-config
       PATHS
           "/mingw64/bin"
           "/c/msys64/mingw64/bin"
           "c:/msys64/mingw64/bin"
-          "C:/Libraries/llvm-13.0.0/bin")
+          "C:/Libraries/llvm-14.0.0/bin")
 
   if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
     message(FATAL_ERROR "unable to find llvm-config")
@@ -89,14 +89,14 @@ elseif(ZIG_USE_LLVM_CONFIG)
     OUTPUT_VARIABLE LLVM_CONFIG_VERSION
     OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-  if("${LLVM_CONFIG_VERSION}" VERSION_LESS 13)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_LESS 14)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
-  if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 14)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 15)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
-  if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 14)
-    message(FATAL_ERROR "expected LLVM 13.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
+  if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 15)
+    message(FATAL_ERROR "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
   endif()
 
   execute_process(
@@ -170,7 +170,7 @@ elseif(ZIG_USE_LLVM_CONFIG)
   set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
 
   if(NOT LLVM_LIBRARIES)
-    find_library(LLVM_LIBRARIES NAMES LLVM LLVM-13 LLVM-13.0)
+    find_library(LLVM_LIBRARIES NAMES LLVM LLVM-14 LLVM-14.0)
   endif()
 
   link_directories("${CMAKE_PREFIX_PATH}/lib")
@@ -184,13 +184,13 @@ else()
     find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_}
       PATHS
       ${LLVM_LIBDIRS}
-      /usr/lib/llvm/13/lib
-      /usr/lib/llvm-13/lib
-      /usr/lib/llvm-13.0/lib
-      /usr/local/llvm130/lib
-      /usr/local/llvm13/lib
-      /usr/local/opt/llvm@13/lib
-      /opt/homebrew/opt/llvm@13/lib
+      /usr/lib/llvm/14/lib
+      /usr/lib/llvm-14/lib
+      /usr/lib/llvm-14.0/lib
+      /usr/local/llvm140/lib
+      /usr/local/llvm14/lib
+      /usr/local/opt/llvm@14/lib
+      /opt/homebrew/opt/llvm@14/lib
       /mingw64/lib
       /c/msys64/mingw64/lib
       c:\\msys64\\mingw64\\lib)