|
1 | 1 |
|
2 | 2 | include(SwiftSupport)
|
3 | 3 |
|
4 |
| -set(dispatch_BLOCK_SOURCES block.cpp) |
5 |
| -if(HAVE_OBJC) |
6 |
| - list(APPEND dispatch_BLOCK_SOURCES data.m object.m) |
7 |
| -endif() |
8 |
| -set(dispatch_SWIFT_SOURCES) |
9 |
| -if(CMAKE_SWIFT_COMPILER) |
10 |
| - set(swift_optimization_flags) |
11 |
| - if(CMAKE_BUILD_TYPE MATCHES Release) |
12 |
| - set(swift_optimization_flags -O) |
13 |
| - endif() |
14 |
| - add_swift_library(swiftDispatch |
15 |
| - MODULE_NAME |
16 |
| - Dispatch |
17 |
| - MODULE_LINK_NAME |
18 |
| - dispatch |
19 |
| - MODULE_PATH |
20 |
| - ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule |
21 |
| - OUTPUT |
22 |
| - ${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o |
23 |
| - SOURCES |
24 |
| - swift/Block.swift |
25 |
| - swift/Data.swift |
26 |
| - swift/Dispatch.swift |
27 |
| - swift/IO.swift |
28 |
| - swift/Private.swift |
29 |
| - swift/Queue.swift |
30 |
| - swift/Source.swift |
31 |
| - swift/Time.swift |
32 |
| - swift/Wrapper.swift |
33 |
| - CFLAGS |
34 |
| - -fblocks |
35 |
| - -fmodule-map-file=${CMAKE_SOURCE_DIR}/dispatch/module.modulemap |
36 |
| - SWIFT_FLAGS |
37 |
| - -I ${CMAKE_SOURCE_DIR} |
38 |
| - ${swift_optimization_flags}) |
39 |
| - list(APPEND dispatch_SWIFT_SOURCES |
40 |
| - swift/DispatchStubs.cc;${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o) |
41 |
| -endif() |
42 | 4 | add_library(dispatch
|
43 | 5 | allocator.c
|
44 | 6 | apply.c
|
@@ -90,9 +52,51 @@ add_library(dispatch
|
90 | 52 | shims/perfmon.h
|
91 | 53 | shims/time.h
|
92 | 54 | shims/tsd.h
|
93 |
| - shims/yield.h |
94 |
| - ${dispatch_BLOCK_SOURCES} |
95 |
| - ${dispatch_SWIFT_SOURCES}) |
| 55 | + shims/yield.h) |
| 56 | +target_sources(dispatch |
| 57 | + PRIVATE |
| 58 | + block.cpp) |
| 59 | +if(HAVE_OBJC) |
| 60 | + target_sources(dispatch |
| 61 | + PRIVATE |
| 62 | + data.m |
| 63 | + object.m) |
| 64 | +endif() |
| 65 | +if(CMAKE_SWIFT_COMPILER) |
| 66 | + set(swift_optimization_flags) |
| 67 | + if(CMAKE_BUILD_TYPE MATCHES Release) |
| 68 | + set(swift_optimization_flags -O) |
| 69 | + endif() |
| 70 | + add_swift_library(swiftDispatch |
| 71 | + MODULE_NAME |
| 72 | + Dispatch |
| 73 | + MODULE_LINK_NAME |
| 74 | + dispatch |
| 75 | + MODULE_PATH |
| 76 | + ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule |
| 77 | + OUTPUT |
| 78 | + ${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o |
| 79 | + SOURCES |
| 80 | + swift/Block.swift |
| 81 | + swift/Data.swift |
| 82 | + swift/Dispatch.swift |
| 83 | + swift/IO.swift |
| 84 | + swift/Private.swift |
| 85 | + swift/Queue.swift |
| 86 | + swift/Source.swift |
| 87 | + swift/Time.swift |
| 88 | + swift/Wrapper.swift |
| 89 | + CFLAGS |
| 90 | + -fblocks |
| 91 | + -fmodule-map-file=${CMAKE_SOURCE_DIR}/dispatch/module.modulemap |
| 92 | + SWIFT_FLAGS |
| 93 | + -I ${CMAKE_SOURCE_DIR} |
| 94 | + ${swift_optimization_flags}) |
| 95 | + target_sources(dispatch |
| 96 | + PRIVATE |
| 97 | + swift/DispatchStubs.cc |
| 98 | + ${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o) |
| 99 | +endif() |
96 | 100 | target_include_directories(dispatch
|
97 | 101 | PRIVATE
|
98 | 102 | ${CMAKE_BINARY_DIR}
|
|
0 commit comments