mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
Teach the LLVM CMake build how to explicitly use libc++abi when using
libc++. This lets me almost self-host on Linux with libc++ and libc++abi very simply. Currently, MCJIT and OrcJIT are failing due to uncaught exceptions, and the Go binding tests are failing to build due to not linking in the correct C++ standard library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
60557beded
commit
24a6fb0a17
@ -252,6 +252,7 @@ endif()
|
|||||||
option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
|
option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
|
||||||
option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
|
option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
|
||||||
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
|
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
|
||||||
|
option(LLVM_ENABLE_LIBCXXABI "Use libc++abi when using libc++." OFF)
|
||||||
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||||
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||||
|
|
||||||
|
@ -12,22 +12,28 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
|
|||||||
set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
|
set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(append_if condition value)
|
function(append value)
|
||||||
if(${condition})
|
|
||||||
foreach(variable ${ARGN})
|
foreach(variable ${ARGN})
|
||||||
set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
|
set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
|
||||||
endforeach(variable)
|
endforeach(variable)
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
if(LLVM_ENABLE_LIBCXX)
|
if(LLVM_ENABLE_LIBCXX)
|
||||||
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
||||||
check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB)
|
check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB)
|
||||||
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_CXX_FLAGS)
|
if(CXX_SUPPORTS_STDLIB)
|
||||||
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_EXE_LINKER_FLAGS)
|
append("-stdlib=libc++"
|
||||||
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_SHARED_LINKER_FLAGS)
|
CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
|
||||||
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_MODULE_LINKER_FLAGS)
|
CMAKE_MODULE_LINKER_FLAGS)
|
||||||
|
if(LLVM_ENABLE_LIBCXXABI)
|
||||||
|
append("-lc++abi"
|
||||||
|
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
|
||||||
|
CMAKE_MODULE_LINKER_FLAGS)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "Can't specify libc++ with '-stdlib='")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "Not sure how to specify libc++ for this compiler")
|
message(WARNING "Not sure how to specify libc++ for this compiler")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user