Skip to content

Commit 20cfe0a

Browse files
committed
CMake: Verify os_signpost_*/os_log with tracing
Adding check to CMake to verify that we have the os_signpost and os_log API available in order to accept enabling the runtime tracing.
1 parent 01eb399 commit 20cfe0a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ defaulted_option(SwiftCore_ENABLE_CONCURRENCY "Enable Concurrency runtime suppor
110110
defaulted_option(SwiftCore_ENABLE_REMOTE_MIRROR "Enable RemoteMirror runtime support")
111111
defaulted_option(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE "Use direct retain release in the runtime/stdlib")
112112
defaulted_set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR STRING "Default Concurrency global executor implementation")
113-
option(SwiftCore_ENABLE_STDLIB_TRACING "Enable tracing in the runtime. Assumes the precense of os_log(3) and the os_signpost(3) API." OFF)
113+
option(SwiftCore_ENABLE_STDLIB_TRACING "Enable tracing in the runtime. Requires os_log(3) and the os_signpost(3) API." OFF)
114114
option(SwiftCore_ENABLE_COMMANDLINE_SUPPORT "Enable command line argument support" ON)
115115
option(SwiftCore_ENABLE_UNICODE_DATA "Include unicode data in Swift runtimes" ON)
116116
option(SwiftCore_ENABLE_SHORT_MANGLING_LOOKUPS "Build with fast-path context descriptor lookups based on well-known short manglings." ON)

Runtimes/Core/runtime/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ if(SwiftCore_ENABLE_FILESYSTEM_SUPPORT AND (NOT SwiftCore_ARCH_SUBDIR OR NOT Swi
7272
message(SEND_ERROR "Filesystem support requires setting `SwiftCore_ARCH_SUBDIR` and `SwiftCore_PLATFORM_SUBDIR`")
7373
endif()
7474

75+
if(SwiftCore_ENABLE_STDLIB_TRACING)
76+
check_symbol_exists("os_signpost_interval_begin" "os/signpost.h" SwiftCore_HAS_OS_SIGNPOST)
77+
check_symbol_exists("os_log" "os/log.h" SwiftCore_HAS_OS_LOG)
78+
if(NOT SwiftCore_HAS_OS_LOG OR NOT SwiftCore_HAS_OS_SIGNPOST)
79+
message(SEND_ERROR "Tracing requires 'os_signpost' and 'os_log' APIs")
80+
endif()
81+
endif()
82+
7583
# TODO: Probably worth considering putting half of these in a RuntimeConfig.h.in
7684
# file rather than pushing them through macro flags.
7785
target_compile_definitions(swiftRuntime

0 commit comments

Comments
 (0)