Skip to content

Commit

Permalink
Sync with latest dtk-template
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Jun 24, 2024
1 parent 530b454 commit 28f16a7
Show file tree
Hide file tree
Showing 10 changed files with 795 additions and 491 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,52 @@ on:

jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/primedecomp/build:main

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [GM8E01_00] # GM8E01_01, GM8E01_48

steps:
# Checkout the repository (shallow clone)
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

# Copy the original files to the workspace
- name: Prepare
run: cp -R /orig .

# Build the project
- name: Build
run: |
python configure.py --map --version ${{matrix.version}} --compilers /compilers
ninja all_source build/${{matrix.version}}/progress.json
python configure.py --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
ninja all_source build/${{ matrix.version }}/progress.json
# Upload progress if we're on the main branch
- name: Upload progress
if: github.ref == 'refs/heads/main' && matrix.version == 'GM8E01_00'
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
PROGRESS_API_KEY: ${{secrets.PROGRESS_API_KEY}}
PROGRESS_SLUG: prime
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
python tools/upload_progress.py -b https://progress.decomp.club/ -p prime -v ${{matrix.version}} \
build/${{matrix.version}}/progress.json
python tools/upload_progress.py -b https://progress.decomp.club/ \
-p $PROGRESS_SLUG -v ${{ matrix.version }} \
build/${{ matrix.version }}/progress.json
# Upload map files
- name: Upload map
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{matrix.version}}_maps
path: build/${{matrix.version}}/**/*.MAP
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
],
"C/C++ Include Guard.Auto Update Path Blocklist": [
"include/zlib"
]
],
"cmake.configureOnOpen": false
}
102 changes: 66 additions & 36 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# Append --help to see available options.
###

import sys
import argparse

import sys
from pathlib import Path
from typing import Any, Dict, List

from tools.project import (
Object,
ProjectConfig,
Expand All @@ -38,104 +39,127 @@
# "R3MP01_00", # mp-v3.629 Trilogy PAL
]

if len(VERSIONS) > 1:
versions_str = ", ".join(VERSIONS[:-1]) + f" or {VERSIONS[-1]}"
else:
versions_str = VERSIONS[0]

parser = argparse.ArgumentParser()
parser.add_argument(
"mode",
choices=["configure", "progress"],
default="configure",
help="configure or progress (default: configure)",
help="script mode (default: configure)",
nargs="?",
)
parser.add_argument(
"-v",
"--version",
dest="version",
choices=VERSIONS,
type=str.upper,
default=VERSIONS[DEFAULT_VERSION],
help=f"version to build ({versions_str})",
help="version to build",
)
parser.add_argument(
"--build-dir",
dest="build_dir",
metavar="DIR",
type=Path,
default=Path("build"),
help="base build directory (default: build)",
)
parser.add_argument(
"--binutils",
metavar="BINARY",
type=Path,
help="path to binutils (optional)",
)
parser.add_argument(
"--compilers",
dest="compilers",
metavar="DIR",
type=Path,
help="path to compilers (optional)",
)
parser.add_argument(
"--map",
dest="map",
action="store_true",
help="generate map file(s)",
)
parser.add_argument(
"--no-asm",
action="store_true",
help="don't incorporate .s files from asm directory",
)
parser.add_argument(
"--debug",
dest="debug",
action="store_true",
help="build with debug info (non-matching)",
)
if not is_windows():
parser.add_argument(
"--wrapper",
dest="wrapper",
metavar="BINARY",
type=Path,
help="path to wibo or wine (optional)",
)
parser.add_argument(
"--build-dtk",
dest="build_dtk",
"--dtk",
metavar="BINARY | DIR",
type=Path,
help="path to decomp-toolkit source (optional)",
help="path to decomp-toolkit binary or source (optional)",
)
parser.add_argument(
"--sjiswrap",
dest="sjiswrap",
metavar="EXE",
type=Path,
help="path to sjiswrap.exe (optional)",
)
parser.add_argument(
"--verbose",
dest="verbose",
action="store_true",
help="print verbose output",
)
parser.add_argument(
"--non-matching",
dest="non_matching",
action="store_true",
help="builds equivalent (but non-matching) or modded objects",
)
args = parser.parse_args()

config = ProjectConfig()
config.version = args.version
if config.version not in VERSIONS:
sys.exit(f"Invalid version '{config.version}', expected {versions_str}")
config.version = str(args.version)
version_num = VERSIONS.index(config.version)

# Apply arguments
config.build_dir = args.build_dir
config.build_dtk_path = args.build_dtk
config.dtk_path = args.dtk
config.binutils_path = args.binutils
config.compilers_path = args.compilers
config.debug = args.debug
config.generate_map = args.map
config.non_matching = args.non_matching
config.sjiswrap_path = args.sjiswrap
if not is_windows():
config.wrapper = args.wrapper
if args.no_asm:
config.asm_dir = None

# Tool versions
config.binutils_tag = "2.42-1"
config.compilers_tag = "20231018"
config.dtk_tag = "v0.7.6"
config.dtk_tag = "v0.9.2"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.9"
config.wibo_tag = "0.6.11"

# Project
config.config_path = Path("config") / config.version / "config.yml"
config.check_sha_path = Path("config") / config.version / "build.sha1"
config.asflags = [
"-mgekko",
"--strip-local-absolute",
"-I include",
f"-I build/{config.version}/include",
f"--defsym version={version_num}",
]
config.ldflags = [
"-fp hardware",
"-nodefaults",
"-warn off",
]

config.progress_all = False
Expand All @@ -151,24 +175,29 @@
# Base flags, common to most GC/Wii games.
# Generally leave untouched, with overrides added below.
cflags_base = [
"-proc gekko",
"-nodefaults",
"-proc gekko",
"-align powerpc",
"-enum int",
"-fp hardware",
"-Cpp_exceptions off",
"-RTTI off",
"-fp hard",
"-fp_contract on",
# "-W all",
"-O4,p",
"-maxerrors 1",
"-enum int",
"-inline auto",
"-str reuse",
'-pragma "cats off"',
'-pragma "warn_notinlined off"',
"-maxerrors 1",
"-nosyspath",
"-RTTI off",
"-fp_contract on",
"-str reuse",
"-multibyte",
"-i include",
"-i extern/musyx/include",
"-i libc",
f"-i build/{config.version}/include",
"-DPRIME1",
f"-DVERSION={version_num}",
"-DPRIME1",
"-DNONMATCHING=0",
]

Expand Down Expand Up @@ -298,8 +327,9 @@ def Rel(lib_name, objects):
}


Matching = True
NonMatching = False
Matching = True # Object matches and should be linked
NonMatching = False # Object does not match and should not be linked
Equivalent = config.non_matching # Object should be linked when configured with --non-matching

config.warn_missing_config = True
config.warn_missing_source = False
Expand Down
44 changes: 0 additions & 44 deletions ldscript.lcf

This file was deleted.

Loading

0 comments on commit 28f16a7

Please sign in to comment.