init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
allhaileris
2026-02-16 15:50:16 +03:00
commit afb81b8278
13816 changed files with 3689732 additions and 0 deletions

View File

@@ -0,0 +1,259 @@
/* Define if building pthread work queues from source */
#cmakedefine01 DISPATCH_USE_INTERNAL_WORKQUEUE
/* Enable usage of thread local storage via _Thread_local */
#cmakedefine01 DISPATCH_USE_THREAD_LOCAL_STORAGE
/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_CLOCK_MONOTONIC
/* Define to 1 if you have the declaration of `CLOCK_REALTIME', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_CLOCK_REALTIME
/* Define to 1 if you have the declaration of `CLOCK_UPTIME', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_CLOCK_UPTIME
/* Define to 1 if you have the declaration of `CLOCK_UPTIME_FAST', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_CLOCK_UPTIME_FAST
/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_COARSE', and to
0 if you don't. */
#cmakedefine01 HAVE_CLOCK_MONOTONIC_COARSE
/* Define to 1 if you have the declaration of `FD_COPY', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_FD_COPY
/* Define to 1 if you have the declaration of `NOTE_LOWAT', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_NOTE_LOWAT
/* Define to 1 if you have the declaration of `NOTE_NONE', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_NOTE_NONE
/* Define to 1 if you have the declaration of `NOTE_REAP', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_NOTE_REAP
/* Define to 1 if you have the declaration of `NOTE_REVOKE', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_NOTE_REVOKE
/* Define to 1 if you have the declaration of `NOTE_SIGNAL', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_NOTE_SIGNAL
/* Define to 1 if you have the declaration of `POSIX_SPAWN_START_SUSPENDED',
and to 0 if you don't. */
#cmakedefine01 HAVE_DECL_POSIX_SPAWN_START_SUSPENDED
/* Define to 1 if you have the declaration of `program_invocation_short_name',
and to 0 if you don't. */
#cmakedefine01 HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
/* Define to 1 if you have the declaration of `SIGEMT', and to 0 if you don't.
*/
#cmakedefine01 HAVE_DECL_SIGEMT
/* Define to 1 if you have the declaration of `VQ_DESIRED_DISK', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_VQ_DESIRED_DISK
/* Define to 1 if you have the declaration of `VQ_NEARLOWDISK', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_VQ_NEARLOWDISK
/* Define to 1 if you have the declaration of `VQ_QUOTA', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_VQ_QUOTA
/* Define to 1 if you have the declaration of `VQ_UPDATE', and to 0 if you
don't. */
#cmakedefine01 HAVE_DECL_VQ_UPDATE
/* Define to 1 if you have the declaration of `VQ_VERYLOWDISK', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_VQ_VERYLOWDISK
/* Define to 1 if you have the declaration of `VQ_FREE_SPACE_CHANGE', and to 0 if
you don't. */
#cmakedefine01 HAVE_DECL_VQ_FREE_SPACE_CHANGE
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine01 HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine01 HAVE_FCNTL_H
/* Define to 1 if you have the `getprogname' function. */
#cmakedefine01 HAVE_GETPROGNAME
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine01 HAVE_INTTYPES_H
/* Define if Apple leaks program is present */
#cmakedefine HAVE_LEAKS
/* Define to 1 if you have the <libkern/OSAtomic.h> header file. */
#cmakedefine HAVE_LIBKERN_OSATOMIC_H
/* Define to 1 if you have the <libkern/OSCrossEndian.h> header file. */
#cmakedefine HAVE_LIBKERN_OSCROSSENDIAN_H
/* Define to 1 if you have the <libproc_internal.h> header file. */
#cmakedefine HAVE_LIBPROC_INTERNAL_H
/* Define if mach is present */
#cmakedefine HAVE_MACH
/* Define to 1 if you have the `mach_absolute_time' function. */
#cmakedefine HAVE_MACH_ABSOLUTE_TIME
/* Define to 1 if you have the `mach_approximate_time' function. */
#cmakedefine HAVE_MACH_APPROXIMATE_TIME
/* Define to 1 if you have the `mach_port_construct' function. */
#cmakedefine HAVE_MACH_PORT_CONSTRUCT
/* Define to 1 if you have the `malloc_create_zone' function. */
#cmakedefine HAVE_MALLOC_CREATE_ZONE
/* Define to 1 if you have the <malloc/malloc.h> header file. */
#cmakedefine HAVE_MALLOC_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine01 HAVE_MEMORY_H
/* Define if __builtin_trap marked noreturn */
#cmakedefine01 HAVE_NORETURN_BUILTIN_TRAP
/* Define if you have the Objective-C runtime */
#cmakedefine HAVE_OBJC
/* Define to 1 if you have the `posix_fadvise' function. */
#cmakedefine HAVE_POSIX_FADVISE
/* Define to 1 if you have the `posix_spawnp' function. */
#cmakedefine HAVE_POSIX_SPAWNP
/* Define to 1 if you have the `pthread_key_init_np' function. */
#cmakedefine HAVE_PTHREAD_KEY_INIT_NP
/* Define to 1 if you have the `pthread_attr_setcpupercent_np' function. */
#cmakedefine HAVE_PTHREAD_ATTR_SETCPUPERCENT_NP
/* Define to 1 if you have the <pthread_machdep.h> header file. */
#cmakedefine HAVE_PTHREAD_MACHDEP_H
/* Define to 1 if you have the `pthread_main_np' function. */
#cmakedefine01 HAVE_PTHREAD_MAIN_NP
/* Define to 1 if you have the `pthread_yield_np' function. */
#cmakedefine01 HAVE_PTHREAD_YIELD_NP
/* Define to 1 if you have the <pthread_np.h> header file. */
#cmakedefine01 HAVE_PTHREAD_NP_H
/* Define to 1 if you have the <pthread/qos.h> header file. */
#cmakedefine HAVE_PTHREAD_QOS_H
/* Define if pthread work queues are present */
#cmakedefine01 HAVE_PTHREAD_WORKQUEUES
/* Define to 1 if you have the <pthread_workqueue.h> header file. */
#cmakedefine HAVE_PTHREAD_WORKQUEUE_H
/* Define to 1 if you have the <pthread/workqueue_private.h> header file. */
#cmakedefine HAVE_PTHREAD_WORKQUEUE_PRIVATE_H
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine01 HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine01 HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine01 HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine01 HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
#cmakedefine01 HAVE_STRLCPY
/* Define if building for Swift */
#undef HAVE_SWIFT
/* Define to 1 if you have the `sysconf' function. */
#cmakedefine01 HAVE_SYSCONF
/* Define to 1 if you have the <sys/guarded.h> header file. */
#cmakedefine HAVE_SYS_GUARDED_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine01 HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine01 HAVE_SYS_TYPES_H
/* Define to 1 if you have the <TargetConditionals.h> header file. */
#cmakedefine HAVE_TARGETCONDITIONALS_H
/* Define to 1 if you have the `_pthread_workqueue_init' function. */
#cmakedefine HAVE__PTHREAD_WORKQUEUE_INIT
/* Define to use non-portable pthread TSD optimizations for Mac OS X) */
#cmakedefine USE_APPLE_TSD_OPTIMIZATIONS
/* Define to tag libdispatch_init as a constructor */
#cmakedefine01 USE_LIBDISPATCH_INIT_CONSTRUCTOR
/* Define to use Mach semaphores */
#cmakedefine USE_MACH_SEM
/* Define to use POSIX semaphores */
#cmakedefine01 USE_POSIX_SEM
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
#cmakedefine01 _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
#cmakedefine _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
#cmakedefine01 _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
#cmakedefine01 _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
#cmakedefine01 __EXTENSIONS__
#endif
/* Version number of package */
#define VERSION "${PROJECT_VERSION}"
/* Define to 1 if on MINIX. */
#cmakedefine _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#cmakedefine _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#cmakedefine _POSIX_SOURCE
/* Define if using Darwin $NOCANCEL */
#cmakedefine __DARWIN_NON_CANCELABLE

