@@ -154,8 +154,11 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
154
154
endif ()
155
155
156
156
if (SWIFT_SWIFT_PARSER)
157
- # Make sure we can find the early SwiftSyntax libraries.
158
- target_link_directories (${target} PRIVATE "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /lib/swift/host" )
157
+ # Add rpath to the host Swift libraries.
158
+ if (NOT SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
159
+ file (RELATIVE_PATH relative_hostlib_path "${path} " "${SWIFTLIB_DIR} /host" )
160
+ list (APPEND RPATH_LIST "$ORIGIN/${relative_hostlib_path} " )
161
+ endif ()
159
162
160
163
# Add rpath to the host Swift libraries.
161
164
if (NOT ${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
@@ -166,25 +169,16 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
166
169
# For the "end step" of bootstrapping configurations on Darwin, need to be
167
170
# able to fall back to the SDK directory for libswiftCore et al.
168
171
if (BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*" )
169
- if (NOT "${bootstrapping} " STREQUAL "1" )
170
- if (SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
171
- target_link_directories (${target} PRIVATE "${sdk_dir} " )
172
-
173
- # Include the abi stable system stdlib in our rpath.
174
- set (swift_runtime_rpath "/usr/lib/swift" )
175
-
176
- # Add in the toolchain directory so we can grab compatibility libraries
177
- get_filename_component (TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY )
178
- get_filename_component (TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR} /../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK} _LIB_SUBDIR}" ABSOLUTE )
179
- target_link_directories (${target} PUBLIC ${TOOLCHAIN_LIB_DIR} )
180
- else ()
181
- get_filename_component (swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY )
182
- get_filename_component (swift_dir ${swift_bin_dir} DIRECTORY )
183
- set (host_lib_dir "${swift_dir} /lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK} _LIB_SUBDIR}" )
184
- target_link_directories (${target} PUBLIC ${host_lib_dir} )
185
-
186
- list (APPEND RPATH_LIST "${host_lib_dir} " )
187
- endif ()
172
+ if (SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
173
+ target_link_directories (${target} PRIVATE "${sdk_dir} " )
174
+
175
+ # Include the abi stable system stdlib in our rpath.
176
+ set (swift_runtime_rpath "/usr/lib/swift" )
177
+
178
+ # Add in the toolchain directory so we can grab compatibility libraries
179
+ get_filename_component (TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY )
180
+ get_filename_component (TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR} /../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK} _LIB_SUBDIR}" ABSOLUTE )
181
+ target_link_directories (${target} PUBLIC ${TOOLCHAIN_LIB_DIR} )
188
182
endif ()
189
183
endif ()
190
184
endif ()
0 commit comments