diff --git a/CMakeLists.txt b/CMakeLists.txt index c493596d61..9e1d0e5fcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,33 +68,39 @@ if(NOT BUILD_SHARED_LIBS) install(TARGETS CoreFoundation CFXMLInterface CFURLSessionInterface DESTINATION lib/swift_static/$) endif() + +set(swift_lib_dir "lib/swift") +if(NOT BUILD_SHARED_LIBS) + set(swift_lib_dir "lib/swift_static") +endif() + # TODO(compnerd) install as a Framework as that is how swift actually is built install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers/ DESTINATION - lib/swift/CoreFoundation + ${swift_lib_dir}/CoreFoundation FILES_MATCHING PATTERN "*.h") install(FILES - CoreFoundation/Base.subproj/module.map + CoreFoundation/Base.subproj/$<$>:static/>module.map DESTINATION - lib/swift/CoreFoundation) + ${swift_lib_dir}/CoreFoundation) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CFURLSessionInterface.framework/Headers/ DESTINATION - lib/swift/CFURLSessionInterface + ${swift_lib_dir}/CFURLSessionInterface FILES_MATCHING PATTERN "*.h") install(FILES - CoreFoundation/URL.subproj/module.map + CoreFoundation/URL.subproj/$<$>:static/>module.map DESTINATION - lib/swift/CFURLSessionInterface) + ${swift_lib_dir}/CFURLSessionInterface) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CFXMLInterface.framework/Headers/ DESTINATION - lib/swift/CFXMLInterface + ${swift_lib_dir}/CFXMLInterface FILES_MATCHING PATTERN "*.h") install(FILES - CoreFoundation/Parsing.subproj/module.map + CoreFoundation/Parsing.subproj/$<$>:static/>module.map DESTINATION - lib/swift/CFXMLInterface) + ${swift_lib_dir}/CFXMLInterface) add_subdirectory(cmake/modules) diff --git a/CoreFoundation/Base.subproj/static/module.map b/CoreFoundation/Base.subproj/static/module.map new file mode 100644 index 0000000000..8a7ecf4855 --- /dev/null +++ b/CoreFoundation/Base.subproj/static/module.map @@ -0,0 +1,7 @@ +module CoreFoundation [extern_c] [system] { + umbrella header "CoreFoundation.h" + explicit module CFPlugInCOM { header "CFPlugInCOM.h" } + + link "CoreFoundation" + link "uuid" +} diff --git a/CoreFoundation/Parsing.subproj/static/module.map b/CoreFoundation/Parsing.subproj/static/module.map new file mode 100644 index 0000000000..1cba670337 --- /dev/null +++ b/CoreFoundation/Parsing.subproj/static/module.map @@ -0,0 +1,6 @@ +module CFXMLInterface [extern_c] [system] { + umbrella header "CFXMLInterface.h" + + link "CFXMLInterface" + link "xml2" +} diff --git a/CoreFoundation/URL.subproj/static/module.map b/CoreFoundation/URL.subproj/static/module.map new file mode 100644 index 0000000000..1198a44122 --- /dev/null +++ b/CoreFoundation/URL.subproj/static/module.map @@ -0,0 +1,6 @@ +module CFURLSessionInterface [extern_c] [system] { + umbrella header "CFURLSessionInterface.h" + + link "CFURLSessionInterface" + link "curl" +} diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt index dbca9deece..5628fdae8a 100644 --- a/Sources/Foundation/CMakeLists.txt +++ b/Sources/Foundation/CMakeLists.txt @@ -157,6 +157,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) add_dependencies(Foundation CoreFoundationResources) target_link_options(Foundation PRIVATE $) +elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) + target_link_options(Foundation PRIVATE "SHELL:-no-toolchain-stdlib-rpath") endif() diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt index 70857f6b21..2ea3924ceb 100644 --- a/Sources/FoundationNetworking/CMakeLists.txt +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -66,6 +66,10 @@ set_target_properties(FoundationNetworking PROPERTIES Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift) +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows") + target_link_options(FoundationNetworking PRIVATE "SHELL:-no-toolchain-stdlib-rpath") +endif() + set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationNetworking) install(TARGETS FoundationNetworking diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt index ce0590a481..a11e027237 100644 --- a/Sources/FoundationXML/CMakeLists.txt +++ b/Sources/FoundationXML/CMakeLists.txt @@ -20,6 +20,10 @@ set_target_properties(FoundationXML PROPERTIES Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift) +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows") + target_link_options(FoundationXML PRIVATE "SHELL:-no-toolchain-stdlib-rpath") +endif() + set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationXML) install(TARGETS FoundationXML diff --git a/Sources/UUID/CMakeLists.txt b/Sources/UUID/CMakeLists.txt index d4c2c8b02d..fbc2c2f139 100644 --- a/Sources/UUID/CMakeLists.txt +++ b/Sources/UUID/CMakeLists.txt @@ -22,4 +22,10 @@ set_target_properties(uuid PROPERTIES if(NOT BUILD_SHARED_LIBS) set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS uuid) + + get_swift_host_arch(swift_arch) + install(TARGETS uuid + ARCHIVE DESTINATION lib/swift_static/$ + LIBRARY DESTINATION lib/swift_static/$ + RUNTIME DESTINATION bin) endif()