xref: /aosp_15_r20/external/nanopb-c/tests/encode_arrays_unpacked/SConscript (revision c8d645cafcee3f91213d30caa0fe303887010b9b)
1*c8d645caSAndroid Build Coastguard Worker# Run the alltypes test case, but compile with PB_ENCODE_ARRAYS_UNPACKED=1
2*c8d645caSAndroid Build Coastguard Worker
3*c8d645caSAndroid Build Coastguard WorkerImport("env")
4*c8d645caSAndroid Build Coastguard Worker
5*c8d645caSAndroid Build Coastguard Worker# Take copy of the files for custom build.
6*c8d645caSAndroid Build Coastguard Workerc = Copy("$TARGET", "$SOURCE")
7*c8d645caSAndroid Build Coastguard Workerenv.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c)
8*c8d645caSAndroid Build Coastguard Workerenv.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c)
9*c8d645caSAndroid Build Coastguard Workerenv.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
10*c8d645caSAndroid Build Coastguard Workerenv.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
11*c8d645caSAndroid Build Coastguard Worker
12*c8d645caSAndroid Build Coastguard Worker# Define the compilation options
13*c8d645caSAndroid Build Coastguard Workeropts = env.Clone()
14*c8d645caSAndroid Build Coastguard Workeropts.Append(CPPDEFINES = {'PB_ENCODE_ARRAYS_UNPACKED': 1})
15*c8d645caSAndroid Build Coastguard Worker
16*c8d645caSAndroid Build Coastguard Worker# Build new version of core
17*c8d645caSAndroid Build Coastguard Workerstrict = opts.Clone()
18*c8d645caSAndroid Build Coastguard Workerstrict.Append(CFLAGS = strict['CORECFLAGS'])
19*c8d645caSAndroid Build Coastguard Workerstrict.Object("pb_decode_unpacked.o", "$NANOPB/pb_decode.c")
20*c8d645caSAndroid Build Coastguard Workerstrict.Object("pb_encode_unpacked.o", "$NANOPB/pb_encode.c")
21*c8d645caSAndroid Build Coastguard Workerstrict.Object("pb_common_unpacked.o", "$NANOPB/pb_common.c")
22*c8d645caSAndroid Build Coastguard Worker
23*c8d645caSAndroid Build Coastguard Worker# Now build and run the test normally.
24*c8d645caSAndroid Build Coastguard Workerenc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_unpacked.o", "pb_common_unpacked.o"])
25*c8d645caSAndroid Build Coastguard Workerdec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_unpacked.o", "pb_common_unpacked.o"])
26*c8d645caSAndroid Build Coastguard Worker
27*c8d645caSAndroid Build Coastguard Workerenv.RunTest(enc)
28*c8d645caSAndroid Build Coastguard Workerenv.RunTest([dec, "encode_alltypes.output"])
29