vala: Custom header and vapi name (fix #892)

pull/912/head
Guillaume Poirier-Morency 8 years ago
parent 263cb6a5f0
commit ff6b3c7a2d
  1. 4
      mesonbuild/backend/ninjabackend.py
  2. 5
      mesonbuild/build.py
  3. 0
      test cases/vala/12 custom output/foo.vala
  4. 9
      test cases/vala/12 custom output/meson.build

@ -992,11 +992,11 @@ int dummy;
# Library name # Library name
args += ['--library=' + target.name] args += ['--library=' + target.name]
# Outputted header # Outputted header
hname = os.path.join(self.get_target_dir(target), target.name + '.h') hname = os.path.join(self.get_target_dir(target), target.vala_header if isinstance(target.vala_header, str) else (target.name + '.h'))
args += ['-H', hname] args += ['-H', hname]
valac_outputs.append(hname) valac_outputs.append(hname)
# Outputted vapi file # Outputted vapi file
base_vapi = target.name + '.vapi' base_vapi = target.vala_vapi if isinstance(target.vala_vapi, str) else (target.name + '.vapi')
vapiname = os.path.join(self.get_target_dir(target), base_vapi) vapiname = os.path.join(self.get_target_dir(target), base_vapi)
# Force valac to write the vapi file in the target build dir. # Force valac to write the vapi file in the target build dir.
# Without this, it will write it inside c_out_dir # Without this, it will write it inside c_out_dir

@ -55,6 +55,8 @@ known_lib_kwargs.update({'version' : True, # Only for shared libs
'name_prefix' : True, 'name_prefix' : True,
'name_suffix' : True, 'name_suffix' : True,
'vs_module_defs' : True, # Only for shared libs 'vs_module_defs' : True, # Only for shared libs
'vala_header': True,
'vala_vapi': True,
'pic' : True, # Only for static libs 'pic' : True, # Only for static libs
}) })
@ -449,6 +451,9 @@ class BuildTarget():
if not isinstance(valalist, list): if not isinstance(valalist, list):
valalist = [valalist] valalist = [valalist]
self.add_compiler_args('vala', valalist) self.add_compiler_args('vala', valalist)
if not isinstance(self, Executable):
self.vala_header = kwargs.get('vala_header', None)
self.vala_vapi = kwargs.get('vala_vapi', None)
dlist = stringlistify(kwargs.get('d_args', [])) dlist = stringlistify(kwargs.get('d_args', []))
self.add_compiler_args('d', dlist) self.add_compiler_args('d', dlist)
self.link_args = kwargs.get('link_args', []) self.link_args = kwargs.get('link_args', [])

@ -0,0 +1,9 @@
project('valatest', 'c', 'vala')
glib = dependency('glib-2.0')
gobject = dependency('gobject-2.0')
library('foo-1.0', 'foo.vala',
vala_header: 'foo.h',
vala_vapi: 'foo.vapi',
dependencies: [glib, gobject])
Loading…
Cancel
Save