Skip to content

Commit fa999f3

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 a736ea7 commit fa999f3

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
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_RSRC_DIR})
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ if(ENABLE_SWIFT)
254254
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
255255
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc
256256
DESTINATION
257-
${INSTALL_TARGET_DIR}/${swift_arch})
257+
${INSTALL_RSRC_DIR})
258258

259259
if(BUILD_SHARED_LIBS)
260260
set(library_kind SHARED)
@@ -267,5 +267,17 @@ if(ENABLE_SWIFT)
267267
${swiftDispatch_OUTPUT_FILE}
268268
DESTINATION
269269
${INSTALL_TARGET_DIR})
270-
endif()
271270

271+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
272+
# Install also in the architecture subdir for platforms that do not support
273+
# fat libraries
274+
install(TARGETS
275+
dispatch
276+
DESTINATION
277+
${INSTALL_RSRC_DIR})
278+
install(FILES
279+
${swiftDispatch_OUTPUT_FILE}
280+
DESTINATION
281+
${INSTALL_RSRC_DIR})
282+
endif()
283+
endif()

0 commit comments

Comments
 (0)