Lines Matching full:env
10 myproto = env.NanopbProto("myproto")
13 env.Append(CPPPATH = "$NANOB")
14 myprog = env.Program(["myprog.c", myproto, "$NANOPB/pb_encode.c", "$NANOPB/pb_decode.c"])
22 env.SetDefault(NANOPB = "path/to/nanopb")
27 env.SetDefault(PROTOC = "path/to/protoc")
28 env.SetDefault(PROTOCFLAGS = "--plugin=protoc-gen-nanopb=path/to/protoc-gen-nanopb")
47 def _detect_nanopb(env): argument
49 if env.has_key('NANOPB'):
51 return env['NANOPB']
61 def _detect_python(env): argument
63 if env.has_key('PYTHON'):
64 return env['PYTHON']
66 p = env.WhereIs('python3')
68 return env['ESCAPE'](p)
70 p = env.WhereIs('py.exe')
72 return env['ESCAPE'](p) + " -3"
74 return env['ESCAPE'](sys.executable)
76 def _detect_nanopb_generator(env): argument
78 …generator_cmd = os.path.join(env['NANOPB'], 'generator-bin', 'nanopb_generator' + env['PROGSUFFIX'…
81 return env['ESCAPE'](generator_cmd)
84 …return env['PYTHON'] + " " + env['ESCAPE'](os.path.join(env['NANOPB'], 'generator', 'nanopb_genera…
86 def _detect_protoc(env): argument
88 if env.has_key('PROTOC'):
90 return env['PROTOC']
92 n = _detect_nanopb(env)
93 p1 = os.path.join(n, 'generator-bin', 'protoc' + env['PROGSUFFIX'])
96 return env['ESCAPE'](p1)
101 if env['PLATFORM'] == 'win32':
102 return env['ESCAPE'](p + '.bat')
104 return env['ESCAPE'](p)
106 p = env.WhereIs('protoc')
109 return env['ESCAPE'](p)
114 def _detect_protocflags(env): argument
116 if env.has_key('PROTOCFLAGS'):
117 return env['PROTOCFLAGS']
119 p = _detect_protoc(env)
120 n = _detect_nanopb(env)
121 p1 = os.path.join(n, 'generator', 'protoc' + env['PROGSUFFIX'])
122 p2 = os.path.join(n, 'generator-bin', 'protoc' + env['PROGSUFFIX'])
123 if p in [env['ESCAPE'](p1), env['ESCAPE'](p2)]:
127 e = env['ESCAPE']
128 if env['PLATFORM'] == 'win32':
133 def _nanopb_proto_actions(source, target, env, for_signature): argument
134 esc = env['ESCAPE']
140 for d in env['PROTOCPATH']:
141 d = env.GetBuildPath(d)
148 nanopb_flags = env['NANOPBFLAGS']
157 def _nanopb_proto_emitter(target, source, env): argument
186 def generate(env): argument
189 env['NANOPB'] = _detect_nanopb(env)
190 env['PROTOC'] = _detect_protoc(env)
191 env['PROTOCFLAGS'] = _detect_protocflags(env)
192 env['PYTHON'] = _detect_python(env)
193 env['NANOPB_GENERATOR'] = _detect_nanopb_generator(env)
194 env.SetDefault(NANOPBFLAGS = '')
196 env.SetDefault(PROTOCPATH = [".", os.path.join(env['NANOPB'], 'generator', 'proto')])
198 env.SetDefault(NANOPB_PROTO_CMD = '$PROTOC $PROTOCFLAGS --nanopb_out=$NANOPBFLAGS:. $SOURCES')
199 env['BUILDERS']['NanopbProto'] = _nanopb_proto_builder
200 env['BUILDERS']['NanopbProtoCpp'] = _nanopb_proto_cpp_builder
202 def exists(env): argument
203 return _detect_protoc(env) and _detect_protoc_opts(env)