mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
update cmake, update readme, in response to the dynamic linking fiasco
This commit is contained in:
parent
c026a9f6d2
commit
986aa42d3e
3 changed files with 199 additions and 186 deletions
|
|
@ -58,10 +58,16 @@ brew install cmake llvm
|
||||||
brew outdated llvm || brew upgrade llvm
|
brew outdated llvm || brew upgrade llvm
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm) -DZIG_PREFER_CLANG_CPP_DYLIB=ON
|
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You will now run into this issue:
|
||||||
|
[homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo](https://github.com/ziglang/zig/issues/4799)
|
||||||
|
|
||||||
|
Please help upstream LLVM and Homebrew solve this issue, there is nothing Zig
|
||||||
|
can do about it. See that issue for a workaround you can do in the meantime.
|
||||||
|
|
||||||
##### Windows
|
##### Windows
|
||||||
|
|
||||||
See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
|
See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||||
find_library(CLANG_CPP_DYLIB
|
find_library(CLANG_LIBRARIES
|
||||||
NAMES
|
NAMES
|
||||||
clang-cpp-10.0
|
clang-cpp-10.0
|
||||||
clang-cpp100
|
clang-cpp100
|
||||||
|
|
@ -31,9 +31,7 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CLANG_CPP_DYLIB)
|
if(NOT CLANG_LIBRARIES)
|
||||||
set(CLANG_LIBRARIES ${CLANG_CPP_DYLIB})
|
|
||||||
else()
|
|
||||||
macro(FIND_AND_ADD_CLANG_LIB _libname_)
|
macro(FIND_AND_ADD_CLANG_LIB _libname_)
|
||||||
string(TOUPPER ${_libname_} _prettylibname_)
|
string(TOUPPER ${_libname_} _prettylibname_)
|
||||||
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
|
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,30 @@
|
||||||
# LLVM_LIBRARIES
|
# LLVM_LIBRARIES
|
||||||
# LLVM_LIBDIRS
|
# LLVM_LIBDIRS
|
||||||
|
|
||||||
if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
|
find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h
|
||||||
|
PATHS
|
||||||
|
/usr/lib/llvm/10/include
|
||||||
|
/usr/lib/llvm-10/include
|
||||||
|
/usr/lib/llvm-10.0/include
|
||||||
|
/usr/local/llvm10/include
|
||||||
|
/usr/local/llvm100/include
|
||||||
|
/mingw64/include
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||||
|
find_library(LLVM_LIBRARIES
|
||||||
|
NAMES
|
||||||
|
LLVM-10.0
|
||||||
|
LLVM-10
|
||||||
|
LLVM-100
|
||||||
|
LLVM
|
||||||
|
PATHS
|
||||||
|
${LLVM_LIBDIRS}
|
||||||
|
/usr/lib/llvm-10/lib
|
||||||
|
/usr/local/llvm10/lib
|
||||||
|
/usr/local/llvm100/lib
|
||||||
|
)
|
||||||
|
elseif("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
|
||||||
find_program(LLVM_CONFIG_EXE
|
find_program(LLVM_CONFIG_EXE
|
||||||
NAMES llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config10 llvm-config
|
NAMES llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config10 llvm-config
|
||||||
PATHS
|
PATHS
|
||||||
|
|
@ -106,11 +129,6 @@ if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
|
||||||
string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
|
string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${LLVM_CONFIG_EXE} --includedir
|
|
||||||
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
|
|
||||||
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
||||||
|
|
||||||
if(NOT LLVM_LIBRARIES)
|
if(NOT LLVM_LIBRARIES)
|
||||||
|
|
@ -124,15 +142,6 @@ else()
|
||||||
# to support more complicated setups. We also assume the experimental target
|
# to support more complicated setups. We also assume the experimental target
|
||||||
# AVR is enabled.
|
# AVR is enabled.
|
||||||
|
|
||||||
find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h
|
|
||||||
PATHS
|
|
||||||
/usr/lib/llvm/10/include
|
|
||||||
/usr/lib/llvm-10/include
|
|
||||||
/usr/lib/llvm-10.0/include
|
|
||||||
/usr/local/llvm100/include
|
|
||||||
/usr/local/llvm10/include
|
|
||||||
/mingw64/include)
|
|
||||||
|
|
||||||
macro(FIND_AND_ADD_LLVM_LIB _libname_)
|
macro(FIND_AND_ADD_LLVM_LIB _libname_)
|
||||||
string(TOUPPER ${_libname_} _prettylibname_)
|
string(TOUPPER ${_libname_} _prettylibname_)
|
||||||
find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_}
|
find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue