Skip to content

install: place the libraries in architecture-specific directories on ELF platforms #4709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG OFF)
find_package(Threads REQUIRED)

set(SWIFT_INSTALL_SUBDIR "$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
get_swift_host_arch(swift_arch)
set(SWIFT_INSTALL_SUBDIR "${SWIFT_INSTALL_SUBDIR}/${swift_arch}")
endif()

set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS NO)
add_subdirectory(CoreFoundation EXCLUDE_FROM_ALL)
Expand Down Expand Up @@ -99,13 +105,13 @@ if(NOT BUILD_SHARED_LIBS)
endif()

install(TARGETS CoreFoundation CFXMLInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
DESTINATION lib/swift_static/${SWIFT_INSTALL_SUBDIR})

if(BUILD_NETWORKING)
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
CFURLSessionInterface)
install(TARGETS CFURLSessionInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
DESTINATION lib/swift_static/${SWIFT_INSTALL_SUBDIR})
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions Sources/BlocksRuntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ set_target_properties(BlocksRuntime PROPERTIES
add_library(BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime)

install(TARGETS BlocksRuntime
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SWIFT_INSTALL_SUBDIR}
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SWIFT_INSTALL_SUBDIR})
2 changes: 1 addition & 1 deletion Sources/Tools/plutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
endif()

set_target_properties(plutil PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
INSTALL_RPATH "$ORIGIN/../lib/swift/${SWIFT_INSTALL_SUBDIR}")


set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS plutil)
Expand Down
8 changes: 2 additions & 6 deletions Sources/UUID/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ set_target_properties(uuid PROPERTIES
if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS uuid)

# get_swift_host_arch(swift_arch)

# 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/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
LIBRARY DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
ARCHIVE DESTINATION lib/swift_static/${SWIFT_INSTALL_SUBDIR}
LIBRARY DESTINATION lib/swift_static/${SWIFT_INSTALL_SUBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
10 changes: 7 additions & 3 deletions cmake/modules/SwiftSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,19 @@ function(_install_target module)
set(swift swift)
endif()

get_swift_host_arch(swift_arch)
set(install_subdir "${swift_os}")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
set(install_subdir "${install_subdir}/${swift_arch}")
endif()
install(TARGETS ${module}
ARCHIVE DESTINATION lib/${swift}/${swift_os}
LIBRARY DESTINATION lib/${swift}/${swift_os}
ARCHIVE DESTINATION lib/${swift}/${install_subdir}
LIBRARY DESTINATION lib/${swift}/${install_subdir}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(type STREQUAL EXECUTABLE)
return()
endif()

get_swift_host_arch(swift_arch)
get_target_property(module_name ${module} Swift_MODULE_NAME)
if(NOT module_name)
set(module_name ${module})
Expand Down