diff --git a/.gitignore b/.gitignore index 40921279..cb927dc4 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,7 @@ extra/vswhere.exe extra/tracy-build /.cache compile_commands.json + +subprojects/* +!subprojects/imgui.wrap +!subprojects/zstd.wrap \ No newline at end of file diff --git a/imgui/meson.build b/imgui/meson.build new file mode 100644 index 00000000..5e24794f --- /dev/null +++ b/imgui/meson.build @@ -0,0 +1,5 @@ +imgui_sources = files('imgui.cpp', 'imgui_draw.cpp', 'imgui_tables.cpp', 'imgui_widgets.cpp') + +imgui_inc = include_directories('.') +imgui_lib = library('imgui_lib', imgui_sources, include_directories: imgui_inc) +imgui_dep = declare_dependency(include_directories: imgui_inc, link_with: imgui_lib) diff --git a/meson.build b/meson.build index 690938f9..c55f53d5 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('tracy', ['cpp']) +project('tracy', ['cpp', 'c'], default_options: 'cpp_std=c++17') if get_option('tracy_enable') add_project_arguments('-DTRACY_ENABLE', language : 'cpp') @@ -89,7 +89,19 @@ if get_option('tracy_no_crash_handler') add_project_arguments('-DTRACY_NO_CRASH_HANDLER', language : 'cpp') endif +if get_option('tracy_use_wayland') + add_project_arguments('-DDISPLAY_SERVER_WAYLAND', language: 'cpp') + add_project_arguments('-DGLFW_EXPOSE_NATIVE_WAYLAND', language: 'cpp') +else + add_project_arguments('-DDISPLAY_SERVER_X11', language: 'cpp') +endif + +if get_option('tracy_fileselector') == 'none' + add_project_arguments('-DTRACY_NO_FILESELECTOR', language: 'cpp') +endif + threads_dep = dependency('threads') +zstd = dependency('libzstd') includes = [ 'public/tracy/TracyC.h', @@ -126,7 +138,6 @@ common_includes = [ 'public/common/tracy_lz4.hpp', 'public/common/tracy_lz4hc.hpp', 'public/common/TracyAlign.hpp', - 'public/common/TracyAlign.hpp', 'public/common/TracyAlloc.hpp', 'public/common/TracyApi.h', 'public/common/TracyColor.hpp', @@ -188,3 +199,7 @@ tracy_dep_dynamic = declare_dependency( include_directories : tracy_public_include_dirs) meson.override_dependency('tracy', tracy_dep) + +subdir('imgui') +subdir('server') +subdir('profiler') diff --git a/meson_options.txt b/meson_options.txt index ecf6ea1e..f8061e88 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -20,3 +20,6 @@ option('tracy_manual_lifetime', type : 'boolean', value : false, description : ' option('tracy_fibers', type : 'boolean', value : false, description : 'Enable fibers support') option('tracy_shared_libs', type : 'boolean', value : false, description : 'Builds Tracy as a shared object') option('tracy_no_crash_handler', type : 'boolean', value : false, description : 'Disable crash handling') + +option('tracy_use_wayland', type : 'boolean', value : false, description : 'Profiler: Set the Display Server on linux to wayland') +option('tracy_fileselector', type : 'combo', choices : ['none', 'gtk'], value : 'none', description : 'Profiler: Choose fileselector') diff --git a/profiler/meson.build b/profiler/meson.build new file mode 100644 index 00000000..f2d01c40 --- /dev/null +++ b/profiler/meson.build @@ -0,0 +1,29 @@ +profiler_sources = files( + 'src/main.cpp', + 'src/BackendGlfw.cpp', + 'src/ConnectionHistory.cpp', + 'src/Filters.cpp', + 'src/Fonts.cpp', + 'src/HttpRequest.cpp', + 'src/ImGuiContext.cpp', + 'src/ResolvService.cpp', + 'src/RunQueue.cpp', + 'src/WindowPosition.cpp', + 'src/imgui/imgui_impl_glfw.cpp', + 'src/imgui/imgui_impl_opengl3.cpp') + +glfw = dependency('glfw3') +deps = [glfw, threads_dep, server_dep, zstd] + +if get_option('tracy_fileselector') == 'gtk' + profiler_sources += files('../nfd/nfd_gtk.cpp') + deps += dependency('gtk+-3.0') +endif + +if get_option('tracy_use_wayland') + deps += dependency('wayland-client') +endif + +profiler_inc = include_directories('src', 'src/imgui') + +executable('profiler', profiler_sources, include_directories: profiler_inc, dependencies: deps) \ No newline at end of file diff --git a/server/meson.build b/server/meson.build new file mode 100644 index 00000000..003a490d --- /dev/null +++ b/server/meson.build @@ -0,0 +1,61 @@ +server_sources = files( + '../public/common/tracy_lz4.cpp', + '../public/common/tracy_lz4hc.cpp', + '../public/common/TracySocket.cpp', + '../public/common/TracyStackFrames.cpp', + '../public/common/TracySystem.cpp', + 'TracyBadVersion.cpp', + 'TracyColor.cpp', + # 'TracyEventDebug.cpp', + 'TracyFilesystem.cpp', + 'TracyImGui.cpp', + 'TracyMemory.cpp', + 'TracyMicroArchitecture.cpp', + 'TracyMmap.cpp', + 'TracyMouse.cpp', + 'TracyPrint.cpp', + 'TracyProtoHistory.cpp', + 'TracySourceContents.cpp', + 'TracySourceTokenizer.cpp', + 'TracySourceView.cpp', + 'TracyStorage.cpp', + 'TracyTaskDispatch.cpp', + 'TracyTexture.cpp', + 'TracyTextureCompression.cpp', + 'TracyThreadCompress.cpp', + 'TracyUserData.cpp', + 'TracyView_Annotations.cpp', + 'TracyView_Callstack.cpp', + 'TracyView_Compare.cpp', + 'TracyView_ConnectionState.cpp', + 'TracyView_ContextSwitch.cpp', + 'TracyView_CpuData.cpp', + 'TracyView_FindZone.cpp', + 'TracyView_FrameOverview.cpp', + 'TracyView_FrameTimeline.cpp', + 'TracyView_FrameTree.cpp', + 'TracyView_Locks.cpp', + 'TracyView_Memory.cpp', + 'TracyView_Messages.cpp', + 'TracyView_Navigation.cpp', + 'TracyView_NotificationArea.cpp', + 'TracyView_Options.cpp', + 'TracyView_Playback.cpp', + 'TracyView_Plots.cpp', + 'TracyView_Ranges.cpp', + 'TracyView_Samples.cpp', + 'TracyView_Statistics.cpp', + 'TracyView_Timeline.cpp', + 'TracyView_TraceInfo.cpp', + 'TracyView_Utility.cpp', + 'TracyView_ZoneInfo.cpp', + 'TracyView_ZoneTimeline.cpp', + 'TracyView.cpp', + 'TracyWeb.cpp', + 'TracyWorker.cpp') + +capstone = dependency('capstone') + +deps = [imgui_dep, capstone] +server_lib = static_library('tracy_server', server_sources, dependencies: deps, cpp_args: '-UTRACY_ENABLE') +server_dep = declare_dependency(dependencies: deps, link_with: server_lib) \ No newline at end of file diff --git a/subprojects/zstd.wrap b/subprojects/zstd.wrap new file mode 100644 index 00000000..b736b509 --- /dev/null +++ b/subprojects/zstd.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = zstd-1.4.5 +source_url = https://github.com/facebook/zstd/releases/download/v1.4.5/zstd-1.4.5.tar.gz +source_filename = zstd-1.4.5.tar.gz +source_hash = 98e91c7c6bf162bf90e4e70fdbc41a8188b9fa8de5ad840c401198014406ce9e +patch_url = https://wrapdb.mesonbuild.com/v2/zstd_1.4.5-1/get_patch +patch_filename = zstd-1.4.5-1-wrap.zip +patch_hash = fd9cb7b9c8f7092ef1597ff68f170beef65fcf33e575a621955cf405a41db1cc + +[provide] +libzstd = libzstd_dep +