meson: embed source paths as relative to the source root and avoid ../src

Change-Id: Ifab83cb7a3bfde717a4d6032ede8be75dc61f2b1
This commit is contained in:
Qyriad 2024-04-17 23:37:07 -06:00
parent 077f45ee38
commit f9d08cc44c

View file

@ -413,6 +413,21 @@ if get_option('profile-build').require(meson.get_compiler('cpp').get_id() == 'cl
add_project_arguments('-ftime-trace', language: 'cpp') add_project_arguments('-ftime-trace', language: 'cpp')
endif endif
if cxx.get_id() in ['clang', 'gcc']
add_project_arguments([
# Meson uses out of source builds, conventionally usually in a subdirectory
# of the source tree (e.g. meson setup ./build). This means that unlike in
# the previous Make buildsystem, all compilation sources are passed as a relative
# parent, e.g. `cc -o src/libexpr/nixexpr.cc.o ../src/libexpr/nixexpr.cc`.
# These paths show up when debugging, and in asserts, which look both look strange
# and confuse debuggers.
# So let's just tell GCC and Clang that ../src really means src.
'-ffile-prefix-map=../src=src',
],
language : 'cpp',
)
endif
subdir('src') subdir('src')
subdir('scripts') subdir('scripts')
subdir('misc') subdir('misc')