tracy/meson.build

204 lines
5.4 KiB
Meson
Raw Normal View History

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
tracy_compile_args = []
# compiler flags shared between the capture library itself and the code using it
2023-11-09 18:50:34 +00:00
tracy_common_args = []
if get_option('tracy_enable')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_ENABLE']
endif
if get_option('tracy_on_demand')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_ON_DEMAND']
endif
if get_option('tracy_callstack')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_CALLSTACK']
endif
if get_option('tracy_no_callstack')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_CALLSTACK']
endif
if get_option('tracy_no_callstack_inlines')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_CALLSTACK_INLINES']
endif
if get_option('tracy_only_localhost')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_ONLY_LOCALHOST']
endif
if get_option('tracy_no_broadcast')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_BROADCAST']
endif
if get_option('tracy_only_ipv4')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_ONLY_IPV4']
endif
if get_option('tracy_no_code_transfer')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_CODE_TRANSFER']
endif
if get_option('tracy_no_context_switch')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_CONTEXT_SWITCH']
endif
if get_option('tracy_no_exit')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_EXIT']
endif
if get_option('tracy_no_sampling')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_SAMPLING']
endif
if get_option('tracy_no_verify')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_VERIFY']
endif
if get_option('tracy_no_vsync_capture')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_VSYNC_CAPTURE']
endif
if get_option('tracy_no_frame_image')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_FRAME_IMAGE']
endif
if get_option('tracy_no_system_tracing')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_NO_SYSTEM_TRACING']
endif
if get_option('tracy_patchable_nopsleds')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_PATCHABLE_NOPSLEDS']
endif
if get_option('tracy_delayed_init')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_DELAYED_INIT']
endif
if get_option('tracy_manual_lifetime')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_MANUAL_LIFETIME']
endif
if get_option('tracy_fibers')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_FIBERS']
endif
if get_option('tracy_timer_fallback')
2023-11-09 18:50:34 +00:00
tracy_common_args += ['-DTRACY_TIMER_FALLBACK']
endif
2022-04-27 04:19:56 +00:00
if get_option('tracy_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
tracy_shared_libs = get_option('default_library') == 'shared'
if tracy_shared_libs and not get_option('tracy_shared_libs')
warning('tracy_shared_libs is set to false, but default_library is set to shared. Building shared library.')
endif
2023-11-09 18:50:34 +00:00
if tracy_shared_libs
tracy_compile_args += ['-DTRACY_EXPORTS']
endif
threads_dep = dependency('threads')
if host_machine.system() == 'windows'
2023-11-09 18:50:34 +00:00
tracy_compile_args += ['-DWINVER=0x0601', '-D_WIN32_WINNT=0x0601']
endif
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'
]
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',
'public/client/TracySysPower.hpp',
2022-07-28 22:32:54 +00:00
'public/client/TracySysTime.hpp',
'public/client/TracySysTrace.hpp',
'public/client/TracyThread.hpp'
]
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'
]
tracy_header_files = common_includes + client_includes + includes
tracy_src = [
2022-07-28 22:32:54 +00:00
'public/TracyClient.cpp'
]
2022-07-28 22:36:07 +00:00
tracy_public_include_dirs = include_directories('public')
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
tracy = library('tracy', tracy_src, tracy_header_files,
dependencies : [ threads_dep ],
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,
install : true)
2023-10-14 04:35:13 +00:00
install_headers(includes, subdir : 'tracy')
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
if tracy_shared_libs
tracy_dep_compile_args += [ '-DTRACY_IMPORTS' ]
endif
pkg = import('pkgconfig')
pkg.generate(tracy, extra_cflags: tracy_dep_compile_args)
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)