SConscript 1.1 KB

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