Skip to content

Commit f7f1f02

Browse files
committed
stdlib: install the image registrar in the static runtime
We were previously only installing the image registration helper in the shared runtime location. When building with a static runtime, we would look in the wrong location. Ensure that we install to both locations to repair the static builds.
1 parent 8d37c79 commit f7f1f02

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

stdlib/public/runtime/CMakeLists.txt

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ add_swift_library(swiftImageRegistrationObjectELF
193193
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
194194
TARGET_SDKS ${ELFISH_SDKS}
195195
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.
196198
add_swift_library(swiftImageRegistrationObjectCOFF
197199
OBJECT_LIBRARY IS_STDLIB IS_STDLIB_CORE
198200
SwiftRT-COFF.cpp
@@ -212,20 +214,34 @@ foreach(sdk ${SWIFT_CONFIGURED_SDKS})
212214
# to a version which supports it.
213215
# set(swiftrtObject "$<TARGET_OBJECTS:swiftImageRegistrationObject${SWIFT_SDK_${sdk}_OBJECT_FORMAT}-${arch_suffix}>")
214216
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}")
216219

217220
add_custom_command_target(swiftImageRegistration-${arch_suffix}
218221
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}"
220225
OUTPUT
221-
"${swiftrtPath}"
226+
"${shared_runtime_registrar}"
227+
"${static_runtime_registrar}"
222228
DEPENDS
223229
"${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+
229245
add_dependencies(swift-stdlib-${arch_suffix} ${swiftImageRegistration-${arch_suffix}})
230246

231247
add_custom_target(swiftImageRegistration-${arch_suffix}

0 commit comments

Comments
 (0)