From 03ff187676c405d5b6b4e50ccaf347f7d6f48ffd Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 10 Jul 2018 13:00:17 +0000 Subject: [CMake] Add compiler-rt header files to the list of sources for targets when building with an IDE so that header files show up in the UI. This massively improves the development workflow in IDEs. To implement this a new function `compiler_rt_process_sources(...)` has been added that adds header files to the list of sources when the generator is an IDE. For non-IDE generators (e.g. Ninja/Makefile) no changes are made to the list of source files. The function can be passed a list of headers via the `ADDITIONAL_HEADERS` argument. For each runtime library a list of explicit header files has been added and passed via `ADDITIONAL_HEADERS`. For `tsan` and `sanitizer_common` a list of headers was already present but it was stale and has been updated to reflect the current state of the source tree. The original version of this patch used file globbing (`*.{h,inc,def}`) to find the headers but the approach was changed due to this being a CMake anti-pattern (if the list of headers changes CMake won't automatically re-generate if globbing is used). The LLVM repo contains a similar function named `llvm_process_sources()` but we don't use it here for several reasons: * It depends on the `LLVM_ENABLE_OPTION` cache variable which is not set in standalone compiler-rt builds. * We would have to `include(LLVMProcessSources)` which I'd like to avoid because it would include a bunch of stuff we don't need. Differential Revision: https://reviews.llvm.org/D48422 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336663 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/scudo/CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/scudo/CMakeLists.txt') diff --git a/lib/scudo/CMakeLists.txt b/lib/scudo/CMakeLists.txt index ce0e5cce1..0646c3dd4 100644 --- a/lib/scudo/CMakeLists.txt +++ b/lib/scudo/CMakeLists.txt @@ -50,6 +50,21 @@ set(SCUDO_SOURCES set(SCUDO_CXX_SOURCES scudo_new_delete.cpp) +set(SCUDO_HEADERS + scudo_allocator.h + scudo_allocator_combined.h + scudo_allocator_secondary.h + scudo_crc32.h + scudo_errors.h + scudo_flags.h + scudo_flags.inc + scudo_interface_internal.h + scudo_platform.h + scudo_tsd.h + scudo_tsd_exclusive.inc + scudo_tsd_shared.inc + scudo_utils.h) + # Enable the SSE 4.2 instruction set for scudo_crc32.cpp, if available. if (COMPILER_RT_HAS_MSSE4_2_FLAG) set_source_files_properties(scudo_crc32.cpp PROPERTIES COMPILE_FLAGS -msse4.2) @@ -66,6 +81,7 @@ if(COMPILER_RT_HAS_SCUDO) STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) @@ -73,6 +89,7 @@ if(COMPILER_RT_HAS_SCUDO) STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_CXX_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) @@ -80,6 +97,7 @@ if(COMPILER_RT_HAS_SCUDO) STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} OBJECT_LIBS ${SCUDO_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) @@ -87,6 +105,7 @@ if(COMPILER_RT_HAS_SCUDO) STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_CXX_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} OBJECT_LIBS RTUbsan_cxx CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) @@ -95,6 +114,7 @@ if(COMPILER_RT_HAS_SCUDO) SHARED ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS} @@ -105,6 +125,7 @@ if(COMPILER_RT_HAS_SCUDO) SHARED ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES} + ADDITIONAL_HEADERS ${SCUDO_HEADERS} OBJECT_LIBS ${SCUDO_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS} -- cgit v1.2.1