@@ -78,6 +78,7 @@ endif(LLVM_ENABLE_ASSERTIONS)
78
78
79
79
# Acknowledge that the following sources are known.
80
80
set (LLVM_OPTIONAL_SOURCES
81
+ StaticBinaryELF.cpp
81
82
SwiftRT-COFF.cpp
82
83
SwiftRT-ELF.cpp
83
84
${swift_runtime_sources}
@@ -102,35 +103,43 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
102
103
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
103
104
INSTALL_IN_COMPONENT stdlib)
104
105
105
- foreach (arch IN LISTS SWIFT_SDK_${sdk} _ARCHITECTURES)
106
- set (FragileSupportLibrary swiftImageInspectionShared-${SWIFT_SDK_${sdk} _LIB_SUBDIR}-${arch} )
107
- set (LibraryLocation ${SWIFTSTATICLIB_DIR} /${lowercase_sdk} /${arch} )
108
- add_custom_command_target(swift_image_inspection_${arch} _static
109
- COMMAND
110
- "${CMAKE_COMMAND} " -E copy $<TARGET_FILE:${FragileSupportLibrary} > ${LibraryLocation}
111
- OUTPUT
112
- "${LibraryLocation} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX} "
113
- DEPENDS
114
- ${FragileSupportLibrary} )
115
- add_dependencies (stdlib ${FragileSupportLibrary} )
116
- swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibrary} >
117
- DESTINATION "lib/swift_static/${lowercase_sdk} /${arch} "
118
- COMPONENT stdlib)
119
- endforeach ()
106
+ add_swift_target_library(swiftImageInspectionStatic TARGET_LIBRARY STATIC
107
+ StaticBinaryELF.cpp ImageInspectionELF.cpp
108
+ C_COMPILE_FLAGS ${swift_runtime_library_compile_flags} -DELF_STATIC_LIB
109
+ LINK_FLAGS ${swift_runtime_linker_flags}
110
+ INSTALL_IN_COMPONENT stdlib)
120
111
121
- set (FragileSupportLibraryPrimary swiftImageInspectionShared-${SWIFT_SDK_${sdk} _LIB_SUBDIR}-${SWIFT_PRIMARY_VARIANT_ARCH} )
122
- set (LibraryLocationPrimary ${SWIFTSTATICLIB_DIR} /${lowercase_sdk} )
123
- add_custom_command_target(swift_image_inspection_static_primary_arch
124
- COMMAND
125
- "${CMAKE_COMMAND} " -E copy $<TARGET_FILE:${FragileSupportLibraryPrimary} > ${LibraryLocationPrimary}
126
- OUTPUT
127
- "${LibraryLocationPrimary} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX} "
128
- DEPENDS
129
- ${FragileSupportLibraryPrimary} )
130
- add_dependencies (stdlib ${FragileSupportLibraryPrimary} )
131
- swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibraryPrimary} >
132
- DESTINATION "lib/swift_static/${lowercase_sdk} "
133
- COMPONENT stdlib)
112
+ foreach (linktype Shared Static )
113
+ foreach (arch IN LISTS SWIFT_SDK_${sdk} _ARCHITECTURES)
114
+ set (FragileSupportLibrary swiftImageInspection${linktype} -${SWIFT_SDK_${sdk} _LIB_SUBDIR}-${arch} )
115
+ set (LibraryLocation ${SWIFTSTATICLIB_DIR} /${lowercase_sdk} /${arch} )
116
+ add_custom_command_target(swift_image_inspection_${linktype} _${arch} _static
117
+ COMMAND
118
+ "${CMAKE_COMMAND} " -E copy $<TARGET_FILE:${FragileSupportLibrary} > ${LibraryLocation}
119
+ OUTPUT
120
+ "${LibraryLocation} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspection${linktype}${CMAKE_STATIC_LIBRARY_SUFFIX} "
121
+ DEPENDS
122
+ ${FragileSupportLibrary} )
123
+ add_dependencies (stdlib ${FragileSupportLibrary} )
124
+ swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibrary} >
125
+ DESTINATION "lib/swift_static/${lowercase_sdk} /${arch} "
126
+ COMPONENT stdlib)
127
+ endforeach ()
128
+
129
+ set (FragileSupportLibraryPrimary swiftImageInspection${linktype} -${SWIFT_SDK_${sdk} _LIB_SUBDIR}-${SWIFT_PRIMARY_VARIANT_ARCH} )
130
+ set (LibraryLocationPrimary ${SWIFTSTATICLIB_DIR} /${lowercase_sdk} )
131
+ add_custom_command_target(swift_image_inspection_${linktype} _primary_arch
132
+ COMMAND
133
+ "${CMAKE_COMMAND} " -E copy $<TARGET_FILE:${FragileSupportLibraryPrimary} > ${LibraryLocationPrimary}
134
+ OUTPUT
135
+ "${LibraryLocationPrimary} /${CMAKE_STATIC_LIBRARY_PREFIX} swiftImageInspection${linktype}${CMAKE_STATIC_LIBRARY_SUFFIX} "
136
+ DEPENDS
137
+ ${FragileSupportLibraryPrimary} )
138
+ add_dependencies (stdlib ${FragileSupportLibraryPrimary} )
139
+ swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibraryPrimary} >
140
+ DESTINATION "lib/swift_static/${lowercase_sdk} "
141
+ COMPONENT stdlib)
142
+ endforeach ()
134
143
135
144
# Generate the static-executable-args.lnk file used for ELF systems (eg linux)
136
145
set (linkfile "${lowercase_sdk} /static-executable-args.lnk" )
@@ -149,10 +158,12 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
149
158
DESTINATION "lib/swift_static/${lowercase_sdk} "
150
159
COMPONENT stdlib)
151
160
add_custom_target (static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list} )
152
- foreach (arch IN LISTS SWIFT_SDK_LINUX_ARCHITECTURES)
153
- add_dependencies (static_binary_magic ${swift_image_inspection_${arch} _static})
161
+ foreach (linktype Shared Static )
162
+ foreach (arch IN LISTS SWIFT_SDK_LINUX_ARCHITECTURES)
163
+ add_dependencies (static_binary_magic ${swift_image_inspection_${linktype} _${arch} _static})
164
+ endforeach ()
165
+ add_dependencies (static_binary_magic ${swift_image_inspection_${linktype} _primary_arch})
154
166
endforeach ()
155
- add_dependencies (static_binary_magic ${swift_image_inspection_static_primary_arch} )
156
167
add_dependencies (stdlib static_binary_magic)
157
168
158
169
add_swift_target_library(swiftImageInspectionSharedObject OBJECT_LIBRARY
0 commit comments