In Vala .vapi files are sort of headers that you must put on the command line. Make it so.

pull/122/head
Jussi Pakkanen 10 years ago
parent 9c6ae66211
commit 05b6220844
  1. 4
      compilers.py
  2. 17
      ninjabackend.py

@ -21,7 +21,7 @@ from coredata import MesonException
about. To support a new compiler, add its information below.
Also add corresponding autodetection code in environment.py."""
header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H', 'moc']
header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H', 'moc', 'vapi']
cpp_suffixes = ['cc', 'cpp', 'cxx', 'h', 'hh', 'hpp', 'hxx', 'c++']
c_suffixes = ['c']
clike_suffixes = c_suffixes + cpp_suffixes
@ -813,7 +813,7 @@ class ValaCompiler():
raise EnvironmentException('Vala compiler %s can not compile programs.' % self.name_string())
def can_compile(self, fname):
return fname.endswith('.vala')
return fname.endswith('.vala') or fname.endswith('.vapi')
class RustCompiler():
def __init__(self, exelist, version):

@ -673,12 +673,24 @@ class NinjaBackend(backends.Backend):
fastvapis[s] = (vapibase, rel_vapi)
return fastvapis
def split_vala_sources(self, sources):
src = []
vapi_src = []
for s in sources:
if s.endswith('.vapi'):
vapi_src.append(s)
else:
src.append(s)
return (src, vapi_src)
def generate_vala_compile(self, target, outfile):
"""Vala is compiled into C. Set up all necessary build steps here."""
valac = self.environment.coredata.compilers['vala']
fast_vapis = self.generate_fastvapi_compile(target, valac, outfile)
generated_c = []
for s in target.get_sources():
(src, vapi_src) = self.split_vala_sources(target.get_sources())
vapi_src = [x.rel_to_builddir(self.build_to_src) for x in vapi_src]
for s in src:
if not s.endswith('.vala'):
continue
args = ['-d', self.get_target_private_dir(target)]
@ -699,6 +711,7 @@ class NinjaBackend(backends.Backend):
for d in target.external_deps:
if isinstance(d, dependencies.PkgConfigDependency):
args += ['--pkg', d.name]
args += vapi_src
generated_c += [relsc]
element = NinjaBuildElement(relsc, valac.get_language() + '_COMPILER', rel_s)
element.add_item('ARGS', args)
@ -1109,7 +1122,7 @@ rule FORTRAN_DEP_HACK
if isinstance(src, File):
rel_src = src.rel_to_builddir(self.build_to_src)
else:
raise build.InvaliArguments('Invalid source type.')
raise build.InvalidArguments('Invalid source type.')
abs_src = os.path.join(self.environment.get_build_dir(), rel_src)
if isinstance(src, RawFilename):
src_filename = src.fname

Loading…
Cancel
Save