28 introspection_internal.h
41 event/event_internal.h
43 firehose/firehose_internal.h
57 if(DISPATCH_USE_INTERNAL_WORKQUEUE)
58 target_sources(dispatch
61 event/workqueue_internal.h)
63 target_sources(dispatch
67 target_sources(dispatch
72 if(CMAKE_SWIFT_COMPILER)
73 set(swift_optimization_flags)
74 if(CMAKE_BUILD_TYPE MATCHES Release)
75 set(swift_optimization_flags -O)
77 add_swift_library(swiftDispatch
83 ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
85 ${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o
98 -fmodule-map-file=${CMAKE_SOURCE_DIR}/dispatch/module.modulemap
100 -I ${CMAKE_SOURCE_DIR}
101 ${swift_optimization_flags})
102 target_sources(dispatch
104 swift/DispatchStubs.cc
105 ${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o)
107 if(dtrace_EXECUTABLE)
108 dtrace_usdt_probe(${CMAKE_CURRENT_SOURCE_DIR}/provider.d
110 dispatch_dtrace_provider_headers)
111 target_sources(dispatch
113 ${dispatch_dtrace_provider_headers})
115 target_include_directories(dispatch
119 ${CMAKE_CURRENT_SOURCE_DIR}
120 ${CMAKE_CURRENT_BINARY_DIR}
121 ${CMAKE_SOURCE_DIR}/private)
122 if(WITH_BLOCKS_RUNTIME)
123 target_include_directories(dispatch
124 SYSTEM BEFORE PRIVATE
125 "${WITH_BLOCKS_RUNTIME}")
127 if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
128 target_compile_options(dispatch PRIVATE /EHsc-)
130 target_compile_options(dispatch PRIVATE -fno-exceptions)
132 if(DISPATCH_ENABLE_ASSERTS)
133 target_compile_definitions(dispatch
137 if(CMAKE_SYSTEM_NAME STREQUAL Windows)
138 target_compile_definitions(dispatch
140 -D_CRT_SECURE_NO_WARNINGS)
142 if(BSD_OVERLAY_FOUND)
143 target_compile_options(dispatch
145 ${BSD_OVERLAY_CFLAGS})
147 if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
148 target_compile_options(dispatch
152 target_compile_options(dispatch
156 # FIXME(compnerd) add check for -fblocks?
157 if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
158 target_compile_options(dispatch
162 # FIXME(compnerd) add check for -momit-leaf-frame-pointer?
163 target_compile_options(dispatch
166 -momit-leaf-frame-pointer)
168 if(BSD_OVERLAY_FOUND)
169 target_link_libraries(dispatch PRIVATE ${BSD_OVERLAY_LDFLAGS})
171 target_link_libraries(dispatch PRIVATE Threads::Threads)
172 if(WITH_BLOCKS_RUNTIME)
173 target_link_libraries(dispatch PRIVATE BlocksRuntime)
175 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
176 set_property(TARGET dispatch
179 "-Xlinker -compatibility_version -Xlinker 1"
180 "-Xlinker -current_version -Xlinker ${VERSION}"
181 "-Xlinker -dead_strip"
182 "-Xlinker -alias_list -Xlinker ${CMAKE_SOURCE_DIR}/xcodeconfig/libdispatch.aliases")
185 set_property(TARGET dispatch
191 # Temporary staging; the various swift projects that depend on libdispatch
192 # all expect libdispatch.so to be in src/.libs/libdispatch.so
193 # So for now, make a copy so we don't have to do a coordinated commit across
194 # all the swift projects to change this assumption.
195 add_custom_command(TARGET dispatch POST_BUILD
196 COMMAND cmake -E make_directory .libs
197 COMMAND cmake -E copy $<TARGET_FILE:dispatch> .libs
198 COMMENT "Copying libdispatch to .libs")
203 "${CMAKE_INSTALL_FULL_LIBDIR}")