Skip to content

Commit 6432e4e

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 9acbab3 commit 6432e4e

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ if(ENABLE_SWIFT)
6767
endif()
6868

6969
set(INSTALL_TARGET_DIR "${INSTALL_LIBDIR}/${swift_dir}/${swift_os}" CACHE PATH "Path where the libraries will be installed")
70+
set(INSTALL_RSRC_DIR "${INSTALL_LIBDIR}/${swift_dir}/${swift_os}/${swift_arch}" CACHE PATH "Path where the compiler resources will be installed")
7071
set(INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/dispatch" CACHE PATH "Path where the headers will be installed for libdispatch")
7172
set(INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/Block" CACHE PATH "Path where the headers will be installed for the blocks runtime")
7273
set(INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR}/${swift_dir}/os" CACHE PATH "Path where the os/ headers will be installed")
@@ -168,6 +169,14 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
168169
BlocksRuntime
169170
DESTINATION
170171
${INSTALL_TARGET_DIR})
172+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
173+
# Install also in the architecture subdir for platforms that do not support
174+
# fat libraries
175+
install(TARGETS
176+
BlocksRuntime
177+
DESTINATION
178+
"${INSTALL_TARGET_DIR}/${swift_arch}")
179+
endif()
171180
endif()
172181

173182
check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
@@ -347,4 +356,3 @@ add_subdirectory(src)
347356
if(ENABLE_TESTING)
348357
add_subdirectory(tests)
349358
endif()
350-

src/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,22 @@ add_custom_command(TARGET dispatch POST_BUILD
231231
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:dispatch> .libs
232232
COMMENT "Copying libdispatch to .libs")
233233

234-
get_swift_host_arch(SWIFT_HOST_ARCH)
235-
236234
install(TARGETS
237235
dispatch
238236
DESTINATION
239237
"${INSTALL_TARGET_DIR}")
238+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
239+
# Install also in the architecture subdir for platforms that do not support
240+
# fat libraries
241+
install(TARGETS
242+
dispatch
243+
DESTINATION
244+
"${INSTALL_RSRC_DIR}")
245+
endif()
240246
if(ENABLE_SWIFT)
241247
install(FILES
242248
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
243249
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc
244250
DESTINATION
245-
"${INSTALL_TARGET_DIR}/${SWIFT_HOST_ARCH}")
251+
"${INSTALL_RSRC_DIR}")
246252
endif()
247-

0 commit comments

Comments
 (0)