Skip to content

Commit a982cab

Browse files
authored
[cmake][llvm] Limit the number of Xcode schemes created by default (#101243)
CMake -GXcode would otherwise offer to create one scheme for each target, which ends up being a lot. For now, limit the default to the `check-*` LIT targets, plus `ALL_BUILD` and `install`. For targets that aren't in the default list, we now have a configuration variable to promote an extra list of targets into schemes, for example `-DLLVM_XCODE_EXTRA_TARGET_SCHEMES="TargetParserTests;SupportTests"` to add schemes for `TargetParserTests` and `SupportTests` respectively.
1 parent 79dcd93 commit a982cab

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ endmacro(add_clang_library)
147147
macro(add_clang_executable name)
148148
add_llvm_executable( ${name} ${ARGN} )
149149
set_clang_windows_version_resource_properties(${name})
150+
set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)
150151
endmacro(add_clang_executable)
151152

152153
macro(add_clang_tool name)
@@ -181,6 +182,7 @@ macro(add_clang_tool name)
181182
set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
182183
endif()
183184
endif()
185+
set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)
184186
endmacro()
185187

186188
macro(add_clang_symlink name dest)

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ function(add_lldb_tool name)
258258
endif()
259259

260260
add_lldb_executable(${name} GENERATE_INSTALL ${ARG_UNPARSED_ARGUMENTS})
261+
set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)
261262
endfunction()
262263

263264
# The test suite relies on finding LLDB.framework binary resources in the

llvm/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,3 +1423,16 @@ endif()
14231423
if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS)
14241424
add_subdirectory(utils/llvm-locstats)
14251425
endif()
1426+
1427+
if (XCODE)
1428+
# For additional targets that you would like to add schemes, specify e.g:
1429+
#
1430+
# -DLLVM_XCODE_EXTRA_TARGET_SCHEMES="TargetParserTests;SupportTests"
1431+
#
1432+
# at CMake configure time.
1433+
set(LLVM_XCODE_EXTRA_TARGET_SCHEMES "" CACHE STRING "Specifies an extra list of targets to turn into schemes")
1434+
1435+
foreach(target ${LLVM_XCODE_EXTRA_TARGET_SCHEMES})
1436+
set_target_properties(${target} PROPERTIES XCODE_GENERATE_SCHEME ON)
1437+
endforeach()
1438+
endif()

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ macro(llvm_add_tool project name)
14521452
endif()
14531453
get_subproject_title(subproject_title)
14541454
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
1455+
set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)
14551456
endmacro(llvm_add_tool project name)
14561457
14571458
macro(add_llvm_tool name)
@@ -2043,6 +2044,7 @@ function(add_lit_target target comment)
20432044

20442045
# Tests should be excluded from "Build Solution".
20452046
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
2047+
set_target_properties(${target} PROPERTIES XCODE_GENERATE_SCHEME ON)
20462048
endfunction()
20472049

20482050
# Convert a target name like check-clang to a variable name like CLANG.

0 commit comments

Comments
 (0)