Skip to content

Commit bb78eef

Browse files
committedJun 27, 2018
[CMake] Tidy up the organisation of compiler-rt when configured as a standalone
build with an IDE (e.g. Xcode) as the generator. Previously the global `USE_FOLDERS` property wasn't set in standalone builds leading to existing settings of FOLDER not being respected. In addition to this there were several targets that appeared at the top level that were not interesting and clustered up the view. These have been changed to be displayed in "Compiler-RT Misc". Now when an Xcode project is generated from a standalone compiler-rt build the project navigator is much less cluttered. The interesting libraries should appear in "Compiler-RT Libraries" in the IDE. Differential Revision: https://reviews.llvm.org/D48378 llvm-svn: 335728
1 parent d3e583a commit bb78eef

7 files changed

+26
-2
lines changed
 

‎compiler-rt/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cmake_minimum_required(VERSION 3.4.3)
99
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
1010
project(CompilerRT C CXX ASM)
1111
set(COMPILER_RT_STANDALONE_BUILD TRUE)
12+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1213
endif()
1314

1415
# Add path for custom compiler-rt modules.
@@ -63,6 +64,11 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOLEAN
6364

6465
if (COMPILER_RT_STANDALONE_BUILD)
6566
load_llvm_config()
67+
if (TARGET intrinsics_gen)
68+
# Loading the llvm config causes this target to be imported so place it
69+
# under the appropriate folder in an IDE.
70+
set_target_properties(intrinsics_gen PROPERTIES FOLDER "Compiler-RT Misc")
71+
endif()
6672

6773
# Find Python interpreter.
6874
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)

‎compiler-rt/cmake/Modules/AddCompilerRT.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ function(add_compiler_rt_runtime name type)
204204
# If the parent targets aren't created we should create them
205205
if(NOT TARGET ${LIB_PARENT_TARGET})
206206
add_custom_target(${LIB_PARENT_TARGET})
207+
set_target_properties(${LIB_PARENT_TARGET} PROPERTIES
208+
FOLDER "Compiler-RT Misc")
207209
endif()
208210
if(NOT TARGET install-${LIB_PARENT_TARGET})
209211
# The parent install target specifies the parent component to scrape up
@@ -500,6 +502,7 @@ macro(add_custom_libcxx name prefix)
500502
COMMENT "Clobbering ${name} build and stamp directories"
501503
USES_TERMINAL
502504
)
505+
set_target_properties(${name}-clear PROPERTIES FOLDER "Compiler-RT Misc")
503506

504507
add_custom_command(
505508
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp
@@ -512,6 +515,7 @@ macro(add_custom_libcxx name prefix)
512515

513516
add_custom_target(${name}-clobber
514517
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp)
518+
set_target_properties(${name}-clobber PROPERTIES FOLDER "Compiler-RT Misc")
515519

516520
set(PASSTHROUGH_VARIABLES
517521
CMAKE_C_COMPILER_TARGET

‎compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ macro(darwin_add_builtin_library name suffix)
230230

231231
list(APPEND ${LIB_OS}_${suffix}_libs ${libname})
232232
list(APPEND ${LIB_OS}_${suffix}_lipo_flags -arch ${arch} $<TARGET_FILE:${libname}>)
233+
set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Libraries")
233234
endmacro()
234235

235236
function(darwin_lipo_libs name)
@@ -251,6 +252,7 @@ function(darwin_lipo_libs name)
251252
add_dependencies(${LIB_PARENT_TARGET} ${name})
252253
install(FILES ${LIB_OUTPUT_DIR}/lib${name}.a
253254
DESTINATION ${LIB_INSTALL_DIR})
255+
set_target_properties(${name} PROPERTIES FOLDER "Compiler-RT Misc")
254256
else()
255257
message(WARNING "Not generating lipo target for ${name} because no input libraries exist.")
256258
endif()

‎compiler-rt/cmake/Modules/SanitizerUtils.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,5 @@ else()
9494
add_custom_target(SanitizerLintCheck
9595
COMMAND echo "No lint check")
9696
endif()
97-
97+
set_target_properties(SanitizerLintCheck
98+
PROPERTIES FOLDER "Compiler-RT Misc")

‎compiler-rt/cmake/base-config-ix.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ check_include_file(unwind.h HAVE_UNWIND_H)
1212
add_custom_target(compiler-rt ALL)
1313
add_custom_target(install-compiler-rt)
1414
add_custom_target(install-compiler-rt-stripped)
15-
set_target_properties(compiler-rt PROPERTIES FOLDER "Compiler-RT Misc")
15+
set_property(
16+
TARGET
17+
compiler-rt
18+
install-compiler-rt
19+
install-compiler-rt-stripped
20+
PROPERTY
21+
FOLDER "Compiler-RT Misc"
22+
)
1623

1724
# Setting these variables from an LLVM build is sufficient that compiler-rt can
1825
# construct the output paths, so it can behave as if it were in-tree here.

‎compiler-rt/lib/tsan/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ if(APPLE)
139139
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
140140
COMMENT "Checking TSan Go runtime..."
141141
VERBATIM)
142+
set_target_properties(GotsanRuntimeCheck PROPERTIES FOLDER "Compiler-RT Misc")
142143
else()
143144
foreach(arch ${TSAN_SUPPORTED_ARCH})
144145
if(arch STREQUAL "x86_64")
@@ -234,6 +235,7 @@ if(COMPILER_RT_LIBCXX_PATH AND
234235
endforeach()
235236

236237
add_custom_target(libcxx_tsan DEPENDS ${libcxx_tsan_deps})
238+
set_target_properties(libcxx_tsan PROPERTIES FOLDER "Compiler-RT Misc")
237239
endif()
238240

239241
if(COMPILER_RT_INCLUDE_TESTS)

‎compiler-rt/lib/tsan/dd/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)
1717
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS)
1818

1919
add_custom_target(dd)
20+
set_target_properties(dd PROPERTIES FOLDER "Compiler-RT Misc")
21+
2022
# Deadlock detector is currently supported on 64-bit Linux only.
2123
if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
2224
set(arch "x86_64")

0 commit comments

Comments
 (0)
Please sign in to comment.