Skip to content

Commit f32541e

Browse files
committed
[cmake] Change all of the *_{BUILD,INCLUDE}_* options into their own section. NFC.
In order to reduce build times for LTO, I am going to "harmonize" these options with LLVM. This is just a cleanup commit. When I say "harmonize" I mean that currently, we haphazardly use either SWIFT_BUILD_* or SWIFT_INCLUDE_* to not include/build targets. This I believe is due to cargo-culting from LLVM without understanding the *REAL MEANING* of these variables. The *REAL MEANING* of these sorts of variables are: 1. SWIFT_BUILD_${X} means that cmake should generate build targets for ${X} and build those tools by default. 2. SWIFT_INCLUDE_${X} means that cmake should only generate build targets for ${X}.
1 parent 818b566 commit f32541e

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

CMakeLists.txt

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,14 @@ endif()
88
list(APPEND CMAKE_MODULE_PATH
99
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1010

11-
include(SwiftBuildType)
12-
1311
#
14-
# User-configurable options.
12+
# User-configurable options that control the inclusion and default build
13+
# behavior for components which may not strictly be necessary (tools, examples,
14+
# and tests).
1515
#
16-
# Instead of invoking CMake directly and configuring these options manually,
17-
# consider using build-script instead.
16+
# This is primarily to support building smaller or faster project files.
1817
#
1918

20-
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
21-
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
22-
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
23-
STRINGS "Debug" "RelWithDebInfo" "Release" "MinSizeRel")
24-
25-
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" swift_optimized)
26-
if(swift_optimized)
27-
set(SWIFT_STDLIB_ASSERTIONS_default FALSE)
28-
else()
29-
set(SWIFT_STDLIB_ASSERTIONS_default TRUE)
30-
endif()
31-
option(SWIFT_STDLIB_ASSERTIONS
32-
"Enable internal checks for the Swift standard library (useful for debugging the library itself, does not affect checks required for safety)"
33-
"${SWIFT_STDLIB_ASSERTIONS_default}")
34-
3519
option(SWIFT_BUILD_TOOLS
3620
"Build the Swift compiler and other tools"
3721
TRUE)
@@ -84,6 +68,28 @@ option(SWIFT_INCLUDE_DOCS
8468
"Create targets for building docs."
8569
TRUE)
8670

71+
#
72+
# Miscellaneous User-configurable options.
73+
#
74+
# TODO: Please categorize these!
75+
#
76+
77+
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
78+
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
79+
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
80+
STRINGS "Debug" "RelWithDebInfo" "Release" "MinSizeRel")
81+
82+
include(SwiftBuildType)
83+
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" swift_optimized)
84+
if(swift_optimized)
85+
set(SWIFT_STDLIB_ASSERTIONS_default FALSE)
86+
else()
87+
set(SWIFT_STDLIB_ASSERTIONS_default TRUE)
88+
endif()
89+
option(SWIFT_STDLIB_ASSERTIONS
90+
"Enable internal checks for the Swift standard library (useful for debugging the library itself, does not affect checks required for safety)"
91+
"${SWIFT_STDLIB_ASSERTIONS_default}")
92+
8793
option(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
8894
"Use the host compiler and not the internal clang to build the swift runtime"
8995
FALSE)

0 commit comments

Comments
 (0)