diff --git a/meson.build b/meson.build index 42ed519d..3545f46a 100644 --- a/meson.build +++ b/meson.build @@ -73,6 +73,12 @@ foreach file : headers install_headers(file, subdir: 'hyprland', preserve_path: true) endforeach +tracy = dependency('tracy', static: true, required: get_option('tracy_enable')) + +if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized' + warning('Profiling builds should set -- buildtype = debugoptimized') +endif + subdir('protocols') subdir('src') subdir('hyprctl') diff --git a/meson_options.txt b/meson_options.txt index 16a34a54..d8c9d5e6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('systemd', type: 'feature', value: 'auto', description: 'Enable systemd integration') option('legacy_renderer', type: 'feature', value: 'disabled', description: 'Enable legacy renderer') +option('tracy_enable', type: 'boolean', value: false , description: 'Enable profiling') diff --git a/nix/default.nix b/nix/default.nix index df270f28..6f086ccc 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -144,7 +144,7 @@ in mesonBuildType = if debug - then "debug" + then "debugoptimized" else "release"; # we want as much debug info as possible @@ -156,7 +156,10 @@ in "legacy_renderer" = legacyRenderer; "systemd" = withSystemd; }) - (mesonBool "b_pch" false) + (mapAttrsToList mesonBool { + "b_pch" = false; + "tracy_enable" = false; + }) ]; postInstall = '' diff --git a/src/meson.build b/src/meson.build index 7c71a735..2dbe2f44 100644 --- a/src/meson.build +++ b/src/meson.build @@ -31,6 +31,7 @@ executable( backtrace_dep, epoll_dep, gio_dep, + tracy, # Try to find canihavesomecoffee's udis86 using pkgconfig # vmt/udis86 does not provide a .pc file and won't be detected this way diff --git a/subprojects/tracy.wrap b/subprojects/tracy.wrap new file mode 100644 index 00000000..11b21787 --- /dev/null +++ b/subprojects/tracy.wrap @@ -0,0 +1 @@ +[wrap-file]