MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / generate_build_ninja

Function generate_build_ninja

tools/project.py:400–1355  ·  view source on GitHub ↗
(
    config: ProjectConfig,
    objects: Dict[str, Object],
    build_config: Optional[BuildConfig],
)

Source from the content-addressed store, hash-verified

398
399# Generate build.ninja
400def generate_build_ninja(
401 config: ProjectConfig,
402 objects: Dict[str, Object],
403 build_config: Optional[BuildConfig],
404) -> None:
405 out = io.StringIO()
406 n = ninja_syntax.Writer(out)
407 n.variable("ninja_required_version", "1.3")
408 n.newline()
409
410 configure_script = Path(os.path.relpath(os.path.abspath(sys.argv[0])))
411 python_lib = Path(os.path.relpath(__file__))
412 python_lib_dir = python_lib.parent
413 n.comment("The arguments passed to configure.py, for rerunning it.")
414 n.variable("configure_args", sys.argv[1:])
415 n.variable("python", f'"{sys.executable}"')
416 n.newline()
417
418 ###
419 # Variables
420 ###
421 n.comment("Variables")
422 n.variable("ldflags", make_flags_str(config.ldflags))
423 if config.linker_version is None:
424 sys.exit("ProjectConfig.linker_version missing")
425 n.variable("mw_version", Path(config.linker_version))
426 n.newline()
427
428 ###
429 # Tooling
430 ###
431 n.comment("Tooling")
432
433 build_path = config.out_path()
434 progress_path = build_path / "progress.json"
435 report_path = build_path / "report.json"
436 build_tools_path = config.build_dir / "tools"
437 download_tool = config.tools_dir / "download_tool.py"
438 n.rule(
439 name="download_tool",
440 command=f"$python {download_tool} $tool $out --tag $tag",
441 description="TOOL $out",
442 )
443
444 decompctx = config.tools_dir / "decompctx.py"
445 n.rule(
446 name="decompctx",
447 command=f"$python {decompctx} $in -o $out -d $out.d $includes",
448 description="CTX $in",
449 depfile="$out.d",
450 deps="gcc",
451 )
452
453 cargo_rule_written = False
454
455 def write_cargo_rule():
456 nonlocal cargo_rule_written
457 if not cargo_rule_written:

Callers 1

generate_buildFunction · 0.85

Calls 15

variableMethod · 0.95
newlineMethod · 0.95
commentMethod · 0.95
ruleMethod · 0.95
buildMethod · 0.95
defaultMethod · 0.95
make_flags_strFunction · 0.85
write_cargo_ruleFunction · 0.85
is_windowsFunction · 0.85
write_custom_stepFunction · 0.85
LinkStepClass · 0.85
add_unitFunction · 0.85

Tested by

no test coverage detected