- Source(init_file)
-
-def getFlags(source_flags):
- flagsMap = {}
- flagsList = []
- for s in source_flags:
- val = eval(s.get_contents())
- name, compound, desc = val
- flagsList.append(val)
- flagsMap[name] = bool(compound)
-
- for name, compound, desc in flagsList:
- for flag in compound:
- if flag not in flagsMap:
- raise AttributeError, "Trace flag %s not found" % flag
- if flagsMap[flag]:
- raise AttributeError, \
- "Compound flag can't point to another compound flag"
-
- flagsList.sort()
- return flagsList
-
-
-# Generate traceflags.py
-def traceFlagsPy(target, source, env):
- assert(len(target) == 1)
- code = code_formatter()
-
- allFlags = getFlags(source)
-
- code('basic = [')
- code.indent()
- for flag, compound, desc in allFlags:
- if not compound:
- code("'$flag',")
- code(']')
- code.dedent()
- code()
-
- code('compound = [')
- code.indent()
- code("'All',")
- for flag, compound, desc in allFlags:
- if compound:
- code("'$flag',")
- code("]")
- code.dedent()
- code()
-
- code("all = frozenset(basic + compound)")
- code()
-
- code('compoundMap = {')
- code.indent()
- all = tuple([flag for flag,compound,desc in allFlags if not compound])
- code("'All' : $all,")
- for flag, compound, desc in allFlags:
- if compound:
- code("'$flag' : $compound,")
- code('}')
- code.dedent()
- code()
-
- code('descriptions = {')
- code.indent()
- code("'All' : 'All flags',")
- for flag, compound, desc in allFlags:
- code("'$flag' : '$desc',")
- code("}")
- code.dedent()
+ Source(init_file, **swig.guards)
+
+# Build all protocol buffers if we have got protoc and protobuf available
+if env['HAVE_PROTOBUF']:
+ for proto in ProtoBuf.all:
+ # Use both the source and header as the target, and the .proto
+ # file as the source. When executing the protoc compiler, also
+ # specify the proto_path to avoid having the generated files
+ # include the path.
+ env.Command([proto.cc_file, proto.hh_file], proto.tnode,
+ MakeAction('$PROTOC --cpp_out ${TARGET.dir} '
+ '--proto_path ${SOURCE.dir} $SOURCE',
+ Transform("PROTOC")))
+
+ # Add the C++ source file
+ Source(proto.cc_file, **proto.guards)
+elif ProtoBuf.all:
+ print 'Got protobuf to build, but lacks support!'
+ Exit(1)