mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 08:52:40 +01:00
move ninja build.py to ./configure.py & auto-splat
This commit is contained in:
parent
e70b3b814f
commit
84b6ae8152
22
tools/build/build.py → configure.py
Normal file → Executable file
22
tools/build/build.py → configure.py
Normal file → Executable file
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os, sys
|
import os, sys
|
||||||
from glob import glob
|
from glob import glob
|
||||||
@ -6,8 +8,8 @@ from argparse import ArgumentParser
|
|||||||
import asyncio
|
import asyncio
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
|
|
||||||
tools_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
sys.path.append(os.path.dirname(__file__) + "/tools/n64splat")
|
||||||
sys.path.append(tools_dir + "/n64splat")
|
import split
|
||||||
|
|
||||||
INCLUDE_ASM_RE = re.compile(r"_INCLUDE_ASM\([^,]+, ([^,]+), ([^,)]+)") # note _ prefix
|
INCLUDE_ASM_RE = re.compile(r"_INCLUDE_ASM\([^,]+, ([^,]+), ([^,)]+)") # note _ prefix
|
||||||
CPPFLAGS = "-Iinclude -Isrc -D _LANGUAGE_C -D _FINALROM -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32"
|
CPPFLAGS = "-Iinclude -Isrc -D _LANGUAGE_C -D _FINALROM -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32"
|
||||||
@ -20,9 +22,6 @@ def obj(path: str):
|
|||||||
def read_splat(splat_config: str):
|
def read_splat(splat_config: str):
|
||||||
import argparse
|
import argparse
|
||||||
import yaml
|
import yaml
|
||||||
from pathlib import PurePath
|
|
||||||
|
|
||||||
from split import initialize_segments
|
|
||||||
|
|
||||||
# Load config
|
# Load config
|
||||||
with open(splat_config) as f:
|
with open(splat_config) as f:
|
||||||
@ -32,7 +31,7 @@ def read_splat(splat_config: str):
|
|||||||
assert options.get("ld_o_replace_extension", True) == False
|
assert options.get("ld_o_replace_extension", True) == False
|
||||||
|
|
||||||
# Initialize segments
|
# Initialize segments
|
||||||
all_segments = initialize_segments(options, splat_config, config["segments"])
|
all_segments = split.initialize_segments(options, splat_config, config["segments"])
|
||||||
|
|
||||||
objects = set()
|
objects = set()
|
||||||
segments = {}
|
segments = {}
|
||||||
@ -121,6 +120,17 @@ async def main():
|
|||||||
cpp = args.cpp or "cpp"
|
cpp = args.cpp or "cpp"
|
||||||
task_sem = asyncio.Semaphore(8)
|
task_sem = asyncio.Semaphore(8)
|
||||||
|
|
||||||
|
# split assets
|
||||||
|
split.main(
|
||||||
|
"baserom.z64",
|
||||||
|
"tools/splat.yaml",
|
||||||
|
".",
|
||||||
|
[ "ld", "bin", "Yay0", "PaperMarioMapFS", "PaperMarioMessages", "img", "PaperMarioNpcSprites" ],
|
||||||
|
False,
|
||||||
|
False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# generate build.ninja
|
||||||
n = ninja_syntax.Writer(open("build.ninja", "w"), width=120)
|
n = ninja_syntax.Writer(open("build.ninja", "w"), width=120)
|
||||||
|
|
||||||
n.variable("builddir", "build")
|
n.variable("builddir", "build")
|
Loading…
Reference in New Issue
Block a user