@@ -193,6 +193,8 @@ add_swift_library(swiftImageRegistrationObjectELF
193
193
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
194
194
TARGET_SDKS ${ELFISH_SDKS}
195
195
INSTALL_IN_COMPONENT none )
196
+ # FIXME(compnerd) this should be compiled twice, once for static and once for
197
+ # shared. The static version should be used for building the standard library.
196
198
add_swift_library (swiftImageRegistrationObjectCOFF
197
199
OBJECT_LIBRARY IS_STDLIB IS_STDLIB_CORE
198
200
SwiftRT-COFF.cpp
@@ -212,20 +214,34 @@ foreach(sdk ${SWIFT_CONFIGURED_SDKS})
212
214
# to a version which supports it.
213
215
# set(swiftrtObject "$<TARGET_OBJECTS:swiftImageRegistrationObject${SWIFT_SDK_${sdk}_OBJECT_FORMAT}-${arch_suffix}>")
214
216
set (swiftrtObject ${CMAKE_CURRENT_BINARY_DIR} /CMakeFiles/swiftImageRegistrationObject${SWIFT_SDK_${sdk}_OBJECT_FORMAT}-${arch_suffix}.dir/SwiftRT-${SWIFT_SDK_${sdk}_OBJECT_FORMAT}.cpp${CMAKE_C_OUTPUT_EXTENSION} )
215
- set (swiftrtPath "${SWIFTLIB_DIR} /${arch_subdir} /swiftrt${CMAKE_C_OUTPUT_EXTENSION} " )
217
+ set (shared_runtime_registrar "${SWIFTLIB_DIR} /${arch_subdir} /swiftrt${CMAKE_C_OUTPUT_EXTENSION} " )
218
+ set (static_runtime_registrar "${SWIFTSTATICLIB_DIR} /${arch_subdir} /swiftrt${CMAKE_C_OUTPUT_EXTENSION} " )
216
219
217
220
add_custom_command_target (swiftImageRegistration-${arch_suffix}
218
221
COMMAND
219
- "${CMAKE_COMMAND} " -E copy "${swiftrtObject} " "${swiftrtPath} "
222
+ "${CMAKE_COMMAND} " -E copy "${swiftrtObject} " "${shared_runtime_registrar} "
223
+ COMMAND
224
+ "${CMAKE_COMMAND} " -E copy "${swiftrtObject} " "${static_runtime_registrar} "
220
225
OUTPUT
221
- "${swiftrtPath} "
226
+ "${shared_runtime_registrar} "
227
+ "${static_runtime_registrar} "
222
228
DEPENDS
223
229
"${swiftrtObject} " )
224
- swift_install_in_component (stdlib
225
- FILES
226
- "${swiftrtPath} "
227
- DESTINATION
228
- "lib/swift/${arch_subdir} " )
230
+ if (SWIFT_BUILD_DYNAMIC_STDLIB )
231
+ swift_install_in_component (stdlib
232
+ FILES
233
+ "${shared_runtime_registrar} "
234
+ DESTINATION
235
+ "lib/swift/${arch_subdir} " )
236
+ endif ()
237
+ if (SWIFT_BUILD_STATIC_STDLIB )
238
+ swift_install_in_component (stdlib
239
+ FILES
240
+ "${static_runtime_registrar} "
241
+ DESTINATION
242
+ "lib/swift_static/${arch_subdir} " )
243
+ endif ()
244
+
229
245
add_dependencies (swift-stdlib-${arch_suffix} ${swiftImageRegistration-${arch_suffix}} )
230
246
231
247
add_custom_target (swiftImageRegistration-${arch_suffix}
0 commit comments