@@ -102,66 +102,36 @@ set(swift_runtime_library_compile_flags ${swift_runtime_compile_flags})
102
102
list (APPEND swift_runtime_library_compile_flags -DswiftCore_EXPORTS)
103
103
list (APPEND swift_runtime_library_compile_flags -I${SWIFT_SOURCE_DIR} /stdlib/include /llvm/Support -I${SWIFT_SOURCE_DIR} /include )
104
104
105
- macro (add_image_inspection_shared sdk primary_arch inspection_file linkfile_src )
105
+ if (SWIFT_BUILD_STATIC_STDLIB )
106
106
set (static_binary_lnk_file_list)
107
- string (TOLOWER "${sdk} " lowercase_sdk)
108
-
109
- # Generate the static-executable-args.lnk file used for ELF systems (eg linux)
110
- set (linkfile "${lowercase_sdk} /static-executable-args.lnk" )
111
- add_custom_command_target(swift_static_binary_${sdk} _args
112
- COMMAND
113
- "${CMAKE_COMMAND} " -E copy
114
- "${linkfile_src} "
115
- "${SWIFTSTATICLIB_DIR} /${linkfile} "
116
- OUTPUT
117
- "${SWIFTSTATICLIB_DIR} /${linkfile} "
118
- DEPENDS
119
- "${linkfile_src} " )
120
-
121
- list (APPEND static_binary_lnk_file_list ${swift_static_binary_${sdk} _args})
122
- swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR} /${linkfile} "
123
- DESTINATION "lib/swift_static/${lowercase_sdk} "
124
- COMPONENT stdlib)
125
- endmacro ()
126
-
127
- set (is_image_inspection_required)
128
- foreach (sdk IN LISTS SWIFT_SDKS)
129
- set (image_inspection_shared_sdk)
130
- set (primary_arch)
131
- set (image_inspection_shared_file)
132
- set (linkfile_src)
133
107
134
- if ("${SWIFT_SDK_${sdk} _OBJECT_FORMAT}" STREQUAL "ELF" )
135
- list (APPEND ELFISH_SDKS ${sdk} )
136
- set (linkfile_src "${SWIFT_SOURCE_DIR} /utils/static-executable-args.lnk" )
137
- elseif ("${SWIFT_SDK_${sdk} _OBJECT_FORMAT}" STREQUAL "WASM" )
138
- set (linkfile_src "${SWIFT_SOURCE_DIR} /utils/webassembly/static-executable-args.lnk" )
139
- endif ()
140
-
141
- if (SWIFT_BUILD_STATIC_STDLIB AND "${sdk} " STREQUAL "LINUX" )
142
- set (image_inspection_shared_sdk "${sdk} " )
143
- set (image_inspection_shared_file ImageInspectionELF.cpp)
144
- elseif (SWIFT_BUILD_STATIC_STDLIB AND "${sdk} " STREQUAL "WASI" )
145
- set (image_inspection_shared_sdk "${sdk} " )
146
- set (image_inspection_shared_file ImageInspectionWasm.cpp)
147
- # Set default arch
148
- set (primary_arch "wasm32" )
149
- endif ()
150
-
151
- if ("${sdk} " STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK} " )
152
- set (primary_arch ${SWIFT_PRIMARY_VARIANT_ARCH} )
153
- endif ()
154
-
155
- if (NOT "${image_inspection_shared_sdk} " STREQUAL "" AND NOT "${primary_arch} " STREQUAL "" )
156
- set (is_image_inspection_required TRUE )
157
- add_image_inspection_shared(${image_inspection_shared_sdk} ${primary_arch} ${image_inspection_shared_file} ${linkfile_src} )
158
- endif ()
159
- endforeach ()
108
+ foreach (sdk ${SWIFT_SDKS} )
109
+ if (NOT "${sdk} " STREQUAL "LINUX" AND NOT "${sdk} " STREQUAL "WASI" )
110
+ continue ()
111
+ endif ()
160
112
161
- if (is_image_inspection_required)
162
- add_custom_target (static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list} )
163
- add_dependencies (stdlib static_binary_magic)
113
+ string (TOLOWER "${sdk} " lowercase_sdk)
114
+ set (static_binary_lnk_src "${SWIFT_SOURCE_DIR} /stdlib/public/Resources/${lowercase_sdk} /static-executable-args.lnk" )
115
+
116
+ # Generate the static-executable-args.lnk file used for ELF systems (eg linux)
117
+ set (linkfile "${lowercase_sdk} /static-executable-args.lnk" )
118
+ add_custom_command_target(swift_static_binary_${sdk} _args
119
+ COMMAND
120
+ "${CMAKE_COMMAND} " -E copy
121
+ "${static_binary_lnk_src} "
122
+ "${SWIFTSTATICLIB_DIR} /${linkfile} "
123
+ OUTPUT
124
+ "${SWIFTSTATICLIB_DIR} /${linkfile} "
125
+ DEPENDS
126
+ "${static_binary_lnk_src} " )
127
+
128
+ list (APPEND static_binary_lnk_file_list ${swift_static_binary_${sdk} _args})
129
+ swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR} /${linkfile} "
130
+ DESTINATION "lib/swift_static/${lowercase_sdk} "
131
+ COMPONENT stdlib)
132
+ endforeach ()
164
133
add_dependencies (stdlib ${static_binary_lnk_file_list} )
134
+ add_custom_target (static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list} )
165
135
endif ()
166
136
167
137
add_swift_target_library(swiftRuntime OBJECT_LIBRARY
0 commit comments