diff --git a/backends.py b/backends.py index 1abfdc27c..56f0a93cb 100755 --- a/backends.py +++ b/backends.py @@ -535,6 +535,8 @@ class NinjaBackend(Backend): outfilename = os.path.join(self.get_target_private_dir(target), outfilelist[i]) args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', outfilename)\ for x in base_args] + args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", self.environment.get_build_dir()) + for x in args] cmdlist = [exe_file] + args elem = NinjaBuildElement(outfilename, 'CUSTOM_COMMAND', infilename) elem.add_item('DESC', 'Generating $out') diff --git a/test cases/frameworks/5 protocol buffers/defs.proto b/test cases/frameworks/5 protocol buffers/defs.proto new file mode 100644 index 000000000..f7956517c --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/defs.proto @@ -0,0 +1,3 @@ +message Dummy { + required string text = 1; +} diff --git a/test cases/frameworks/5 protocol buffers/main.cpp b/test cases/frameworks/5 protocol buffers/main.cpp new file mode 100644 index 000000000..9fdb20b57 --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/main.cpp @@ -0,0 +1,6 @@ +#include "defs.pb.h" + +int main(int argc, char **argv) { + Dummy d; + return 0; +} diff --git a/test cases/frameworks/5 protocol buffers/meson.build b/test cases/frameworks/5 protocol buffers/meson.build new file mode 100644 index 000000000..cf0005346 --- /dev/null +++ b/test cases/frameworks/5 protocol buffers/meson.build @@ -0,0 +1,14 @@ +project('protocol buffer test', 'cxx') + +protoc = find_program('protoc', required : true) +dep = find_dep('protobuf', required : true) + +gen = generator(protoc, \ + output_name : '@BASENAME@.pb.cc', + arguments : ['-I=@SOURCE_DIR@', '--cpp_out=@BUILD_DIR@', '@INPUT@']) + +generated = gen.process('defs.proto') +e = executable('prog', 'main.cpp', generated, + include_dirs: include_directories('.'), + dep : dep) +add_test('prototest', e)