Skip to content

Commit 526e77c

Browse files
authored
Migrate options from stdlib/CMakeLists.txt into dedicated file (#40640)
Focus on options that are not defined in `StandaloneOverlay.cmake` and which defaults are not computed. Addresses rdar://86723819
1 parent 68eb340 commit 526e77c

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

stdlib/CMakeLists.txt

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ endif()
8888

8989
# TODO: migrate this section to StdlibOptions.cmake to reduce duplication
9090

91-
set(SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS "" CACHE STRING
92-
"Extra flags to pass when compiling swift stdlib files")
93-
94-
set(SWIFT_STDLIB_EXTRA_C_COMPILE_FLAGS "" CACHE STRING
95-
"Extra flags to pass when compiling C/C++ stdlib files")
96-
9791
option(SWIFT_STDLIB_STABLE_ABI
9892
"Should stdlib be built with stable ABI (library evolution, resilience)."
9993
"${SWIFT_STDLIB_STABLE_ABI_default}")
@@ -102,77 +96,26 @@ option(SWIFT_ENABLE_MODULE_INTERFACES
10296
"Generate .swiftinterface files alongside .swiftmodule files"
10397
"${SWIFT_STDLIB_STABLE_ABI}")
10498

105-
option(SWIFT_STDLIB_HAS_DLADDR
106-
"Build stdlib assuming the runtime environment runtime environment provides dladdr API."
107-
TRUE)
108-
10999
option(SWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING
110100
"Build stdlib assuming the runtime environment provides the backtrace(3) API."
111101
"${SWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING_default}")
112102

113-
option(SWIFT_RUNTIME_STATIC_IMAGE_INSPECTION
114-
"Build stdlib assuming the runtime environment runtime environment only supports a single runtime image with Swift code."
115-
FALSE)
116-
117-
option(SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
118-
"Build stdlib assuming the Darwin build of stdlib can use extended libmalloc APIs"
119-
TRUE)
120-
121103
option(SWIFT_STDLIB_HAS_ASL
122104
"Build stdlib assuming we can use the asl_log API."
123105
"${SWIFT_STDLIB_HAS_ASL_default}")
124106

125-
option(SWIFT_STDLIB_HAS_STDIN
126-
"Build stdlib assuming the platform supports stdin and getline API."
127-
TRUE)
128-
129-
option(SWIFT_STDLIB_HAS_ENVIRON
130-
"Build stdlib assuming the platform supports environment variables."
131-
TRUE)
132-
133107
option(SWIFT_STDLIB_HAS_LOCALE
134108
"Build stdlib assuming the platform has locale support."
135109
"${SWIFT_STDLIB_HAS_LOCALE_default}")
136110

137-
option(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
138-
"Build the standard libraries assuming that they will be used in an environment with only a single thread."
139-
FALSE)
140-
141-
option(SWIFT_STDLIB_OS_VERSIONING
142-
"Build stdlib with availability based on OS versions (Darwin only)."
143-
TRUE)
144-
145-
option(SWIFT_STDLIB_PASSTHROUGH_METADATA_ALLOCATOR
146-
"Build stdlib without a custom implementation of MetadataAllocator, relying on malloc+free instead."
147-
FALSE)
148-
149-
option(SWIFT_STDLIB_HAS_COMMANDLINE
150-
"Build stdlib with the CommandLine enum and support for argv/argc."
151-
TRUE)
152-
153111
option(SWIFT_BUILD_TEST_SUPPORT_MODULES
154112
"Whether to build StdlibUnittest and other test support modules. Defaults to On when SWIFT_BUILD_SDK_OVERLAY is On, or when SWIFT_INCLUDE_TESTS is On."
155113
"${SWIFT_BUILD_TEST_SUPPORT_MODULES_default}")
156114

157-
option(SWIFT_FREESTANDING_FLAVOR
158-
"When building the FREESTANDING stdlib, which build style to use (options: apple, linux)")
159-
160115
option(SWIFT_STDLIB_ENABLE_PRESPECIALIZATION
161116
"Should stdlib be built with generic metadata prespecialization enabled. Defaults to On on Darwin and on Linux."
162117
"${SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default}")
163118

164-
option(SWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK
165-
"Should stdlib be built with -experimental-hermetic-seal-at-link"
166-
FALSE)
167-
168-
set(SWIFT_STDLIB_ENABLE_LTO OFF CACHE STRING "Build Swift stdlib with LTO. One
169-
must specify the form of LTO by setting this to one of: 'full', 'thin'. This
170-
option only affects the standard library and runtime, not tools.")
171-
172-
option(SWIFT_ENABLE_REFLECTION
173-
"Build stdlib with support for runtime reflection and mirrors."
174-
TRUE)
175-
176119
if(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
177120
set(SWIFT_CONCURRENCY_GLOBAL_EXECUTOR_default "singlethreaded")
178121
else()

stdlib/cmake/modules/StdlibOptions.cmake

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,60 @@ option(SWIFT_STDLIB_HAS_TYPE_PRINTING
1515
option(SWIFT_STDLIB_BUILD_PRIVATE
1616
"Build private part of the Standard Library."
1717
TRUE)
18+
19+
option(SWIFT_STDLIB_HAS_DLADDR
20+
"Build stdlib assuming the runtime environment runtime environment provides dladdr API."
21+
TRUE)
22+
23+
option(SWIFT_RUNTIME_STATIC_IMAGE_INSPECTION
24+
"Build stdlib assuming the runtime environment runtime environment only supports a single runtime image with Swift code."
25+
FALSE)
26+
27+
option(SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
28+
"Build stdlib assuming the Darwin build of stdlib can use extended libmalloc APIs"
29+
TRUE)
30+
31+
set(SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS "" CACHE STRING
32+
"Extra flags to pass when compiling swift stdlib files")
33+
34+
set(SWIFT_STDLIB_EXTRA_C_COMPILE_FLAGS "" CACHE STRING
35+
"Extra flags to pass when compiling C/C++ stdlib files")
36+
37+
option(SWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK
38+
"Should stdlib be built with -experimental-hermetic-seal-at-link"
39+
FALSE)
40+
41+
option(SWIFT_STDLIB_PASSTHROUGH_METADATA_ALLOCATOR
42+
"Build stdlib without a custom implementation of MetadataAllocator, relying on malloc+free instead."
43+
FALSE)
44+
45+
option(SWIFT_STDLIB_HAS_COMMANDLINE
46+
"Build stdlib with the CommandLine enum and support for argv/argc."
47+
TRUE)
48+
49+
option(SWIFT_ENABLE_REFLECTION
50+
"Build stdlib with support for runtime reflection and mirrors."
51+
TRUE)
52+
53+
option(SWIFT_STDLIB_HAS_STDIN
54+
"Build stdlib assuming the platform supports stdin and getline API."
55+
TRUE)
56+
57+
option(SWIFT_STDLIB_HAS_ENVIRON
58+
"Build stdlib assuming the platform supports environment variables."
59+
TRUE)
60+
61+
option(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
62+
"Build the standard libraries assuming that they will be used in an environment with only a single thread."
63+
FALSE)
64+
65+
option(SWIFT_STDLIB_OS_VERSIONING
66+
"Build stdlib with availability based on OS versions (Darwin only)."
67+
TRUE)
68+
69+
option(SWIFT_FREESTANDING_FLAVOR
70+
"When building the FREESTANDING stdlib, which build style to use (options: apple, linux)")
71+
72+
set(SWIFT_STDLIB_ENABLE_LTO OFF CACHE STRING "Build Swift stdlib with LTO. One
73+
must specify the form of LTO by setting this to one of: 'full', 'thin'. This
74+
option only affects the standard library and runtime, not tools.")

0 commit comments

Comments
 (0)