1# Test cxx descriptor functionality 2 3Import('env') 4 5base_env = env.Clone() 6base_env.Replace(NANOPBFLAGS = '--cpp-descriptor') 7base_env.NanopbProto('message') 8 9for std in ["c++03", "c++11", "c++14", "c++17", "c++20"]: 10 e = base_env.Clone() 11 e.Append(CXXFLAGS = '-std={}'.format(std)) 12 13 # Make sure compiler supports this version of C++ before we actually run the 14 # test. 15 conf = Configure(e) 16 compiler_valid = conf.CheckCXX() 17 e = conf.Finish() 18 if not compiler_valid: 19 print("Skipping {} test - compiler doesn't support it".format(std)) 20 continue 21 22 if std == 'c++03': 23 e.Append(CPPDEFINES = {'PB_C99_STATIC_ASSERT': 1}) 24 25 o1 = e.Object('message_descriptor_{}'.format(std), 'message_descriptor.cc') 26 o2 = e.Object('message.pb_{}'.format(std), 'message.pb.c') 27 p = e.Program([o1, o2, "$COMMON/pb_common.o"]) 28 e.RunTest(p) 29