@@ -156,73 +156,106 @@ set(SWIFTLIB_SOURCES
156
156
VarArgs.swift
157
157
Zip.swift
158
158
)
159
- set (GROUP_INFO_JSON_FILE ${CMAKE_CURRENT_SOURCE_DIR} /GroupInfo.json )
160
- set (swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS} " )
161
- set (swift_core_framework_depends )
162
- set (swift_core_private_link_libraries )
163
- set (swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} " )
164
- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
165
- list (APPEND swift_core_link_flags "-all_load" )
166
- list (APPEND swift_core_framework_depends Foundation )
167
- list (APPEND swift_core_framework_depends CoreFoundation )
168
- else ()
169
- # With the GNU linker the equivalent of -all_load is to tell the linker
170
- # --whole-archive before the archive and --no-whole-archive after (without
171
- # the second, it causes errors when the system libraries are told to
172
- # include everything). The best way to get it in there, according to the
173
- # documentation, is to put the flags in the target_link_libraries setting.
174
-
175
- # TODO: However, for the moment this actually makes things explode with an
176
- # incomplete runtime. This should be turned back on when more of the porting
177
- # effort has been completed.
178
- #set(LINK_FLAGS
179
- # -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive)
180
- find_package (ICU REQUIRED COMPONENTS uc i18n )
181
- list (APPEND swift_core_private_link_libraries
182
- ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY} )
183
- endif ()
184
-
185
- if ("${CMAKE_SYSTEM_NAME} " STREQUAL "CYGWIN" )
186
- execute_process (COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT} "
187
- OUTPUT_VARIABLE ENV_SYSTEMROOT )
188
-
189
- list (APPEND swift_core_link_flags "${ENV_SYSTEMROOT} /system32/psapi.dll" )
190
- endif ()
191
159
192
- if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
193
- find_library (EXECINFO_LIBRARY execinfo )
194
- list (APPEND swift_core_private_link_libraries
195
- ${EXECINFO_LIBRARY} )
196
- endif ()
160
+ set (GROUP_INFO_JSON_FILE ${CMAKE_CURRENT_SOURCE_DIR} /GroupInfo.json )
197
161
198
162
option (SWIFT_CHECK_ESSENTIAL_STDLIB
199
163
"Check core standard library layering by linking its essential subset"
200
164
FALSE )
165
+ if (SWIFT_CHECK_ESSENTIAL_STDLIB )
166
+ add_swift_library (swift_stdlib_essential ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
167
+ ${SWIFTLIB_ESSENTIAL} )
168
+ target_link_libraries (swift_stdlib_essential ${RUNTIME_DEPENDENCY} )
169
+ endif ()
201
170
171
+ set (swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} " )
202
172
if (SWIFT_STDLIB_SIL_DEBUGGING )
203
173
list (APPEND swift_stdlib_compile_flags "-Xfrontend" "-gsil" )
204
174
endif ()
205
175
206
- if (SWIFT_CHECK_ESSENTIAL_STDLIB )
207
- add_swift_library (swift_stdlib_essential ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
208
- ${SWIFTLIB_ESSENTIAL} )
209
- target_link_libraries (swift_stdlib_essential ${RUNTIME_DEPENDENCY} )
176
+ # The copy_shim_headers target dependency is required to let the
177
+ # build system know that there's a rule to produce the shims
178
+ # directory, but is not sufficient to cause the object file to be rebuilt
179
+ # when the shim header changes. Therefore, we pass both the target
180
+ # and the generated directory as dependencies.
181
+ set (swift_core_file_depends
182
+ FILE_DEPENDS
183
+ copy_shim_headers "${SWIFTLIB_DIR} /shims"
184
+ section_magic
185
+ ${GROUP_INFO_JSON_FILE} )
186
+
187
+ add_swift_library (swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
188
+ ${SWIFTLIB_SOURCES}
189
+ ${swift_core_file_depends}
190
+ SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags}
191
+ LINK_FLAGS ${SWIFT_RUNTIME_SWIFT_LINK_FLAGS} "-all_load"
192
+ INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs
193
+ FRAMEWORK_DEPENDS Foundation CoreFoundation
194
+ TARGET_SDKS ALL_APPLE_PLATFORMS
195
+ INSTALL_IN_COMPONENT stdlib )
196
+
197
+ # The linker flags for swiftCore for Apple targets includes -all_load. With the
198
+ # GNU linker the equivalent of -all_load is to tell the linker
199
+ # --whole-archive before the archive and --no-whole-archive after (without
200
+ # the second, it causes errors when the system libraries are told to
201
+ # include everything). The best way to get it in there, according to the
202
+ # documentation, is to put the flags in the target_link_libraries setting.
203
+ # TODO: However, for the moment this actually makes things explode with an
204
+ # incomplete runtime. This should be turned back on when more of the porting
205
+ # effort has been completed.
206
+ set (swift_runtime_swift_gnu_link_flags
207
+ ${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}
208
+ # -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive
209
+ )
210
+
211
+
212
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
213
+ find_package (ICU REQUIRED COMPONENTS uc i18n )
214
+ endif ()
215
+ add_swift_library (swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
216
+ ${SWIFTLIB_SOURCES}
217
+ ${swift_core_file_depends}
218
+ SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags}
219
+ LINK_FLAGS ${swift_runtime_swift_gnu_link_flags}
220
+ PRIVATE_LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
221
+ INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs
222
+ TARGET_SDKS LINUX
223
+ INSTALL_IN_COMPONENT stdlib )
224
+
225
+ add_swift_library (swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
226
+ ${SWIFTLIB_SOURCES}
227
+ ${swift_core_file_depends}
228
+ SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags}
229
+ LINK_FLAGS ${swift_runtime_swift_gnu_link_flags}
230
+ PRIVATE_LINK_LIBRARIES ${SWIFT_ANDROID_ICU_UC} ${SWIFT_ANDROID_ICU_I18N}
231
+ INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs
232
+ TARGET_SDKS ANDROID
233
+ INSTALL_IN_COMPONENT stdlib )
234
+
235
+ if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
236
+ find_library (EXECINFO_LIBRARY execinfo )
210
237
endif ()
238
+ add_swift_library (swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
239
+ ${SWIFTLIB_SOURCES}
240
+ ${swift_core_file_depends}
241
+ SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags}
242
+ LINK_FLAGS ${swift_runtime_swift_gnu_link_flags}
243
+ PRIVATE_LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY} ${EXECINFO_LIBRARY}
244
+ INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs
245
+ TARGET_SDKS FREEBSD
246
+ INSTALL_IN_COMPONENT stdlib )
211
247
248
+ if ("${CMAKE_SYSTEM_NAME} " STREQUAL "CYGWIN" )
249
+ execute_process (COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT} "
250
+ OUTPUT_VARIABLE ENV_SYSTEMROOT )
251
+ endif ()
212
252
add_swift_library (swiftCore ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
213
253
${SWIFTLIB_SOURCES}
214
- # The copy_shim_headers target dependency is required to let the
215
- # build system know that there's a rule to produce the shims
216
- # directory, but is not sufficient to cause the object file to be rebuilt
217
- # when the shim header changes. Therefore, we pass both the target
218
- # and the generated directory as dependencies.
219
- FILE_DEPENDS
220
- copy_shim_headers "${SWIFTLIB_DIR} /shims"
221
- section_magic
222
- ${GROUP_INFO_JSON_FILE}
254
+ ${swift_core_file_depends}
223
255
SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags}
224
- LINK_FLAGS ${swift_core_link_flags}
225
- PRIVATE_LINK_LIBRARIES ${swift_core_private_link_libraries }
256
+ LINK_FLAGS ${swift_runtime_swift_gnu_link_flags} " ${ENV_SYSTEMROOT} /system32/psapi.dll"
257
+ PRIVATE_LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY }
226
258
INCORPORATE_OBJECT_LIBRARIES swiftRuntime swiftStdlibStubs
227
- FRAMEWORK_DEPENDS ${swift_core_framework_depends}
259
+ TARGET_SDKS CYGWIN
228
260
INSTALL_IN_COMPONENT stdlib )
261
+
0 commit comments