View File

@@ -0,0 +1,7 @@
set(DISPATCH_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/dispatchExports.cmake)
configure_file(dispatchConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/dispatchConfig.cmake)
get_property(DISPATCH_EXPORTS GLOBAL PROPERTY DISPATCH_EXPORTS)
export(TARGETS ${DISPATCH_EXPORTS} FILE ${DISPATCH_EXPORTS_FILE})

View File

@@ -0,0 +1,5 @@
# clang-cl interprets paths starting with /U as macro undefines, so we need to
# put a -- before the input file path to force it to be treated as a path.
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")

View File

@@ -0,0 +1,26 @@
function(dtrace_usdt_probe script)
set(options)
set(single_parameter_options TARGET_NAME OUTPUT_SOURCES)
set(multiple_parameter_options)
cmake_parse_arguments("" "${options}" "${single_parameter_options}" "${multiple_parameter_options}" ${ARGN})
get_filename_component(script_we ${script} NAME_WE)
add_custom_command(OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
COMMAND
${dtrace_EXECUTABLE} -h -s ${script} -o ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
DEPENDS
${script})
add_custom_target(dtrace-usdt-header-${script_we}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h)
if(_TARGET_NAME)
set(${_TARGET_NAME} dtrace-usdt-header-${script_we} PARENT_SCOPE)
endif()
if(_OUTPUT_SOURCES)
set(${_OUTPUT_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,43 @@
set(WITH_APPLE_PTHREAD_SOURCE "" CACHE PATH "Path to Apple's libpthread")
set(WITH_APPLE_LIBPLATFORM_SOURCE "" CACHE PATH "Path to Apple's libplatform")
set(WITH_APPLE_LIBCLOSURE_SOURCE "" CACHE PATH "Path to Apple's libclosure")
set(WITH_APPLE_XNU_SOURCE "" CACHE PATH "Path to Apple's XNU")
set(WITH_APPLE_OBJC4_SOURCE "" CACHE PATH "Path to Apple's ObjC4")
if(WITH_APPLE_PTHREAD_SOURCE)
include_directories(SYSTEM "${WITH_APPLE_PTHREAD_SOURCE}")
endif()
if(WITH_APPLE_LIBPLATFORM_SOURCE)
include_directories(SYSTEM "${WITH_APPLE_LIBPLATFORM_SOURCE}/include")
endif()
if(WITH_APPLE_LIBCLOSURE_SOURCE)
include_directories(SYSTEM "${WITH_APPLE_LIBCLOSURE_SOURCE}")
endif()
if(WITH_APPLE_XNU_SOURCE)
# FIXME(compnerd) this should use -idirafter
include_directories("${WITH_APPLE_XNU_SOURCE}/libkern")
include_directories(SYSTEM
"${WITH_APPLE_XNU_SOURCE}/bsd"
"${WITH_APPLE_XNU_SOURCE}/libsyscall"
"${WITH_APPLE_XNU_SOURCE}/libsyscall/wrappers/libproc")
# hack for xnu/bsd/sys/event.h EVFILT_SOCK declaration
add_definitions(-DPRIVATE=1)
endif()
if(IS_DIRECTORY "/System/Library/Frameworks/System.framework/PrivateHeaders")
include_directories(SYSTEM
"/System/Library/Frameworks/System.framework/PrivateHeaders")
endif()
option(ENABLE_APPLE_TSD_OPTIMIZATIONS "use non-portable pthread TSD optimizations" OFF)
if(ENABLE_APPLE_TSD_OPTIMIZATIONS)
set(USE_APPLE_TSD_OPTIMIZATIONS 1)
else()
set(USE_APPLE_TSD_OPTIMIZATIONS 0)
endif()
# TODO(compnerd) link in libpthread headers

View File

@@ -0,0 +1,84 @@
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
# TODO: someone needs to provide the msvc equivalent warning flags
elseif(WIN32)
# Tareting Windows but using a non-MSVC compiler. Set -fms-extensions
# so that we can use __popcnt64
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fms-extensions>)
else()
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wall>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wextra>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Warray-bounds-pointer-arithmetic>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wassign-enum>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Watomic-properties>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wcomma>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wconditional-uninitialized>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wconversion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wcovered-switch-default>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdate-time>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdeprecated>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdocumentation>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wdouble-promotion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wduplicate-enum>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wexpansion-to-defined>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wfloat-equal>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Widiomatic-parentheses>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Winfinite-recursion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wmissing-prototypes>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wnewline-eof>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wnullable-to-nonnull-conversion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wobjc-interface-ivars>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wover-aligned>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wpacked>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wpointer-arith>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wselector>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wshadow>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wshorten-64-to-32>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wsign-conversion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wstatic-in-inline>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wsuper-class-method-mismatch>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wswitch>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunguarded-availability>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunreachable-code>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wunused>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unknown-warning-option>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-trigraphs>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-four-char-constants>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-disabled-macro-expansion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-pedantic>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-bad-function-cast>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++-compat>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++98-compat>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-c++98-compat-pedantic>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-cast-align>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-cast-qual>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-documentation-unknown-command>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-format-nonliteral>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-missing-variable-declarations>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-old-style-cast>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-padded>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-reserved-id-macro>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-shift-sign-overflow>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-undef>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unreachable-code-aggressive>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unused-macros>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-used-but-marked-unused>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-void-pointer-to-int-cast>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-vla>)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-incompatible-function-pointer-types>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-implicit-function-declaration>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-conversion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-int-conversion>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-shorten-64-to-32>)
endif()
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-error=assign-enum>)
# Should re-enable after rdar://133498289 is fixed (ie. fixing the one mismatched cast in apply.c)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-cast-function-type-mismatch>)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-error=unknown-warning-option>)
endif()

