zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 23c25c5eaf959549e2f8e090a6c0eae7cfa6cb30 (tree)
parent 175d95b59165e3455bc05f0d328a7f86cedb307e
Author: FnControlOption <70830482+FnControlOption@users.noreply.github.com>
Date:   Sun, 18 Jul 2021 16:54:43 -0700

cmake: also check Homebrew install paths when looking for LLVM

- On Intel Macs, the path is /usr/local/opt/llvm@12
- On Silicon Macs, the path is /opt/homebrew/opt/llvm@12

This makes specifying CMAKE_PREFIX_PATH optional for Homebrew LLVM.

Diffstat:
Mcmake/Findclang.cmake | 6++++++
Mcmake/Findlld.cmake | 6++++++
Mcmake/Findllvm.cmake | 6++++++
3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/cmake/Findclang.cmake b/cmake/Findclang.cmake @@ -14,6 +14,8 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h /usr/lib/llvm-12.0/include /usr/local/llvm120/include /usr/local/llvm12/include + /usr/local/opt/llvm@12/include + /opt/homebrew/opt/llvm@12/include /mingw64/include ) @@ -30,6 +32,8 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB) /usr/lib/llvm-12/lib /usr/local/llvm120/lib /usr/local/llvm12/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib ) endif() @@ -44,6 +48,8 @@ if(NOT CLANG_LIBRARIES) /usr/lib/llvm-12.0/lib /usr/local/llvm120/lib /usr/local/llvm12/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib /mingw64/lib /c/msys64/mingw64/lib c:\\msys64\\mingw64\\lib diff --git a/cmake/Findlld.cmake b/cmake/Findlld.cmake @@ -11,6 +11,8 @@ find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h /usr/lib/llvm-12/include /usr/local/llvm120/include /usr/local/llvm12/include + /usr/local/opt/llvm@12/include + /opt/homebrew/opt/llvm@12/include /mingw64/include) find_library(LLD_LIBRARY NAMES lld-12.0 lld120 lld @@ -18,6 +20,8 @@ find_library(LLD_LIBRARY NAMES lld-12.0 lld120 lld /usr/lib/llvm-12/lib /usr/local/llvm120/lib /usr/local/llvm12/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib ) if(EXISTS ${LLD_LIBRARY}) set(LLD_LIBRARIES ${LLD_LIBRARY}) @@ -30,6 +34,8 @@ else() /usr/lib/llvm-12/lib /usr/local/llvm120/lib /usr/local/llvm12/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib) diff --git a/cmake/Findllvm.cmake b/cmake/Findllvm.cmake @@ -14,6 +14,8 @@ find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h /usr/lib/llvm-12.0/include /usr/local/llvm12/include /usr/local/llvm120/include + /usr/local/opt/llvm@12/include + /opt/homebrew/opt/llvm@12/include /mingw64/include ) @@ -31,6 +33,8 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB) /usr/lib/llvm-12/lib /usr/local/llvm12/lib /usr/local/llvm120/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib ) find_program(LLVM_CONFIG_EXE @@ -185,6 +189,8 @@ else() /usr/lib/llvm-12.0/lib /usr/local/llvm120/lib /usr/local/llvm12/lib + /usr/local/opt/llvm@12/lib + /opt/homebrew/opt/llvm@12/lib /mingw64/lib /c/msys64/mingw64/lib c:\\msys64\\mingw64\\lib)