Skip to content

Commit 02a7936

Browse files
committed
[NFC] Write lnk file dynamically from cmake.
Instead of copying a static file from the repository, do what the cmakefile already does for static-stdlib-args.lnk and generate it dynamically. This means we can utilize the libicu flags set from the prior commit rather than requiring libicu be built as part of the Swift build just to ensure that the static link flags are correct.
1 parent 39bb1b2 commit 02a7936

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

stdlib/public/runtime/CMakeLists.txt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,23 @@ if(SWIFT_BUILD_STATIC_STDLIB AND "${sdk}" STREQUAL "LINUX")
143143

144144
# Generate the static-executable-args.lnk file used for ELF systems (eg linux)
145145
set(linkfile "${lowercase_sdk}/static-executable-args.lnk")
146-
add_custom_command_target(swift_static_binary_${sdk}_args
147-
COMMAND
148-
"${CMAKE_COMMAND}" -E copy
149-
"${SWIFT_SOURCE_DIR}/utils/static-executable-args.lnk"
150-
"${SWIFTSTATICLIB_DIR}/${linkfile}"
151-
OUTPUT
152-
"${SWIFTSTATICLIB_DIR}/${linkfile}"
153-
DEPENDS
154-
"${SWIFT_SOURCE_DIR}/utils/static-executable-args.lnk")
146+
file(WRITE "${SWIFTSTATICLIB_DIR}/${linkfile}" "
147+
-static
148+
-lswiftCore
149+
-lswiftImageInspectionShared
150+
-Xlinker
151+
--defsym=__import_pthread_self=pthread_self
152+
-Xlinker
153+
--defsym=__import_pthread_once=pthread_once
154+
-Xlinker
155+
--defsym=__import_pthread_key_create=pthread_key_create
156+
-lpthread
157+
${libicu_i18n_a}
158+
${libicu_uc_a}
159+
${libicu_data_a}
160+
-ldl
161+
-lstdc++
162+
-lm")
155163

156164
list(APPEND static_binary_lnk_file_list ${swift_static_binary_${sdk}_args})
157165
swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR}/${linkfile}"

utils/static-executable-args.lnk

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)