Worked on expanding the generator so it works with protocol buffers. Does not work yet.
This commit is contained in:
parent
292ad6009c
commit
c9cb49764b
|
@ -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')
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
message Dummy {
|
||||
required string text = 1;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#include "defs.pb.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
Dummy d;
|
||||
return 0;
|
||||
}
|
|
@ -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)
|
Loading…
Reference in New Issue