From 5018e0aeb5b6477ff026a6fc74d26da8166228e7 Mon Sep 17 00:00:00 2001 From: Butta Date: Thu, 23 Feb 2023 13:57:12 +0530 Subject: [PATCH] install: place the libraries in architecture-specific directories on ELF platforms This is needed for apple/swift#63782, which changes the Unix toolchain to look for libraries in architecture-specific directories. --- src/BlocksRuntime/CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 4 ++++ src/swift/CMakeLists.txt | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/BlocksRuntime/CMakeLists.txt b/src/BlocksRuntime/CMakeLists.txt index 1bed20210..d1d3d5702 100644 --- a/src/BlocksRuntime/CMakeLists.txt +++ b/src/BlocksRuntime/CMakeLists.txt @@ -31,6 +31,10 @@ if(INSTALL_PRIVATE_HEADERS) DESTINATION ${INSTALL_BLOCK_HEADERS_DIR}) endif() set_property(GLOBAL APPEND PROPERTY DISPATCH_EXPORTS BlocksRuntime) +if(ENABLE_SWIFT AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows") + get_swift_host_arch(swift_arch) + set(INSTALL_TARGET_DIR "${INSTALL_TARGET_DIR}/${swift_arch}") +endif() install(TARGETS BlocksRuntime EXPORT dispatchExports ARCHIVE DESTINATION ${INSTALL_TARGET_DIR} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index adc989d42..ff58f729a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -163,6 +163,10 @@ if(ENABLE_SWIFT) add_subdirectory(swift) endif() +if(ENABLE_SWIFT AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows") + get_swift_host_arch(swift_arch) + set(INSTALL_TARGET_DIR "${INSTALL_TARGET_DIR}/${swift_arch}") +endif() set_property(GLOBAL APPEND PROPERTY DISPATCH_EXPORTS dispatch) install(TARGETS dispatch EXPORT dispatchExports diff --git a/src/swift/CMakeLists.txt b/src/swift/CMakeLists.txt index f721e82a3..304c47c3b 100644 --- a/src/swift/CMakeLists.txt +++ b/src/swift/CMakeLists.txt @@ -50,6 +50,9 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc DESTINATION ${INSTALL_TARGET_DIR}/${swift_arch}) set_property(GLOBAL APPEND PROPERTY DISPATCH_EXPORTS swiftDispatch) +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows") + set(INSTALL_TARGET_DIR "${INSTALL_TARGET_DIR}/${swift_arch}") +endif() install(TARGETS swiftDispatch EXPORT dispatchExports ARCHIVE DESTINATION ${INSTALL_TARGET_DIR}