Files
swift-mirror/Runtimes/Core/Concurrency/dispatch.cmake
Saleem Abdulrasool 326f18d113 Runtimes: detect the existence of dispatch_async_swift_job
This function is used by the executor to help schedule the async job.
While not currently available on Windows on main, this allows correctly
handling the presence of the symbol for static linking.
2025-07-11 11:28:07 -07:00

20 lines
780 B
CMake

find_package(dispatch QUIET REQUIRED)
check_symbol_exists("dispatch_async_swift_job" "dispatch/private.h"
SwiftConcurrency_HAS_DISPATCH_ASYNC_SWIFT_JOB)
target_sources(swift_Concurrency PRIVATE
DispatchGlobalExecutor.cpp
DispatchExecutor.swift
CFExecutor.swift
ExecutorImpl.swift)
target_compile_definitions(swift_Concurrency PRIVATE
$<$<BOOL:${SwiftConcurrency_HAS_DISPATCH_ASYNC_SWIFT_JOB}>:-DSwiftConcurrency_HAS_DISPATCH_ASYNC_SWIFT_JOB=1>
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_CONCURRENCY_USES_DISPATCH=1>)
target_compile_options(swift_Concurrency PRIVATE
$<$<COMPILE_LANGUAGE:Swift>:-DSWIFT_CONCURRENCY_USES_DISPATCH>
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -DSWIFT_CONCURRENCY_USES_DISPATCH>")
target_link_libraries(swift_Concurrency PRIVATE
dispatch)