• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Run the alltypes test case, but compile it as C++ instead.
2# In fact, compile the entire nanopb using C++ compiler.
3
4Import("env")
5
6# This is needed to get INT32_MIN etc. macros defined
7env = env.Clone()
8env.Append(CPPDEFINES = ['__STDC_LIMIT_MACROS'])
9
10# Copy the files to .cxx extension in order to force C++ build.
11c = Copy("$TARGET", "$SOURCE")
12env.Command("pb_encode.cxx", "#../pb_encode.c", c)
13env.Command("pb_decode.cxx", "#../pb_decode.c", c)
14env.Command("pb_common.cxx", "#../pb_common.c", c)
15env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c)
16env.Command("alltypes.pb.cxx", "$BUILD/alltypes/alltypes.pb.c", c)
17env.Command("encode_alltypes.cxx", "$BUILD/alltypes/encode_alltypes.c", c)
18env.Command("decode_alltypes.cxx", "$BUILD/alltypes/decode_alltypes.c", c)
19
20# Now build and run the test normally.
21enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx", "pb_common.cxx"])
22dec = env.Program(["decode_alltypes.cxx", "alltypes.pb.cxx", "pb_decode.cxx", "pb_common.cxx"])
23
24env.RunTest(enc)
25env.RunTest([dec, "encode_alltypes.output"])
26