From f7f1f026f442674fcbce03e3f5af8eab0d104150 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 11 Oct 2018 10:06:12 -0700 Subject: [PATCH] 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. --- stdlib/public/runtime/CMakeLists.txt | 32 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt index 41644e9793d13..6cb9fd3d14e69 100644 --- a/stdlib/public/runtime/CMakeLists.txt +++ b/stdlib/public/runtime/CMakeLists.txt @@ -193,6 +193,8 @@ add_swift_library(swiftImageRegistrationObjectELF LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS} TARGET_SDKS ${ELFISH_SDKS} INSTALL_IN_COMPONENT none) +# FIXME(compnerd) this should be compiled twice, once for static and once for +# shared. The static version should be used for building the standard library. add_swift_library(swiftImageRegistrationObjectCOFF OBJECT_LIBRARY IS_STDLIB IS_STDLIB_CORE SwiftRT-COFF.cpp @@ -212,20 +214,34 @@ foreach(sdk ${SWIFT_CONFIGURED_SDKS}) # to a version which supports it. # set(swiftrtObject "$") 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}) - set(swiftrtPath "${SWIFTLIB_DIR}/${arch_subdir}/swiftrt${CMAKE_C_OUTPUT_EXTENSION}") + set(shared_runtime_registrar "${SWIFTLIB_DIR}/${arch_subdir}/swiftrt${CMAKE_C_OUTPUT_EXTENSION}") + set(static_runtime_registrar "${SWIFTSTATICLIB_DIR}/${arch_subdir}/swiftrt${CMAKE_C_OUTPUT_EXTENSION}") add_custom_command_target(swiftImageRegistration-${arch_suffix} COMMAND - "${CMAKE_COMMAND}" -E copy "${swiftrtObject}" "${swiftrtPath}" + "${CMAKE_COMMAND}" -E copy "${swiftrtObject}" "${shared_runtime_registrar}" + COMMAND + "${CMAKE_COMMAND}" -E copy "${swiftrtObject}" "${static_runtime_registrar}" OUTPUT - "${swiftrtPath}" + "${shared_runtime_registrar}" + "${static_runtime_registrar}" DEPENDS "${swiftrtObject}") - swift_install_in_component(stdlib - FILES - "${swiftrtPath}" - DESTINATION - "lib/swift/${arch_subdir}") + if(SWIFT_BUILD_DYNAMIC_STDLIB) + swift_install_in_component(stdlib + FILES + "${shared_runtime_registrar}" + DESTINATION + "lib/swift/${arch_subdir}") + endif() + if(SWIFT_BUILD_STATIC_STDLIB) + swift_install_in_component(stdlib + FILES + "${static_runtime_registrar}" + DESTINATION + "lib/swift_static/${arch_subdir}") + endif() + add_dependencies(swift-stdlib-${arch_suffix} ${swiftImageRegistration-${arch_suffix}}) add_custom_target(swiftImageRegistration-${arch_suffix}