aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-05-17 19:24:02 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-05-17 19:24:02 +0300
commit05b6220844577ef64079c9f4359b8df880d5d129 (patch)
treed93e7f4f6a64c9e53bbb2e2e84b8ca9f7e7584ed
parent9c6ae66211485da8bf434e35dcd8a7e1cd30f73c (diff)
downloadmeson-05b6220844577ef64079c9f4359b8df880d5d129.zip
meson-05b6220844577ef64079c9f4359b8df880d5d129.tar.gz
meson-05b6220844577ef64079c9f4359b8df880d5d129.tar.bz2
In Vala .vapi files are sort of headers that you must put on the command line. Make it so.
-rw-r--r--compilers.py4
-rw-r--r--ninjabackend.py17
2 files changed, 17 insertions, 4 deletions
diff --git a/compilers.py b/compilers.py
index 575bd62..6fe7370 100644
--- a/compilers.py
+++ b/compilers.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):
diff --git a/ninjabackend.py b/ninjabackend.py
index 1f63273..14feb3f 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -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