forked from OSchip/llvm-project
[runtimes] Use standalone build only for compiler-rt
compiler-rt needs to use standalone build because of the assumptions made by its build, but other runtimes can use non-standalone build. Differential Revision: https://reviews.llvm.org/D97575
This commit is contained in:
parent
ab280cbaa3
commit
6e3946c9f5
|
@ -1,8 +1,12 @@
|
|||
# TODO(phosek): We should use the runtimes build instead configured with
|
||||
# LLVM_ENABLE_RUNTIMES=libcxxabi;libcxx to avoid duplication of logic.
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
project(custom-libcxx C CXX)
|
||||
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
# Build static libcxxabi.
|
||||
set(LIBCXXABI_STANDALONE_BUILD 1)
|
||||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
|
||||
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "")
|
||||
|
@ -11,7 +15,6 @@ set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "")
|
|||
add_subdirectory(${COMPILER_RT_LIBCXXABI_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxxabi)
|
||||
|
||||
# Build static libcxx without exceptions.
|
||||
set(LIBCXX_STANDALONE_BUILD 1)
|
||||
set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
|
|
|
@ -82,10 +82,6 @@ include(CheckCCompilerFlag)
|
|||
# these flags.
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdinc++ -nostdlib++")
|
||||
|
||||
if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR AND "libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -isystem ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Avoid checking whether the compiler is working.
|
||||
|
@ -94,10 +90,8 @@ set(LLVM_COMPILER_CHECKED ON)
|
|||
# Handle common options used by all runtimes.
|
||||
include(AddLLVM)
|
||||
include(HandleLLVMOptions)
|
||||
include(FindPythonInterp)
|
||||
|
||||
# Remove the -nostdlib++ option we've added earlier.
|
||||
string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
# Use libtool instead of ar if you are both on an Apple host, and targeting Apple.
|
||||
if(CMAKE_HOST_APPLE AND APPLE)
|
||||
|
@ -114,12 +108,11 @@ foreach(entry ${runtimes})
|
|||
string(REPLACE "-" "_" canon_name ${projName})
|
||||
string(TOUPPER ${canon_name} canon_name)
|
||||
|
||||
# The subdirectories need to treat this as standalone builds. D57992 tried
|
||||
# to get rid of this, but the runtimes treat *_STANDALONE_BUILD=OFF as if
|
||||
# llvm & clang are configured in the same CMake, and setup dependencies
|
||||
# against their targets. OpenMP has fixed the issue so we don't set the
|
||||
# variable.
|
||||
if (NOT ${canon_name} STREQUAL "OPENMP")
|
||||
# TODO: compiler-rt has to use standalone build for now. We tried to remove
|
||||
# this in D57992 but this broke the build because compiler-rt assumes that
|
||||
# LLVM and Clang are configured in the same build to set up dependencies. We
|
||||
# should clean up the compiler-rt build and remove this eventually.
|
||||
if ("${canon_name}" STREQUAL "COMPILER_RT")
|
||||
set(${canon_name}_STANDALONE_BUILD ON)
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue