1 # Version of AllTypes test case for protobuf 3 file format.
7 if 'PROTOC_VERSION' in env:
8 match = re.search('([0-9]+).([0-9]+).([0-9]+)', env['PROTOC_VERSION'])
11 version = map(int, match.groups())
13 # proto3 syntax is supported by protoc >= 3.0.0
14 if env.GetOption('clean') or (match and version[0] >= 3):
16 env.NanopbProto(["alltypes", "alltypes.options"])
18 # Define the compilation options
20 opts.Append(CPPDEFINES = {'PB_FIELD_16BIT': 1})
22 # Build new version of core
24 strict.Append(CFLAGS = strict['CORECFLAGS'])
25 strict.Object("pb_decode_fields16.o", "$NANOPB/pb_decode.c")
26 strict.Object("pb_encode_fields16.o", "$NANOPB/pb_encode.c")
27 strict.Object("pb_common_fields16.o", "$NANOPB/pb_common.c")
29 # Now build and run the test normally.
30 enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields16.o", "pb_common_fields16.o"])
31 dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields16.o", "pb_common_fields16.o"])
34 env.RunTest([dec, "encode_alltypes.output"])