@@ -346,18 +346,26 @@ def other_swift_flags_without_swift?
346
346
#
347
347
# @param [Boolean] test_bundle
348
348
#
349
- def _ld_runpath_search_paths ( requires_host_target : false , test_bundle : false )
349
+ def _ld_runpath_search_paths ( requires_host_target : false , test_bundle : false , uses_swift : false )
350
+ paths = [ ]
351
+ if uses_swift
352
+ paths << '/usr/lib/swift'
353
+ paths << '$(PLATFORM_DIR)/Developer/Library/Frameworks' if test_bundle
354
+ end
350
355
if target . platform . symbolic_name == :osx
351
- [ "'@executable_path/../Frameworks'" ,
352
- test_bundle ? "'@loader_path/../Frameworks'" : "'@loader_path/Frameworks'" ]
356
+ paths << "'@executable_path/../Frameworks'"
357
+ paths << if test_bundle
358
+ "'@loader_path/../Frameworks'"
359
+ else
360
+ "'@loader_path/Frameworks'"
361
+ end
362
+ paths << '${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}' if uses_swift
353
363
else
354
- paths = [
355
- "'@executable_path/Frameworks'" ,
356
- "'@loader_path/Frameworks'" ,
357
- ]
364
+ paths << "'@executable_path/Frameworks'"
365
+ paths << "'@loader_path/Frameworks'"
358
366
paths << "'@executable_path/../../Frameworks'" if requires_host_target
359
- paths
360
367
end
368
+ paths
361
369
end
362
370
private :_ld_runpath_search_paths
363
371
@@ -840,10 +848,15 @@ def linker_names_from_libraries(libraries)
840
848
841
849
# @return [Array<String>]
842
850
define_build_settings_method :library_search_paths_to_import , :memoized => true do
843
- vendored_library_search_paths = vendored_static_library_search_paths + vendored_dynamic_library_search_paths
844
- return vendored_library_search_paths if target . build_as_framework? || !target . should_build?
851
+ search_paths = vendored_static_library_search_paths + vendored_dynamic_library_search_paths
852
+ if target . uses_swift? || other_swift_flags_without_swift?
853
+ search_paths << '/usr/lib/swift'
854
+ search_paths << '${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}'
855
+ search_paths << '$(PLATFORM_DIR)/Developer/Library/Frameworks' if test_xcconfig?
856
+ end
857
+ return search_paths if target . build_as_framework? || !target . should_build?
845
858
846
- vendored_library_search_paths << target . configuration_build_dir ( CONFIGURATION_BUILD_DIR_VARIABLE )
859
+ search_paths << target . configuration_build_dir ( CONFIGURATION_BUILD_DIR_VARIABLE )
847
860
end
848
861
849
862
#-------------------------------------------------------------------------#
@@ -939,7 +952,8 @@ def requires_objc_linker_flag?
939
952
# @return [Array<String>]
940
953
define_build_settings_method :ld_runpath_search_paths , :build_setting => true , :memoized => true do
941
954
return if library_xcconfig?
942
- _ld_runpath_search_paths ( :test_bundle => test_xcconfig? )
955
+ _ld_runpath_search_paths ( :test_bundle => test_xcconfig? ,
956
+ :uses_swift => other_swift_flags_without_swift? || dependent_targets . any? ( &:uses_swift? ) )
943
957
end
944
958
945
959
#-------------------------------------------------------------------------#
@@ -1242,7 +1256,8 @@ def other_swift_flags_without_swift?
1242
1256
return unless pod_targets . any? ( &:build_as_dynamic? ) || any_vendored_dynamic_artifacts?
1243
1257
symbol_type = target . user_targets . map ( &:symbol_type ) . uniq . first
1244
1258
test_bundle = symbol_type == :octest_bundle || symbol_type == :unit_test_bundle || symbol_type == :ui_test_bundle
1245
- _ld_runpath_search_paths ( :requires_host_target => target . requires_host_target? , :test_bundle => test_bundle )
1259
+ _ld_runpath_search_paths ( :requires_host_target => target . requires_host_target? , :test_bundle => test_bundle ,
1260
+ :uses_swift => pod_targets . any? ( &:uses_swift? ) )
1246
1261
end
1247
1262
1248
1263
# @return [Boolean]
0 commit comments