File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ ##===----------------------------------------------------------------------===##
2
+ ##
3
+ ## This source file is part of the Swift open source project
4
+ ##
5
+ ## Copyright (c) 2024 Apple Inc. and the Swift project authors
6
+ ## Licensed under Apache License v2.0
7
+ ##
8
+ ## See LICENSE.txt for license information
9
+ ## See CONTRIBUTORS.md for the list of Swift project authors
10
+ ##
11
+ ## SPDX-License-Identifier: Apache-2.0
12
+ ##
13
+ ##===----------------------------------------------------------------------===##
14
+
15
+ # Build the vendored version of the BlocksRuntime library, which is used by
16
+ # platforms that don't support libdispatch.
17
+
18
+ add_library (BlocksRuntime
19
+ data.c
20
+ runtime.c )
21
+
22
+ target_include_directories (BlocksRuntime PUBLIC
23
+ ${CMAKE_CURRENT_SOURCE_DIR} /include
24
+ # For CFTargetConditionals.h
25
+ ${CMAKE_CURRENT_SOURCE_DIR} /../include )
26
+
27
+ set_target_properties (BlocksRuntime PROPERTIES
28
+ POSITION_INDEPENDENT_CODE FALSE )
29
+
30
+ add_library (BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime )
31
+
32
+ if (NOT BUILD_SHARED_LIBS )
33
+ set_property (GLOBAL APPEND PROPERTY Foundation_EXPORTS BlocksRuntime )
34
+ install (TARGETS BlocksRuntime
35
+ ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SWIFT_SYSTEM_NAME}
36
+ LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SWIFT_SYSTEM_NAME} )
37
+ endif ()
Original file line number Diff line number Diff line change @@ -118,6 +118,12 @@ target_link_libraries(CoreFoundation
118
118
_FoundationICU
119
119
dispatch )
120
120
121
+ if (CMAKE_SYSTEM_NAME STREQUAL WASI )
122
+ # On WASI, we use vendored BlocksRuntime instead of the one from libdispatch
123
+ add_subdirectory (BlockRuntime )
124
+ target_link_libraries (CoreFoundation PRIVATE BlocksRuntime )
125
+ endif ()
126
+
121
127
set_property (GLOBAL APPEND PROPERTY Foundation_EXPORTS CoreFoundation )
122
128
123
129
# Copy Headers to known directory for direct client (XCTest) test builds
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ target_link_libraries(_CFXMLInterface PRIVATE
33
33
dispatch
34
34
LibXml2::LibXml2 )
35
35
36
+ if (CMAKE_SYSTEM_NAME STREQUAL WASI )
37
+ target_link_libraries (_CFXMLInterface PRIVATE BlocksRuntime )
38
+ endif ()
39
+
36
40
if (NOT BUILD_SHARED_LIBS )
37
41
set_property (GLOBAL APPEND PROPERTY Foundation_EXPORTS _CFXMLInterface )
38
42
install (TARGETS _CFXMLInterface
You can’t perform that action at this time.
0 commit comments