Skip to content

Commit d61ff34

Browse files
authored
Merge pull request #109 from swiftwasm/release/5.3
[pull] swiftwasm-release/5.3 from release/5.3
2 parents 73899d0 + dfb10f7 commit d61ff34

File tree

8 files changed

+50
-9
lines changed

8 files changed

+50
-9
lines changed

CMakeLists.txt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,39 @@ if(NOT BUILD_SHARED_LIBS)
8888
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
8989
endif()
9090
endif()
91+
92+
set(swift_lib_dir "lib/swift")
93+
if(NOT BUILD_SHARED_LIBS)
94+
set(swift_lib_dir "lib/swift_static")
95+
endif()
96+
9197
# TODO(compnerd) install as a Framework as that is how swift actually is built
9298
install(DIRECTORY
9399
${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers/
94100
DESTINATION
95-
lib/swift/CoreFoundation
101+
${swift_lib_dir}/CoreFoundation
96102
FILES_MATCHING PATTERN "*.h")
97103
install(FILES
98-
CoreFoundation/Base.subproj/module.map
104+
CoreFoundation/Base.subproj/$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:static/>module.map
99105
DESTINATION
100-
lib/swift/CoreFoundation)
106+
${swift_lib_dir}/CoreFoundation)
101107
install(DIRECTORY
102108
${CMAKE_CURRENT_BINARY_DIR}/CFURLSessionInterface.framework/Headers/
103109
DESTINATION
104-
lib/swift/CFURLSessionInterface
110+
${swift_lib_dir}/CFURLSessionInterface
105111
FILES_MATCHING PATTERN "*.h")
106112
install(FILES
107-
CoreFoundation/URL.subproj/module.map
113+
CoreFoundation/URL.subproj/$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:static/>module.map
108114
DESTINATION
109-
lib/swift/CFURLSessionInterface)
115+
${swift_lib_dir}/CFURLSessionInterface)
110116
install(DIRECTORY
111117
${CMAKE_CURRENT_BINARY_DIR}/CFXMLInterface.framework/Headers/
112118
DESTINATION
113-
lib/swift/CFXMLInterface
119+
${swift_lib_dir}/CFXMLInterface
114120
FILES_MATCHING PATTERN "*.h")
115121
install(FILES
116-
CoreFoundation/Parsing.subproj/module.map
122+
CoreFoundation/Parsing.subproj/$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:static/>module.map
117123
DESTINATION
118-
lib/swift/CFXMLInterface)
124+
${swift_lib_dir}/CFXMLInterface)
119125

120126
add_subdirectory(cmake/modules)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module CoreFoundation [extern_c] [system] {
2+
umbrella header "CoreFoundation.h"
3+
explicit module CFPlugInCOM { header "CFPlugInCOM.h" }
4+
5+
link "CoreFoundation"
6+
link "uuid"
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module CFXMLInterface [extern_c] [system] {
2+
umbrella header "CFXMLInterface.h"
3+
4+
link "CFXMLInterface"
5+
link "xml2"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module CFURLSessionInterface [extern_c] [system] {
2+
umbrella header "CFURLSessionInterface.h"
3+
4+
link "CFURLSessionInterface"
5+
link "curl"
6+
}

Sources/Foundation/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
162162
add_dependencies(Foundation CoreFoundationResources)
163163
target_link_options(Foundation PRIVATE
164164
$<TARGET_OBJECTS:CoreFoundationResources>)
165+
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
166+
target_link_options(Foundation PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
165167
endif()
166168

167169
if(CMAKE_SYSTEM_NAME STREQUAL WASI)

Sources/FoundationNetworking/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ set_target_properties(FoundationNetworking PROPERTIES
6666
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
6767
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
6868

69+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
70+
target_link_options(FoundationNetworking PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
71+
endif()
72+
6973

7074
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationNetworking)
7175
install(TARGETS FoundationNetworking

Sources/FoundationXML/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ set_target_properties(FoundationXML PROPERTIES
2020
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
2121
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
2222

23+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
24+
target_link_options(FoundationXML PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
25+
endif()
26+
2327

2428
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
2529
target_compile_options(FoundationXML

Sources/UUID/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ set_target_properties(uuid PROPERTIES
2222

2323
if(NOT BUILD_SHARED_LIBS)
2424
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS uuid)
25+
26+
get_swift_host_arch(swift_arch)
27+
install(TARGETS uuid
28+
ARCHIVE DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
29+
LIBRARY DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
30+
RUNTIME DESTINATION bin)
2531
endif()
2632

2733
install(TARGETS uuid

0 commit comments

Comments
 (0)