MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / build

Method build

test/test_benchmark.py:248–284  ·  view source on GitHub ↗
(self, parent, filename, shared_args, emcc_args, native_args, native_exec, lib_builder)

Source from the content-addressed store, hash-verified

246 self.env.update(env)
247
248 def build(self, parent, filename, shared_args, emcc_args, native_args, native_exec, lib_builder):
249 emcc_args = emcc_args or []
250 self.filename = filename
251 llvm_root = self.env.get('LLVM') or config.LLVM_ROOT
252 if lib_builder:
253 env_init = self.env.copy()
254 # Note that we need to pass in all the flags here because some build
255 # systems (like zlib) if they see a CFLAGS it will override all their
256 # default flags, including optimizations.
257 env_init['CFLAGS'] = ' '.join(LLVM_FEATURE_FLAGS + [OPTIMIZATIONS] + self.cflags)
258 # Avoid mutating incoming emcc_args
259 emcc_args = emcc_args.copy()
260 emcc_args += lib_builder('js_' + llvm_root, native=False, env_init=env_init)
261 final = os.path.dirname(filename) + os.path.sep + self.name + ('_' if self.name else '') + os.path.basename(filename) + '.js'
262 final = final.replace('.cpp', '')
263 utils.delete_file(final)
264 cmd = [
265 EMCC, filename,
266 OPTIMIZATIONS,
267 '-sINITIAL_MEMORY=256MB',
268 '-sENVIRONMENT=node,shell',
269 '-o', final,
270 ] + LLVM_FEATURE_FLAGS
271 if shared_args:
272 cmd += shared_args
273 if PROFILING:
274 cmd += ['--profiling']
275 else:
276 cmd += ['--closure=1', '-sMINIMAL_RUNTIME']
277 # add additional emcc args at the end, which may override other things
278 # above, such as minimal runtime
279 cmd += emcc_args + self.cflags
280 if '-sFILESYSTEM' not in cmd and '-sFORCE_FILESYSTEM' not in cmd:
281 cmd += ['-sFILESYSTEM=0']
282 self.cmd = cmd
283 run_process(cmd, env=self.env)
284 self.filename = final
285
286 def run(self, args):
287 return jsrun.run_js(self.filename, engine=self.engine, args=args, stderr=subprocess.STDOUT)

Callers

nothing calls this directly

Calls 4

run_processFunction · 0.90
getMethod · 0.65
copyMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected