summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Heidelberg <david.heidelberg@collabora.com>2022-12-29 18:08:57 +0100
committerMarge Bot <emma+marge@anholt.net>2024-04-23 18:31:39 +0000
commit44b080af07f0ba516f0d5519bba86eb7c1ea7da2 (patch)
tree48d737f217892ba6097442123559540302e54ce5 /meson.build
parent9d5af353185763c70ac165abc84de3956b65fb5b (diff)
meson: implement split-debug
split-debug uses C args `--gsplit-dwarf` and linker args `--gdb-index` to achieve split debug, speed up the CI linking, and allow us to distribute debug symbols standalone. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28576>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build16
1 files changed, 16 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index a89a17882c1..5e05eb0c37b 100644
--- a/meson.build
+++ b/meson.build
@@ -961,6 +961,22 @@ endif
# otherwise define MESA_DEBUG to 0
pre_args += '-DMESA_DEBUG=' + (with_mesa_debug ? '1' : '0')
+with_split_debug = get_option('split-debug') \
+ .disable_if(not cc.compiles('''#include<stdio.h>
+ int main() {
+ printf("\n");
+ };''',
+ args : '-gsplit-dwarf',
+ name : 'split-dwarf support'),
+ error_message : 'split-debug requires compiler -gsplit-dwarf support') \
+ .disable_if(not cc.has_link_argument('-Wl,--gdb-index'),
+ error_message : 'split-debug requires the linker argument -Wl,--gdb-index')
+
+if with_split_debug.allowed() and get_option('debug')
+ add_project_arguments('-gsplit-dwarf', langauge : ['c', 'cpp'])
+ add_project_link_arguments('-Wl,--gdb-index', language : ['c', 'cpp'])
+endif
+
with_shader_cache = get_option('shader-cache') \
.require(host_machine.system() != 'windows', error_message : 'Shader Cache does not currently work on Windows') \
.allowed()