Skip to content

Commit 802dac7

Browse files
committed
Non-Darwin SDKs product results in per-arch directories.
Depends on swiftlang/swift#19432 Unix (other than Darwin) and Windows do not support fat binaries. However, the build system was placing the build results in the platform/OS folder, instead of the per-architecture folder. Having two architectures side by side was impossible. After applying the above patch in the Swift compiler, non-Darwin platforms will look into the per-architecture folders, so the sibling projects need to leave the products in the right place.
1 parent c4a7149 commit 802dac7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ if(ENABLE_SWIFT)
7373
${SWIFT_RUNTIME_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}swiftSwiftOnoneSupport${CMAKE_SHARED_LIBRARY_SUFFIX})
7474

7575
set(INSTALL_TARGET_DIR "${INSTALL_LIBDIR}/swift/${SWIFT_OS}" CACHE PATH "Path where the libraries will be installed")
76+
set(INSTALL_RSRC_DIR "${INSTALL_LIBDIR}/swift/${SWIFT_OS}/${SWIFT_HOST_ARCH}" CACHE PATH "Path where the compiler resources will be installed")
7677
set(INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR}/swift/dispatch" CACHE PATH "Path where the headers will be installed for libdispatch")
7778
set(INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR}/swift/Block" CACHE PATH "Path where the headers will be installed for the blocks runtime")
7879
set(INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR}/swift/os" CACHE PATH "Path where the os/ headers will be installed")
@@ -179,6 +180,14 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
179180
BlocksRuntime
180181
DESTINATION
181182
${INSTALL_TARGET_DIR})
183+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
184+
# Install also in the architecture subdir for platforms that do not support
185+
# fat libraries
186+
install(TARGETS
187+
BlocksRuntime
188+
DESTINATION
189+
"${INSTALL_TARGET_DIR}/${SWIFT_HOST_ARCH}")
190+
endif()
182191
endif()
183192

184193
check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)

src/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,18 @@ install(TARGETS
231231
dispatch
232232
DESTINATION
233233
"${INSTALL_TARGET_DIR}")
234+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
235+
# Install also in the architecture subdir for platforms that do not support
236+
# fat libraries
237+
install(TARGETS
238+
dispatch
239+
DESTINATION
240+
"${INSTALL_TARGET_DIR}/${SWIFT_HOST_ARCH}")
241+
endif()
234242
if(ENABLE_SWIFT)
235243
install(FILES
236244
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
237245
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc
238246
DESTINATION
239-
"${INSTALL_TARGET_DIR}/${SWIFT_HOST_ARCH}")
247+
"${INSTALL_RSRC_DIR}")
240248
endif()
241-

0 commit comments

Comments
 (0)