View File

@@ -0,0 +1,44 @@
set(DISPATCH_USE_SANITIZER "" CACHE STRING
"Define the sanitizer used to build binaries and tests.")
if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND DISPATCH_USE_SANITIZER)
message(FATAL_ERROR "building libdispatch with sanitization is not supported on Darwin")
endif()
if(DISPATCH_USE_SANITIZER)
# TODO(compnerd) ensure that the compiler supports these options before adding
# them. At the moment, assume that this will just be used with a GNU
# compatible driver and that the options are spelt correctly in light of that.
add_compile_options("-fno-omit-frame-pointer")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_options("-O1")
elseif(NOT CMAKE_BUILD_TYPE MATCHES "Debug" AND
NOT CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
add_compile_options("-gline-tables-only")
endif()
if(LLVM_USE_SANITIZER STREQUAL "Address")
add_compile_options("-fsanitize=address")
elseif(DISPATCH_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
add_compile_options("-fsanitize=memory")
if(DISPATCH_USE_SANITIZER STREQUAL "MemoryWithOrigins")
add_compile_options("-fsanitize-memory-track-origins")
endif()
elseif(DISPATCH_USE_SANITIZER STREQUAL "Undefined")
add_compile_options("-fsanitize=undefined")
add_compile_options("-fno-sanitize=vptr,function")
add_compile_options("-fno-sanitize-recover=all")
elseif(DISPATCH_USE_SANITIZER STREQUAL "Thread")
add_compile_options("-fsanitize=thread")
elseif(DISPATCH_USE_SANITIZER STREQUAL "Address;Undefined" OR
DISPATCH_USE_SANITIZER STREQUAL "Undefined;Address")
add_compile_options("-fsanitize=address,undefined")
add_compile_options("-fno-sanitize=vptr,function")
add_compile_options("-fno-sanitize-recover=all")
elseif(DISPATCH_USE_SANITIZER STREQUAL "Leaks")
add_compile_options("-fsanitize=leak")
else()
message(FATAL_ERROR "unsupported value of DISPATCH_USE_SANITIZER: ${DISPATCH_USE_SANITIZER}")
endif()
endif()

View File

@@ -0,0 +1,74 @@
function(dispatch_windows_arch_spelling arch var)
if(${arch} STREQUAL i686)
set(${var} x86 PARENT_SCOPE)
elseif(${arch} STREQUAL x86_64 OR ${arch} STREQUAL AMD64)
set(${var} x64 PARENT_SCOPE)
elseif(${arch} STREQUAL armv7)
set(${var} arm PARENT_SCOPE)
elseif(${arch} STREQUAL aarch64 OR ${arch} STREQUAL ARM64)
set(${var} arm64 PARENT_SCOPE)
else()
message(FATAL_ERROR "do not know MSVC spelling for ARCH: `${arch}`")
endif()
endfunction()
function(dispatch_verify_windows_environment_variables)
set(VCToolsInstallDir $ENV{VCToolsInstallDir})
set(UniversalCRTSdkDir $ENV{UniversalCRTSdkDir})
set(UCRTVersion $ENV{UCRTVersion})
if("${VCToolsInstallDir}" STREQUAL "")
message(SEND_ERROR "VCToolsInstallDir environment variable must be set")
endif()
if("${UniversalCRTSdkDir}" STREQUAL "")
message(SEND_ERROR "UniversalCRTSdkDir environment variable must be set")
endif()
if("${UCRTVersion}" STREQUAL "")
message(SEND_ERROR "UCRTVersion environment variable must be set")
endif()
endfunction()
function(dispatch_windows_include_for_arch arch var)
dispatch_verify_windows_environment_variables()
set(paths
"$ENV{VCToolsInstallDir}/include"
"$ENV{UniversalCRTSdkDir}/Include/$ENV{UCRTVersion}/ucrt"
"$ENV{UniversalCRTSdkDir}/Include/$ENV{UCRTVersion}/shared"
"$ENV{UniversalCRTSdkDir}/Include/$ENV{UCRTVersion}/um")
set(${var} ${paths} PARENT_SCOPE)
endfunction()
function(dispatch_windows_lib_for_arch arch var)
dispatch_verify_windows_environment_variables()
dispatch_windows_arch_spelling(${arch} ARCH)
set(paths)
if(${ARCH} STREQUAL x86)
list(APPEND paths "$ENV{VCToolsInstallDir}/Lib")
else()
list(APPEND paths "$ENV{VCToolsInstallDir}/Lib/${ARCH}")
endif()
list(APPEND paths
"$ENV{UniversalCRTSdkDir}/Lib/$ENV{UCRTVersion}/ucrt/${ARCH}"
"$ENV{UniversalCRTSdkDir}/Lib/$ENV{UCRTVersion}/um/${ARCH}")
set(${var} ${paths} PARENT_SCOPE)
endfunction()
function(dispatch_windows_generate_sdk_vfs_overlay flags)
dispatch_verify_windows_environment_variables()
get_filename_component(VCToolsInstallDir $ENV{VCToolsInstallDir} ABSOLUTE)
get_filename_component(UniversalCRTSdkDir $ENV{UniversalCRTSdkDir} ABSOLUTE)
set(UCRTVersion $ENV{UCRTVersion})
# TODO(compnerd) use a target to avoid re-creating this file all the time
configure_file("${PROJECT_SOURCE_DIR}/utils/WindowsSDKVFSOverlay.yaml.in"
"${PROJECT_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
@ONLY)
set(${flags}
-ivfsoverlay;"${PROJECT_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
PARENT_SCOPE)
endfunction()

View File

@@ -0,0 +1,48 @@
#.rst:
# FindBlocksRuntime
# -----------------
#
# Find libBlocksRuntime library and headers.
#
# The module defines the following variables:
#
# ##
#
# BlocksRuntime_FOUND - true if libBlocksRuntime was found
# BlocksRuntime_INCLUDE_DIR - include search path
# BlocksRuntime_LIBRARIES - libraries to link
if(BlocksRuntime_INCLUDE_DIR AND BlocksRuntime_LIBRARIES)
set(BlocksRuntime_FOUND TRUE)
else()
find_path(BlocksRuntime_INCLUDE_DIR
NAMES
Blocks.h
HINTS
${CMAKE_INSTALL_FULL_INCLUDEDIR})
find_library(BlocksRuntime_LIBRARIES
NAMES
BlocksRuntime libBlocksRuntime
HINTS
${CMAKE_INSTALL_FULL_LIBDIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BlocksRuntime
REQUIRED_VARS
BlocksRuntime_LIBRARIES
BlocksRuntime_INCLUDE_DIR)
mark_as_advanced(BlocksRuntime_LIBRARIES BlocksRuntime_INCLUDE_DIR)
endif()
if(BlocksRuntime_FOUND)
if(NOT TARGET BlocksRuntime::BlocksRuntime)
add_library(BlocksRuntime::BlocksRuntime UNKNOWN IMPORTED)
set_target_properties(BlocksRuntime::BlocksRuntime
PROPERTIES
IMPORTED_LOCATION
${BlocksRuntime_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES
${BlocksRuntime_INCLUDE_DIR})
endif()
endif()

View File

@@ -0,0 +1,39 @@
#.rst:
# FindLibRT
# ---------
#
# Find librt library and headers.
#
# The mdoule defines the following variables:
#
# ::
#
# LibRT_FOUND - true if librt was found
# LibRT_INCLUDE_DIR - include search path
# LibRT_LIBRARIES - libraries to link
if(UNIX)
find_path(LibRT_INCLUDE_DIR
NAMES
time.h)
find_library(LibRT_LIBRARIES rt)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibRT
REQUIRED_VARS
LibRT_LIBRARIES
LibRT_INCLUDE_DIR)
if(LibRT_FOUND)
if(NOT TARGET RT::rt)
add_library(RT::rt UNKNOWN IMPORTED)
set_target_properties(RT::rt
PROPERTIES
IMPORTED_LOCATION ${LibRT_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${LibRT_INCLUDE_DIR})
endif()
endif()
mark_as_advanced(LibRT_LIBRARIES LibRT_INCLUDE_DIR)
endif()

View File

@@ -0,0 +1,41 @@
# Returns the current achitecture name in a variable
#
# Usage:
# get_swift_host_arch(result_var_name)
#
# If the current architecture is supported by Swift, sets ${result_var_name}
# with the sanitized host architecture name derived from CMAKE_SYSTEM_PROCESSOR.
function(get_swift_host_arch result_var_name)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "AArch64|aarch64|arm64|ARM64")
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
set("${result_var_name}" "arm64" PARENT_SCOPE)
else()
set("${result_var_name}" "aarch64" PARENT_SCOPE)
endif()
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
set("${result_var_name}" "powerpc64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
set("${result_var_name}" "powerpc64le" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "s390x")
set("${result_var_name}" "s390x" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv6l")
set("${result_var_name}" "armv6" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a")
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
set("${result_var_name}" "itanium" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
set("${result_var_name}" "i686" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
set("${result_var_name}" "i686" PARENT_SCOPE)
else()
message(FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
endfunction()

View File

@@ -0,0 +1,7 @@
set(DISPATCH_HAS_SWIFT_SDK_OVERLAY @ENABLE_SWIFT@)
if(NOT TARGET dispatch)
include(@DISPATCH_EXPORTS_FILE@)
endif()