This commit is contained in:
Timothee Cour 2020-04-17 17:22:00 -07:00 committed by Andrew Kelley
parent 70cc1751ca
commit 9a7f05378f
2 changed files with 10 additions and 1 deletions

View File

@ -53,6 +53,7 @@ set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not com
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries") set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation") set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")
set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp") set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
set(ZIG_WORKAROUND_4799 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/4799")
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available") set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE) if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
@ -88,6 +89,11 @@ if(APPLE AND ZIG_STATIC)
list(APPEND LLVM_LIBRARIES "${ZLIB}") list(APPEND LLVM_LIBRARIES "${ZLIB}")
endif() endif()
if(APPLE AND ZIG_WORKAROUND_4799)
# eg: ${CMAKE_PREFIX_PATH} could be /usr/local/opt/llvm/
list(APPEND LLVM_LIBRARIES "-Wl,${CMAKE_PREFIX_PATH}/lib/libPolly.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyPPCG.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyISL.a")
endif()
set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zig_cpp") set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zig_cpp")
# Handle multi-config builds and place each into a common lib. The VS generator # Handle multi-config builds and place each into a common lib. The VS generator
@ -397,6 +403,7 @@ add_library(zig_cpp STATIC ${ZIG_CPP_SOURCES})
set_target_properties(zig_cpp PROPERTIES set_target_properties(zig_cpp PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS} COMPILE_FLAGS ${EXE_CFLAGS}
) )
target_link_libraries(zig_cpp LINK_PUBLIC target_link_libraries(zig_cpp LINK_PUBLIC
${CLANG_LIBRARIES} ${CLANG_LIBRARIES}
${LLD_LIBRARIES} ${LLD_LIBRARIES}

View File

@ -61,11 +61,13 @@ brew outdated llvm || brew upgrade llvm
mkdir build mkdir build
cd build cd build
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm) cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)
make install make -j install
``` ```
You will now run into this issue: 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) [homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo](https://github.com/ziglang/zig/issues/4799)
or this https://github.com/ziglang/zig/issues/5055, in which case try `-DZIG_WORKAROUND_4799=ON`
Please help upstream LLVM and Homebrew solve this issue, there is nothing Zig 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. can do about it. See that issue for a workaround you can do in the meantime.