blob: bd6fa63b089dedc70bf72e860de9b744ca7f4681 [file] [log] [blame]
Import('env')
import os
base_env = env.Clone()
base_env.Replace(NANOPBFLAGS = '--cpp-descriptor')
base_env.NanopbProtoCpp('message')
for std in ["c++03", "c++11", "c++14", "c++17", "c++20"]:
e = base_env.Clone()
e.Append(CXXFLAGS = '-std={}'.format(std))
# Make sure compiler supports this version of C++ before we actually run the
# test.
conf = Configure(e)
compiler_valid = conf.CheckCXX()
e = conf.Finish()
if not compiler_valid:
print("Skipping {} test - compiler doesn't support it".format(std))
continue
sources = [ 'cxx_callback_datatype.cpp', 'message.pb.cpp', '$NANOPB/pb_decode.c', '$NANOPB/pb_encode.c', '$NANOPB/pb_common.c' ]
objects = [ e.Object('{}_{}'.format(os.path.basename(s), std), s) for s in sources ]
p = e.Program(target = 'cxx_callback_datatype_{}'.format(std), source = objects)
e.RunTest(p)