From f73d3da8c8532a55c26b3efa565b47f45cf6c4eb Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Thu, 9 Mar 2023 15:47:23 -0500 Subject: [PATCH 1/2] Un-hardcode cmake install dirs --- CMakeLists.txt | 8 ++++---- Sources/BlocksRuntime/CMakeLists.txt | 4 ++-- Sources/UUID/CMakeLists.txt | 6 +++--- cmake/modules/SwiftSupport.cmake | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bb1099078..c94d25d011 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,19 +99,19 @@ if(NOT BUILD_SHARED_LIBS) endif() install(TARGETS CoreFoundation CFXMLInterface - DESTINATION lib/swift_static/$) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$) if(BUILD_NETWORKING) set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS CFURLSessionInterface) install(TARGETS CFURLSessionInterface - DESTINATION lib/swift_static/$) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$) endif() endif() -set(swift_lib_dir "lib/swift") +set(swift_lib_dir "${CMAKE_INSTALL_LIBDIR}/swift") if(NOT BUILD_SHARED_LIBS) - set(swift_lib_dir "lib/swift_static") + set(swift_lib_dir "${CMAKE_INSTALL_LIBDIR}/swift_static") endif() # TODO(compnerd) install as a Framework as that is how swift actually is built diff --git a/Sources/BlocksRuntime/CMakeLists.txt b/Sources/BlocksRuntime/CMakeLists.txt index 057302dd43..7f49119ff6 100644 --- a/Sources/BlocksRuntime/CMakeLists.txt +++ b/Sources/BlocksRuntime/CMakeLists.txt @@ -11,5 +11,5 @@ set_target_properties(BlocksRuntime PROPERTIES add_library(BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime) install(TARGETS BlocksRuntime - ARCHIVE DESTINATION lib/swift$<$>:_static>/$ - LIBRARY DESTINATION lib/swift$<$>:_static>/$) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/$ + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/$) diff --git a/Sources/UUID/CMakeLists.txt b/Sources/UUID/CMakeLists.txt index bdbe1beafe..b53f602106 100644 --- a/Sources/UUID/CMakeLists.txt +++ b/Sources/UUID/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT BUILD_SHARED_LIBS) # TODO(drexin): should be installed in architecture specific folder, once # the layout is fixed for non-Darwin platforms install(TARGETS uuid - ARCHIVE DESTINATION lib/swift_static/$ - LIBRARY DESTINATION lib/swift_static/$ - RUNTIME DESTINATION bin) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$ + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$ + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake index 517df86e65..bcf30dc5c5 100644 --- a/cmake/modules/SwiftSupport.cmake +++ b/cmake/modules/SwiftSupport.cmake @@ -68,9 +68,9 @@ function(_install_target module) endif() install(TARGETS ${module} - ARCHIVE DESTINATION lib/${swift}/${swift_os} - LIBRARY DESTINATION lib/${swift}/${swift_os} - RUNTIME DESTINATION bin) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(type STREQUAL EXECUTABLE) return() endif() @@ -83,15 +83,15 @@ function(_install_target module) if(CMAKE_SYSTEM_NAME STREQUAL Darwin) install(FILES $/${module_name}.swiftdoc - DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${module_name}.swiftmodule RENAME ${swift_arch}.swiftdoc) install(FILES $/${module_name}.swiftmodule - DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${module_name}.swiftmodule RENAME ${swift_arch}.swiftmodule) else() install(FILES $/${module_name}.swiftdoc $/${module_name}.swiftmodule - DESTINATION lib/${swift}/${swift_os}/${swift_arch}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${swift_arch}) endif() endfunction() From 2f4d8810d6384ff2dec5fce4b4da742f1580cbcc Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Wed, 15 Mar 2023 13:58:20 -0400 Subject: [PATCH 2/2] Scoping down to bin > BINDIR only --- CMakeLists.txt | 8 ++++---- Sources/BlocksRuntime/CMakeLists.txt | 4 ++-- Sources/UUID/CMakeLists.txt | 4 ++-- cmake/modules/SwiftSupport.cmake | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c94d25d011..2bb1099078 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,19 +99,19 @@ if(NOT BUILD_SHARED_LIBS) endif() install(TARGETS CoreFoundation CFXMLInterface - DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$) + DESTINATION lib/swift_static/$) if(BUILD_NETWORKING) set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS CFURLSessionInterface) install(TARGETS CFURLSessionInterface - DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$) + DESTINATION lib/swift_static/$) endif() endif() -set(swift_lib_dir "${CMAKE_INSTALL_LIBDIR}/swift") +set(swift_lib_dir "lib/swift") if(NOT BUILD_SHARED_LIBS) - set(swift_lib_dir "${CMAKE_INSTALL_LIBDIR}/swift_static") + set(swift_lib_dir "lib/swift_static") endif() # TODO(compnerd) install as a Framework as that is how swift actually is built diff --git a/Sources/BlocksRuntime/CMakeLists.txt b/Sources/BlocksRuntime/CMakeLists.txt index 7f49119ff6..057302dd43 100644 --- a/Sources/BlocksRuntime/CMakeLists.txt +++ b/Sources/BlocksRuntime/CMakeLists.txt @@ -11,5 +11,5 @@ set_target_properties(BlocksRuntime PROPERTIES add_library(BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime) install(TARGETS BlocksRuntime - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/$ - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/$) + ARCHIVE DESTINATION lib/swift$<$>:_static>/$ + LIBRARY DESTINATION lib/swift$<$>:_static>/$) diff --git a/Sources/UUID/CMakeLists.txt b/Sources/UUID/CMakeLists.txt index b53f602106..fea52c7396 100644 --- a/Sources/UUID/CMakeLists.txt +++ b/Sources/UUID/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT BUILD_SHARED_LIBS) # TODO(drexin): should be installed in architecture specific folder, once # the layout is fixed for non-Darwin platforms install(TARGETS uuid - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$ - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift_static/$ + ARCHIVE DESTINATION lib/swift_static/$ + LIBRARY DESTINATION lib/swift_static/$ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake index bcf30dc5c5..ffb24527eb 100644 --- a/cmake/modules/SwiftSupport.cmake +++ b/cmake/modules/SwiftSupport.cmake @@ -68,8 +68,8 @@ function(_install_target module) endif() install(TARGETS ${module} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os} + ARCHIVE DESTINATION lib/${swift}/${swift_os} + LIBRARY DESTINATION lib/${swift}/${swift_os} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(type STREQUAL EXECUTABLE) return() @@ -83,15 +83,15 @@ function(_install_target module) if(CMAKE_SYSTEM_NAME STREQUAL Darwin) install(FILES $/${module_name}.swiftdoc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${module_name}.swiftmodule + DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule RENAME ${swift_arch}.swiftdoc) install(FILES $/${module_name}.swiftmodule - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${module_name}.swiftmodule + DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule RENAME ${swift_arch}.swiftmodule) else() install(FILES $/${module_name}.swiftdoc $/${module_name}.swiftmodule - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${swift}/${swift_os}/${swift_arch}) + DESTINATION lib/${swift}/${swift_os}/${swift_arch}) endif() endfunction()