Skip to content

Commit 784c98b

Browse files
committed
build: depend on the architecture variant on non-MachO
For the non-MachO targets, which do not have the concept of fat binaries, depend explicitly on the architecture variant. This is particularly useful for Windows which permits cross-compilation and cross-targeting of all the variants even though it does not support fat binaries. This allows us to build a single variant of the windows standard library at a time in the case that we would like to build a subset of the targets.
1 parent dcdd23f commit 784c98b

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,11 @@ function(add_swift_library name)
16361636
# Add dependencies on the (not-yet-created) custom lipo target.
16371637
foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
16381638
if (NOT "${DEP}" STREQUAL "icucore")
1639-
add_dependencies(${VARIANT_NAME}
1640-
"${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
1639+
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "MACHO")
1640+
add_dependencies(${VARIANT_NAME} "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
1641+
else()
1642+
add_dependencies(${VARIANT_NAME} "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1643+
endif()
16411644
endif()
16421645
endforeach()
16431646

@@ -1761,13 +1764,23 @@ function(add_swift_library name)
17611764
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
17621765
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
17631766
TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
1767+
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "MACHO")
1768+
set(shared_lipo_target ${lipo_target})
1769+
set(static_lipo_target ${lipo_target_static})
1770+
else()
1771+
set(shared_lipo_target ${lipo_target}-${arch})
1772+
if(TARGET "${lipo_target_static}")
1773+
set(static_lipo_target ${lipo_target_static}-${arch})
1774+
endif()
1775+
endif()
1776+
17641777
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
1765-
${lipo_target}
1766-
${lipo_target_static})
1778+
${shared_lipo_target}
1779+
${static_lipo_target})
17671780
if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
17681781
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
1769-
${lipo_target}
1770-
${lipo_target_static})
1782+
${shared_lipo_target}
1783+
${static_lipo_target})
17711784
endif()
17721785
endif()
17731786
endforeach()

0 commit comments

Comments
 (0)