@@ -103,16 +103,39 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
103
103
string (TOLOWER "${sdk} " lowercase_sdk )
104
104
105
105
# These two libraries are only used with the static swiftcore
106
- add_swift_library (swiftImageInspectionShared STATIC
106
+ add_swift_library (swiftImageInspectionShared TARGET_LIBRARY STATIC
107
107
ImageInspectionELF.cpp
108
108
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
109
- LINK_FLAGS ${swift_runtime_linker_flags} )
110
- set_target_properties (swiftImageInspectionShared PROPERTIES
111
- ARCHIVE_OUTPUT_DIRECTORY "${SWIFTSTATICLIB_DIR} /${lowercase_sdk} " )
109
+ LINK_FLAGS ${swift_runtime_linker_flags}
110
+ INSTALL_IN_COMPONENT stdlib )
111
+
112
+ foreach (arch IN LISTS SWIFT_SDK_${sdk}_ARCHITECTURES )
113
+ set (FragileSupportLibrary swiftImageInspectionShared-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch} )
114
+ set (LibraryLocation ${SWIFTSTATICLIB_DIR} /${lowercase_sdk}/${arch} )
115
+ add_custom_command_target (swift_image_inspection_${arch}_static
116
+ COMMAND
117
+ "${CMAKE_COMMAND} " -E copy $< TARGET_FILE:${FragileSupportLibrary} > ${LibraryLocation}
118
+ OUTPUT
119
+ "${LibraryLocation} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX} "
120
+ DEPENDS
121
+ ${FragileSupportLibrary} )
122
+ swift_install_in_component (stdlib
123
+ FILES $< TARGET_FILE:${FragileSupportLibrary} >
124
+ DESTINATION "lib/swift_static/${lowercase_sdk} /${arch} " )
125
+ endforeach ()
112
126
113
- swift_install_in_component (stdlib
114
- TARGETS swiftImageInspectionShared
115
- DESTINATION "lib/swift_static/${lowercase_sdk} " )
127
+ set (FragileSupportLibraryPrimary swiftImageInspectionShared-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${SWIFT_PRIMARY_VARIANT_ARCH} )
128
+ set (LibraryLocationPrimary ${SWIFTSTATICLIB_DIR} /${lowercase_sdk} )
129
+ add_custom_command_target (swift_image_inspection_static_primary_arch
130
+ COMMAND
131
+ "${CMAKE_COMMAND} " -E copy $< TARGET_FILE:${FragileSupportLibraryPrimary} > ${LibraryLocationPrimary}
132
+ OUTPUT
133
+ "${LibraryLocationPrimary} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX} "
134
+ DEPENDS
135
+ ${FragileSupportLibraryPrimary} )
136
+ swift_install_in_component (stdlib
137
+ FILES $< TARGET_FILE:${FragileSupportLibraryPrimary} >
138
+ DESTINATION "lib/swift_static/${lowercase_sdk} " )
116
139
117
140
# Generate the static-executable-args.lnk file used for ELF systems (eg linux)
118
141
set (linkfile "${lowercase_sdk} /static-executable-args.lnk" )
@@ -131,8 +154,12 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
131
154
FILES "${SWIFTSTATICLIB_DIR} /${linkfile} "
132
155
DESTINATION "lib/swift_static/${lowercase_sdk} " )
133
156
add_custom_target (static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list} )
157
+ foreach (arch IN LISTS SWIFT_SDK_LINUX_ARCHITECTURES )
158
+ add_dependencies (static_binary_magic ${swift_image_inspection_${arch}_static} )
159
+ endforeach ()
160
+ add_dependencies (static_binary_magic ${swift_image_inspection_static_primary_arch} )
134
161
135
- add_swift_library (swiftImageInspectionShared OBJECT_LIBRARY TARGET_LIBRARY
162
+ add_swift_library (swiftImageInspectionSharedObject OBJECT_LIBRARY TARGET_LIBRARY
136
163
ImageInspectionELF.cpp
137
164
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
138
165
LINK_FLAGS ${swift_runtime_linker_flags}
0 commit comments