vala: Only add --use-header for unity builds

Closes https://github.com/mesonbuild/meson/issues/1969
pull/1884/merge
Nirbheek Chauhan 8 years ago committed by Jussi Pakkanen
parent a681348b05
commit 185808bf16
  1. 8
      mesonbuild/backend/ninjabackend.py
  2. 10
      test cases/vala/7 shared library/lib/meson.build

@ -1100,7 +1100,13 @@ int dummy;
args += ['--library=' + target.name] args += ['--library=' + target.name]
# Outputted header # Outputted header
hname = os.path.join(self.get_target_dir(target), target.vala_header) hname = os.path.join(self.get_target_dir(target), target.vala_header)
args += ['-H', hname, '--use-header'] args += ['-H', hname]
if self.is_unity(target):
# Without this the declarations will get duplicated in the .c
# files and cause a build failure when all of them are
# #include-d in one .c file.
# https://github.com/mesonbuild/meson/issues/1969
args += ['--use-header']
valac_outputs.append(hname) valac_outputs.append(hname)
# Outputted vapi file # Outputted vapi file
vapiname = os.path.join(self.get_target_dir(target), target.vala_vapi) vapiname = os.path.join(self.get_target_dir(target), target.vala_vapi)

@ -1,4 +1,12 @@
l = shared_library('valalib', 'mylib.vala', dependencies : valadeps) args = []
# https://github.com/mesonbuild/meson/issues/1969
if get_option('unity') == 'on'
vala_args = ['-H', 'mylib.h']
endif
l = shared_library('valalib', 'mylib.vala',
vala_args : args,
dependencies : valadeps)
shared_library('installed_vala_lib', 'mylib.vala', shared_library('installed_vala_lib', 'mylib.vala',
dependencies : valadeps, dependencies : valadeps,

Loading…
Cancel
Save