SConscript 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Run the alltypes test case, but compile with PB_NO_ERRMSG=1
  2. Import("env")
  3. # Take copy of the files for custom build.
  4. c = Copy("$TARGET", "$SOURCE")
  5. env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c)
  6. env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c)
  7. env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c)
  8. env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c)
  9. # Define the compilation options
  10. opts = env.Clone()
  11. opts.Append(CPPDEFINES = {'PB_NO_ERRMSG': 1})
  12. # Build new version of core
  13. strict = opts.Clone()
  14. strict.Append(CFLAGS = strict['CORECFLAGS'])
  15. strict.Object("pb_decode_noerr.o", "$NANOPB/pb_decode.c")
  16. strict.Object("pb_encode_noerr.o", "$NANOPB/pb_encode.c")
  17. strict.Object("pb_common_noerr.o", "$NANOPB/pb_common.c")
  18. # Now build and run the test normally.
  19. enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_noerr.o", "pb_common_noerr.o"])
  20. dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_noerr.o", "pb_common_noerr.o"])
  21. env.RunTest(enc)
  22. env.RunTest([dec, "encode_alltypes.output"])