dedb686dd2
The compiler-rt project intructs to build out of tree: https://compiler-rt.llvm.org/ Otherwise, the dependency chain declared in the include/CMakelLists.txt causes a circular dependency of source files upon themselves: make[4]: Circular include/sanitizer/allocator_interface.h <- include/sanitizer/allocator_interface.h dependency dropped. make[4]: Circular include/sanitizer/asan_interface.h <- include/sanitizer/asan_interface.h dependency dropped. make[4]: Circular include/sanitizer/common_interface_defs.h <- include/sanitizer/common_interface_defs.h dependency dropped. [--snip 19 other files--] This is because include/CMakeLists.txt unconctional declares dependencies in this manner: set(SANITIZER_HEADERS sanitizer/allocator_interface.h sanitizer/asan_interface.h sanitizer/common_interface_defs.h [...] ) set(COMPILER_RT_HEADERS ${SANITIZER_HEADERS} [...]) set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include) foreach( f ${COMPILER_RT_HEADERS} ) set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) set( dst ${output_dir}/${f} ) add_custom_command(OUTPUT ${dst} [...] ) [...] endforeach( f ) The froeach() loop creates dependency rules between the files in output_dir and CMAKE_CURRENT_SOURCE_DIR, without provision for the case they are both the same directories, thus in-source builds are not supported. With the Makefiles backend, this only triggers the above warning from make, because make arbitrarily breaks circluar dependencies, and in this case it makes it work. But when we switch to the ninja backend, this is going to be a hard error. Anyway, ninja or make, compiler-rt does not support in-source builds. Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com> [yann.morin.1998@free.fr: drastically expand commit log] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
39 lines
1.6 KiB
Makefile
39 lines
1.6 KiB
Makefile
################################################################################
|
|
#
|
|
# compiler-rt
|
|
#
|
|
################################################################################
|
|
|
|
COMPILER_RT_VERSION = $(LLVM_PROJECT_VERSION)
|
|
COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz
|
|
COMPILER_RT_SITE = $(LLVM_PROJECT_SITE)
|
|
COMPILER_RT_LICENSE = NCSA MIT
|
|
COMPILER_RT_LICENSE_FILES = LICENSE.TXT
|
|
COMPILER_RT_CPE_ID_VENDOR = llvm
|
|
COMPILER_RT_DEPENDENCIES = host-clang llvm
|
|
COMPILER_RT_SUPPORTS_IN_SOURCE_BUILD = NO
|
|
|
|
COMPILER_RT_INSTALL_STAGING = YES
|
|
COMPILER_RT_INSTALL_TARGET = NO
|
|
|
|
COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_STANDALONE_BUILD=OFF \
|
|
-DCOMPILER_RT_STANDALONE_BUILD=ON \
|
|
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \
|
|
-DLLVM_CONFIG_PATH=$(HOST_DIR)/bin/llvm-config \
|
|
-DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm
|
|
|
|
# The installation of the target runtime libraries defaults to DESTDIR, however
|
|
# host-clang resources directory needs a link so Clang can find the runtime
|
|
# libraries in the same location they would be if built as part of the Clang
|
|
# build. The "resources" directory is loosely documented and seems to be
|
|
# assumed, as compiler-rt is usually build at the same time as Clang and not
|
|
# standalone.
|
|
define COMPILER_RT_SETUP_RUNTIME_LIBS
|
|
mkdir -p $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib
|
|
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/lib/linux $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib/linux
|
|
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/share $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/share
|
|
endef
|
|
COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS
|
|
|
|
$(eval $(cmake-package))
|