cmake_minimum_required(VERSION 3.15.1)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
# NOTE(compnerd) enable CMP0091 - select MSVC runtime based on
# CMAKE_MSVC_RUNTIME_LIBRARY. Requires CMake 3.15 or newer.
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
project(dispatch
VERSION 1.3
LANGUAGES C CXX)
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
include(ClangClCompileRules)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
include(DispatchWindowsSupport)
dispatch_windows_arch_spelling(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_MSVC_ARCH)
dispatch_windows_include_for_arch(${DISPATCH_MSVC_ARCH} DISPATCH_INCLUDES)
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
link_directories(${DISPATCH_LIBDIR})
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED YES)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_INLINES_HIDDEN YES)
# NOTE(compnerd) this is a horrible workaround for Windows to ensure that the
# tests can run as there is no rpath equivalent and `PATH` is used to lookup the
# libraries.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(GNUInstallDirs)
include(CTest)
include(DispatchAppleOptions)
include(DispatchSanitization)
include(DispatchCompilerWarnings)
include(DTrace)
include(SwiftSupport)
# NOTE(abdulras) this is the CMake supported way to control whether we generate
# shared or static libraries. This impacts the behaviour of `add_library` in
# what type of library it generates.
option(BUILD_SHARED_LIBS "build shared libraries" ON)
option(DISPATCH_ENABLE_ASSERTS "enable debug assertions" FALSE)
option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON)
set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR})
option(ENABLE_DTRACE "enable dtrace support" "")
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT OFF)
else()
set(ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT ON)
endif()
option(ENABLE_INTERNAL_PTHREAD_WORKQUEUES "use libdispatch's own implementation of pthread workqueues" ${ENABLE_INTERNAL_PTHREAD_WORKQUEUES_DEFAULT})
if(ENABLE_INTERNAL_PTHREAD_WORKQUEUES)
set(DISPATCH_USE_INTERNAL_WORKQUEUE 1)
set(HAVE_PTHREAD_WORKQUEUES 0)
else()
check_include_files(pthread/workqueue_private.h HAVE_PTHREAD_WORKQUEUE_PRIVATE_H)
if(HAVE_PTHREAD_WORKQUEUE_PRIVATE_H)
set(HAVE_PTHREAD_WORKQUEUES 1)
set(DISPATCH_USE_INTERNAL_WORKQUEUE 0)
else()
set(HAVE_PTHREAD_WORKQUEUES 0)
set(DISPATCH_USE_INTERNAL_WORKQUEUE 1)
endif()
endif()
option(INSTALL_PRIVATE_HEADERS "installs private headers in the same location as the public ones" OFF)
option(ENABLE_SWIFT "enable libdispatch swift overlay" OFF)
if(ENABLE_SWIFT)
enable_language(Swift)
endif()
option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via _Thread_local" ON)
set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE})
check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
if(_GNU_SOURCE)
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE)
endif()
check_c_source_compiles("void __attribute__((__noreturn__)) main() { __builtin_trap(); }"
__BUILTIN_TRAP)
if(__BUILTIN_TRAP)
set(HAVE_NORETURN_BUILTIN_TRAP 1)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
find_package(LibRT)
endif()
check_function_exists(_pthread_workqueue_init HAVE__PTHREAD_WORKQUEUE_INIT)
check_function_exists(getprogname HAVE_GETPROGNAME)
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
check_function_exists(mach_approximate_time HAVE_MACH_APPROXIMATE_TIME)
check_function_exists(mach_port_construct HAVE_MACH_PORT_CONSTRUCT)
check_function_exists(malloc_create_zone HAVE_MALLOC_CREATE_ZONE)
check_function_exists(posix_fadvise HAVE_POSIX_FADVISE)
check_function_exists(posix_spawnp HAVE_POSIX_SPAWNP)
check_function_exists(pthread_key_init_np HAVE_PTHREAD_KEY_INIT_NP)
check_function_exists(pthread_attr_setcpupercent_np HAVE_PTHREAD_ATTR_SETCPUPERCENT_NP)
check_function_exists(pthread_yield_np HAVE_PTHREAD_YIELD_NP)
check_function_exists(pthread_main_np HAVE_PTHREAD_MAIN_NP)
check_function_exists(pthread_workqueue_setdispatch_np HAVE_PTHREAD_WORKQUEUE_SETDISPATCH_NP)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(sysconf HAVE_SYSCONF)
check_function_exists(arc4random HAVE_ARC4RANDOM)
check_include_files("TargetConditionals.h" HAVE_TARGETCONDITIONALS_H)
check_include_files("dlfcn.h" HAVE_DLFCN_H)
check_include_files("fcntl.h" HAVE_FCNTL_H)
check_include_files("inttypes.h" HAVE_INTTYPES_H)
check_include_files("libkern/OSAtomic.h" HAVE_LIBKERN_OSATOMIC_H)
check_include_files("libkern/OSCrossEndian.h" HAVE_LIBKERN_OSCROSSENDIAN_H)
check_include_files("libproc_internal.h" HAVE_LIBPROC_INTERNAL_H)
check_include_files("mach/mach.h" HAVE_MACH)
if(HAVE_MACH)
set(__DARWIN_NON_CANCELABLE 1)
else()
set(__DARWIN_NON_CANCELABLE 0)
endif()
check_include_files("malloc/malloc.h" HAVE_MALLOC_MALLOC_H)
check_include_files("memory.h" HAVE_MEMORY_H)
check_include_files("pthread/qos.h" HAVE_PTHREAD_QOS_H)
check_include_files("pthread/workqueue_private.h" HAVE_PTHREAD_WORKQUEUE_PRIVATE_H)
check_include_files("pthread_machdep.h" HAVE_PTHREAD_MACHDEP_H)
check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
check_include_files("pthread_workqueue.h" HAVE_PTHREAD_WORKQUEUE_H)
check_include_files("stdint.h" HAVE_STDINT_H)
check_include_files("stdlib.h" HAVE_STDLIB_H)
check_include_files("string.h" HAVE_STRING_H)
check_include_files("strings.h" HAVE_STRINGS_H)
check_include_files("sys/guarded.h" HAVE_SYS_GUARDED_H)
check_include_files("sys/stat.h" HAVE_SYS_STAT_H)
check_include_files("sys/types.h" HAVE_SYS_TYPES_H)
check_include_files("objc/objc-internal.h" HAVE_OBJC)
if(HAVE_MACH)
set(USE_MACH_SEM 1)
else()
set(USE_MACH_SEM 0)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:USE_WIN32_SEM>)
endif()
check_library_exists(pthread sem_init "" USE_POSIX_SEM)
# NOTE: android has not always provided a libpthread, but uses the pthreads API
if(CMAKE_SYSTEM_NAME STREQUAL Android)
set(USE_POSIX_SEM 1)
endif()
check_symbol_exists(CLOCK_UPTIME "time.h" HAVE_DECL_CLOCK_UPTIME)
check_symbol_exists(CLOCK_UPTIME_FAST "time.h" HAVE_DECL_CLOCK_UPTIME_FAST)
check_symbol_exists(CLOCK_MONOTONIC "time.h" HAVE_DECL_CLOCK_MONOTONIC)
check_symbol_exists(CLOCK_REALTIME "time.h" HAVE_DECL_CLOCK_REALTIME)
check_symbol_exists(CLOCK_MONOTONIC_COARSE "time.h" HAVE_DECL_CLOCK_MONOTONIC_COARSE)
check_symbol_exists(FD_COPY "sys/select.h" HAVE_DECL_FD_COPY)
check_symbol_exists(NOTE_LOWAT "sys/event.h" HAVE_DECL_NOTE_LOWAT)
check_symbol_exists(NOTE_NONE "sys/event.h" HAVE_DECL_NOTE_NONE)
check_symbol_exists(NOTE_REAP "sys/event.h" HAVE_DECL_NOTE_REAP)
check_symbol_exists(NOTE_REVOKE "sys/event.h" HAVE_DECL_NOTE_REVOKE)
check_symbol_exists(NOTE_SIGNAL "sys/event.h" HAVE_DECL_NOTE_SIGNAL)
check_symbol_exists(POSIX_SPAWN_START_SUSPENDED "sys/spawn.h" HAVE_DECL_POSIX_SPAWN_START_SUSPENDED)
check_symbol_exists(SIGEMT "signal.h" HAVE_DECL_SIGEMT)
check_symbol_exists(VQ_DESIRED_DISK "sys/mount.h" HAVE_DECL_VQ_DESIRED_DISK)
check_symbol_exists(VQ_NEARLOWDISK "sys/mount.h" HAVE_DECL_VQ_NEARLOWDISK)
check_symbol_exists(VQ_QUOTA "sys/mount.h" HAVE_DECL_VQ_QUOTA)
check_symbol_exists(VQ_UPDATE "sys/mount.h" HAVE_DECL_VQ_UPDATE)
check_symbol_exists(VQ_VERYLOWDISK "sys/mount.h" HAVE_DECL_VQ_VERYLOWDISK)
check_symbol_exists(VQ
没有合适的资源?快使用搜索试试~ 我知道了~
libdispatch-1324.60.3
需积分: 0 0 下载量 85 浏览量
2024-01-12
22:23:26
上传
评论
收藏 571KB GZ 举报
温馨提示
共211个文件
h:88个
c:33个
3:17个
libdispatch,版本1324.60.3,下载自Apple Open Source,用于编译XNU 8019.61.5
资源推荐
资源详情
资源评论
收起资源包目录
libdispatch-1324.60.3 (211个子文件)
dispatch_source_create.3 18KB
dispatch_queue_create.3 12KB
dispatch_io_create.3 10KB
dispatch_async.3 7KB
dispatch_data_create.3 6KB
dispatch_object.3 6KB
dispatch_group_create.3 5KB
dispatch_io_read.3 5KB
dispatch_apply.3 4KB
dispatch_read.3 4KB
dispatch_time.3 3KB
dispatch_semaphore_create.3 3KB
dispatch_benchmark.3 2KB
dispatch_api.3 2KB
dispatch_after.3 2KB
dispatch.3 1KB
dispatch_once.3 935B
libdispatch.aliases 1KB
Dispatch.apinotes 10KB
queue.c 261KB
mach.c 111KB
event_kevent.c 102KB
io.c 83KB
voucher.c 56KB
init.c 50KB
source.c 46KB
firehose_buffer.c 45KB
firehose_server.c 41KB
workgroup.c 40KB
event.c 38KB
introspection.c 38KB
event_windows.c 28KB
transform.c 28KB
runtime.c 27KB
allocator.c 25KB
apply.c 23KB
data.c 20KB
event_epoll.c 19KB
lock.c 17KB
eventlink.c 14KB
semaphore.c 12KB
workqueue.c 9KB
object.c 9KB
time.c 6KB
benchmark.c 3KB
generic_win_stubs.c 3KB
once.c 2KB
getprogname.c 2KB
yield.c 2KB
data.c 1KB
shims.c 973B
resolver.c 707B
DispatchStubs.cc 3KB
libdispatch.clean 2KB
DispatchCompilerWarnings.cmake 6KB
DispatchWindowsSupport.cmake 3KB
DispatchSanitization.cmake 2KB
SwiftSupport.cmake 2KB
DispatchAppleOptions.cmake 2KB
FindBlocksRuntime.cmake 2KB
FindLibRT.cmake 1009B
DTrace.cmake 979B
ClangClCompileRules.cmake 355B
libdispatch.codes 2KB
block.cpp 4KB
provider.d 5KB
dispatch_timers.d 3KB
dispatch_trace.d 2KB
voucher_trace.d 2KB
BlocksRuntime.def 97B
protocol.defs 2KB
firehose.defs 2KB
firehose_reply.defs 1KB
firehose_types.defs 935B
libdispatch.dirty 5KB
inline_internal.h 78KB
queue.h 61KB
mach_private.h 52KB
queue_internal.h 48KB
internal.h 36KB
source.h 27KB
introspection_private.h 26KB
io.h 25KB
object_internal.h 25KB
event_internal.h 24KB
source_private.h 24KB
voucher_private.h 22KB
lock.h 22KB
voucher_internal.h 21KB
queue_private.h 19KB
channel_private.h 19KB
object.h 19KB
io_private.h 18KB
block.h 17KB
trace.h 17KB
firehose_inline_internal.h 16KB
apply_private.h 14KB
workgroup_object.h 13KB
data_private.h 12KB
priority.h 12KB
共 211 条
- 1
- 2
- 3
资源评论
qifeng_xiaozi
- 粉丝: 47
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功