diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-17 19:30:11 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-17 20:17:49 +0100 |
commit | 00a9916668b57b7ace1ddba49be73a9356afdb1c (patch) | |
tree | 1b292a46074c3f41317f878cadf3efa73aa71ea0 | |
parent | 834e800f59995cc40bf0e044bdd1bff086555eab (diff) | |
download | gobject-introspection-00a9916668b57b7ace1ddba49be73a9356afdb1c.tar.gz |
meson: install everything.c/h like with autotools
This requires a code change in codegen.py to support the case whre output files
are not installed in the working directory. Instead of using the output
path for the header include use the relative path to the output source file.
-rw-r--r-- | giscanner/codegen.py | 5 | ||||
-rw-r--r-- | tests/meson.build | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/giscanner/codegen.py b/giscanner/codegen.py index ce07aaa1..138acf72 100644 --- a/giscanner/codegen.py +++ b/giscanner/codegen.py @@ -18,6 +18,7 @@ # Boston, MA 02111-1307, USA. # +import os from contextlib import contextmanager from . import ast @@ -142,7 +143,9 @@ class CCodeGenerator(object): for header in self.include_first_src: self.out_c.write("""#include "%s"\n""" % header) - self.out_c.write("""#include "%s"\n\n""" % (self.out_h_filename, )) + src_dir = os.path.dirname(os.path.realpath(self.out_c.name)) + header = os.path.relpath(self.out_h_filename, src_dir) + self.out_c.write("""#include "%s"\n\n""" % (header, )) for header in self.include_last_src: self.out_c.write("""#include "%s"\n""" % header) diff --git a/tests/meson.build b/tests/meson.build index 9ddf5ef1..7e633f29 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -23,7 +23,9 @@ installed_sources = [ 'gitestmacros.h', ] -install_data(installed_sources, install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0', 'tests')) +test_install_dir = join_paths(get_option('datadir'), 'gobject-introspection-1.0', 'tests') + +install_data(installed_sources, install_dir: test_install_dir) # Generate everything.h and everything.c: test_everything_files = custom_target('everything', @@ -36,7 +38,9 @@ test_everything_files = custom_target('everything', '--function-decoration=_GI_TEST_EXTERN', '--include-first-in-src=config.h', '--include-last-in-header=gitestmacros.h', - ] + ], + install: true, + install_dir: test_install_dir, ) test_everything_headers = [test_everything_files[0]] |