2023-11-13 20:56:17 +00:00
|
|
|
project('tracy', ['cpp'], version: '0.10.0', meson_version: '>=0.63.0')
|
2021-06-24 19:41:50 +00:00
|
|
|
|
2023-11-09 18:50:34 +00:00
|
|
|
# internal compiler flags
|
2023-10-15 05:46:43 +00:00
|
|
|
tracy_compile_args = []
|
|
|
|
|
2023-11-12 04:17:20 +00:00
|
|
|
# compiler flags shared between the capture library itself and the code using it
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args = []
|
|
|
|
|
2023-12-12 04:04:41 +00:00
|
|
|
# dependencies that will be propagated to the users of the capture library
|
|
|
|
tracy_public_deps = []
|
|
|
|
|
2022-04-08 17:18:08 +00:00
|
|
|
if get_option('tracy_enable')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_ENABLE']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('on_demand')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_ON_DEMAND']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('callstack')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_CALLSTACK']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_callstack')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_CALLSTACK']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_callstack_inlines')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_CALLSTACK_INLINES']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('only_localhost')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_ONLY_LOCALHOST']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_broadcast')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_BROADCAST']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('only_ipv4')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_ONLY_IPV4']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_code_transfer')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_CODE_TRANSFER']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_context_switch')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_CONTEXT_SWITCH']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_exit')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_EXIT']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_sampling')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_SAMPLING']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_verify')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_VERIFY']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_vsync_capture')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_VSYNC_CAPTURE']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_frame_image')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_FRAME_IMAGE']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_system_tracing')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_SYSTEM_TRACING']
|
2022-04-12 17:07:21 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('patchable_nopsleds')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_PATCHABLE_NOPSLEDS']
|
2023-08-19 01:40:18 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('delayed_init')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_DELAYED_INIT']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('manual_lifetime')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_MANUAL_LIFETIME']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('fibers')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_FIBERS']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('timer_fallback')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_TIMER_FALLBACK']
|
2022-04-08 17:18:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('no_crash_handler')
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_common_args += ['-DTRACY_NO_CRASH_HANDLER']
|
2022-04-27 04:19:56 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('libunwind_backtrace')
|
2023-12-21 13:07:44 +00:00
|
|
|
tracy_common_args += ['-DTRACY_LIBUNWIND_BACKTRACE']
|
2023-12-12 04:05:38 +00:00
|
|
|
tracy_public_deps += dependency('libunwind')
|
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('symbol_offline_resolve')
|
2023-12-12 04:06:08 +00:00
|
|
|
tracy_compile_args += ['-DTRACY_SYMBOL_OFFLINE_RESOLVE']
|
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('libbacktrace_elf_dynload_support')
|
2023-12-12 04:06:31 +00:00
|
|
|
tracy_compile_args += ['-DTRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT']
|
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('verbose')
|
2024-02-05 01:12:31 +00:00
|
|
|
tracy_common_args += ['-DTRACY_VERBOSE']
|
|
|
|
endif
|
|
|
|
|
2024-02-11 16:20:43 +00:00
|
|
|
if get_option('debuginfod')
|
2024-02-05 01:12:31 +00:00
|
|
|
tracy_common_args += ['-DTRACY_DEBUGINFOD']
|
|
|
|
tracy_public_deps += dependency('libdebuginfod')
|
|
|
|
endif
|
|
|
|
|
2023-11-13 20:56:17 +00:00
|
|
|
tracy_shared_libs = get_option('default_library') == 'shared'
|
|
|
|
|
2023-11-09 18:50:34 +00:00
|
|
|
if tracy_shared_libs
|
|
|
|
tracy_compile_args += ['-DTRACY_EXPORTS']
|
|
|
|
endif
|
2023-10-15 05:46:43 +00:00
|
|
|
|
2023-10-17 02:41:20 +00:00
|
|
|
if host_machine.system() == 'windows'
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_compile_args += ['-DWINVER=0x0601', '-D_WIN32_WINNT=0x0601']
|
2023-10-17 02:41:20 +00:00
|
|
|
endif
|
|
|
|
|
2022-04-08 17:18:08 +00:00
|
|
|
includes = [
|
2022-07-28 22:32:54 +00:00
|
|
|
'public/tracy/TracyC.h',
|
|
|
|
'public/tracy/Tracy.hpp',
|
|
|
|
'public/tracy/TracyD3D11.hpp',
|
|
|
|
'public/tracy/TracyD3D12.hpp',
|
|
|
|
'public/tracy/TracyLua.hpp',
|
|
|
|
'public/tracy/TracyOpenCL.hpp',
|
|
|
|
'public/tracy/TracyOpenGL.hpp',
|
|
|
|
'public/tracy/TracyVulkan.hpp'
|
2022-04-08 17:18:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
client_includes = [
|
2022-07-28 22:32:54 +00:00
|
|
|
'public/client/tracy_concurrentqueue.h',
|
|
|
|
'public/client/tracy_rpmalloc.hpp',
|
|
|
|
'public/client/tracy_SPSCQueue.h',
|
|
|
|
'public/client/TracyArmCpuTable.hpp',
|
|
|
|
'public/client/TracyCallstack.h',
|
|
|
|
'public/client/TracyCallstack.hpp',
|
|
|
|
'public/client/TracyDebug.hpp',
|
|
|
|
'public/client/TracyDxt1.hpp',
|
|
|
|
'public/client/TracyFastVector.hpp',
|
|
|
|
'public/client/TracyLock.hpp',
|
|
|
|
'public/client/TracyProfiler.hpp',
|
|
|
|
'public/client/TracyRingBuffer.hpp',
|
|
|
|
'public/client/TracyScoped.hpp',
|
|
|
|
'public/client/TracyStringHelpers.hpp',
|
2023-10-24 04:27:07 +00:00
|
|
|
'public/client/TracySysPower.hpp',
|
2022-07-28 22:32:54 +00:00
|
|
|
'public/client/TracySysTime.hpp',
|
|
|
|
'public/client/TracySysTrace.hpp',
|
|
|
|
'public/client/TracyThread.hpp'
|
2022-04-08 17:18:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
common_includes = [
|
2022-07-28 22:32:54 +00:00
|
|
|
'public/common/tracy_lz4.hpp',
|
|
|
|
'public/common/tracy_lz4hc.hpp',
|
|
|
|
'public/common/TracyAlign.hpp',
|
|
|
|
'public/common/TracyAlloc.hpp',
|
|
|
|
'public/common/TracyApi.h',
|
|
|
|
'public/common/TracyColor.hpp',
|
|
|
|
'public/common/TracyForceInline.hpp',
|
|
|
|
'public/common/TracyMutex.hpp',
|
|
|
|
'public/common/TracyProtocol.hpp',
|
|
|
|
'public/common/TracyQueue.hpp',
|
|
|
|
'public/common/TracySocket.hpp',
|
|
|
|
'public/common/TracyStackFrames.hpp',
|
|
|
|
'public/common/TracySystem.hpp',
|
|
|
|
'public/common/TracyUwp.hpp',
|
|
|
|
'public/common/TracyYield.hpp'
|
2022-04-08 17:18:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
tracy_header_files = common_includes + client_includes + includes
|
|
|
|
|
|
|
|
tracy_src = [
|
2022-07-28 22:32:54 +00:00
|
|
|
'public/TracyClient.cpp'
|
2022-04-08 17:18:08 +00:00
|
|
|
]
|
|
|
|
|
2022-07-28 22:36:07 +00:00
|
|
|
tracy_public_include_dirs = include_directories('public')
|
2022-04-08 17:18:08 +00:00
|
|
|
|
2022-04-21 23:47:36 +00:00
|
|
|
compiler = meson.get_compiler('cpp')
|
|
|
|
override_options = []
|
|
|
|
if compiler.get_id() != 'msvc'
|
|
|
|
override_options += 'cpp_std=c++11'
|
|
|
|
endif
|
|
|
|
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_compile_args += tracy_common_args
|
|
|
|
|
2023-12-12 04:04:41 +00:00
|
|
|
tracy_deps = [dependency('threads')] + tracy_public_deps
|
|
|
|
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy = library('tracy', tracy_src, tracy_header_files,
|
2023-12-12 04:04:41 +00:00
|
|
|
dependencies : tracy_deps,
|
2022-04-08 17:18:08 +00:00
|
|
|
include_directories : tracy_public_include_dirs,
|
2023-11-09 18:50:34 +00:00
|
|
|
cpp_args : tracy_compile_args,
|
2022-04-21 23:47:36 +00:00
|
|
|
override_options : override_options,
|
2022-04-08 17:18:08 +00:00
|
|
|
install : true)
|
|
|
|
|
2023-10-14 04:35:13 +00:00
|
|
|
install_headers(includes, subdir : 'tracy')
|
2022-04-08 17:18:08 +00:00
|
|
|
install_headers(common_includes, subdir : 'common')
|
|
|
|
install_headers(client_includes, subdir : 'client')
|
|
|
|
|
2023-11-09 18:50:34 +00:00
|
|
|
tracy_dep_compile_args = tracy_common_args
|
2022-04-08 17:18:08 +00:00
|
|
|
|
|
|
|
if tracy_shared_libs
|
|
|
|
tracy_dep_compile_args += [ '-DTRACY_IMPORTS' ]
|
|
|
|
endif
|
|
|
|
|
2023-10-14 04:35:24 +00:00
|
|
|
pkg = import('pkgconfig')
|
2023-12-12 04:04:41 +00:00
|
|
|
pkg.generate(tracy,
|
|
|
|
extra_cflags : tracy_dep_compile_args,
|
|
|
|
requires : tracy_public_deps)
|
2023-10-14 04:35:24 +00:00
|
|
|
|
2022-04-08 17:18:08 +00:00
|
|
|
tracy_dep = declare_dependency(
|
|
|
|
compile_args : tracy_dep_compile_args,
|
|
|
|
link_with : tracy,
|
|
|
|
include_directories : tracy_public_include_dirs)
|
|
|
|
|
2021-06-24 19:41:50 +00:00
|
|
|
meson.override_dependency('tracy', tracy_dep)
|