Skip to content

Commit 5312266

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 cc1d258 commit 5312266

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,8 +1656,11 @@ function(add_swift_library name)
16561656
# Add dependencies on the (not-yet-created) custom lipo target.
16571657
foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
16581658
if (NOT "${DEP}" STREQUAL "icucore")
1659-
add_dependencies(${VARIANT_NAME}
1660-
"${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
1659+
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "MACHO")
1660+
add_dependencies(${VARIANT_NAME} "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
1661+
else()
1662+
add_dependencies(${VARIANT_NAME} "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1663+
endif()
16611664
endif()
16621665
endforeach()
16631666

@@ -1781,13 +1784,22 @@ function(add_swift_library name)
17811784
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
17821785
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
17831786
TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
1787+
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "MACHO")
1788+
set(shared_lipo_target ${lipo_target})
1789+
set(static_lipo_target ${lipo_target_static})
1790+
else()
1791+
set(shared_lipo_target ${lipo_target}-${arch})
1792+
if(TARGET "${lipo_target_static}")
1793+
set(static_lipo_target ${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}-static)
1794+
endif()
1795+
endif()
17841796
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
1785-
${lipo_target}
1786-
${lipo_target_static})
1797+
${shared_lipo_target}
1798+
${static_lipo_target})
17871799
if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
17881800
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
1789-
${lipo_target}
1790-
${lipo_target_static})
1801+
${shared_lipo_target}
1802+
${static_lipo_target})
17911803
endif()
17921804
endif()
17931805
endforeach()

0 commit comments

Comments
 (0)