Permalink
Browse files

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

Closes #1969
  • Loading branch information...
1 parent a681348 commit 185808bf167fb7477211c7b624cd7a3ba3c4ce77 @nirbheek nirbheek committed with jpakkane Jun 20, 2017
Showing with 16 additions and 2 deletions.
  1. +7 −1 mesonbuild/backend/ninjabackend.py
  2. +9 −1 test cases/vala/7 shared library/lib/meson.build
@@ -1100,7 +1100,13 @@ def generate_vala_compile(self, target, outfile):
args += ['--library=' + target.name]
# Outputted 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)
# Outputted vapi file
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',
dependencies : valadeps,

0 comments on commit 185808b

Please sign in to comment.