mirror of
https://github.com/google/pebble.git
synced 2025-03-19 10:31:21 +00:00
29 lines
858 B
Text
29 lines
858 B
Text
|
# Test cxx descriptor functionality
|
||
|
|
||
|
Import('env')
|
||
|
|
||
|
base_env = env.Clone()
|
||
|
base_env.Replace(NANOPBFLAGS = '--cpp-descriptor')
|
||
|
base_env.NanopbProto('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
|
||
|
|
||
|
if std == 'c++03':
|
||
|
e.Append(CPPDEFINES = {'PB_C99_STATIC_ASSERT': 1})
|
||
|
|
||
|
o1 = e.Object('message_descriptor_{}'.format(std), 'message_descriptor.cc')
|
||
|
o2 = e.Object('message.pb_{}'.format(std), 'message.pb.c')
|
||
|
p = e.Program([o1, o2])
|
||
|
e.RunTest(p)
|