Skip to content

Commit

Permalink
modbase/vanilla merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dallmeyer committed Dec 7, 2024
2 parents 9ecde92 + 4ff1a0a commit 3ad2f72
Show file tree
Hide file tree
Showing 1,035 changed files with 104,075 additions and 14,682 deletions.
37 changes: 37 additions & 0 deletions .github/scripts/releases/extract_mod_build_unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -e

DEST=${1}
BIN_SOURCE=${2}
SOURCE=${3}

mkdir -p $DEST

PREP_BIN="${PREP_BIN:-true}"

if [ "$PREP_BIN" = "true" ]; then
cp $BIN_SOURCE/game/gk $DEST
cp $BIN_SOURCE/goalc/goalc $DEST
cp $BIN_SOURCE/decompiler/extractor $DEST

chmod +x $DEST/gk
chmod +x $DEST/goalc
chmod +x $DEST/extractor
fi

mkdir -p $DEST/data
mkdir -p $DEST/data/launcher/
mkdir -p $DEST/data/decompiler/
mkdir -p $DEST/data/game
mkdir -p $DEST/data/log
mkdir -p $DEST/data/game/graphics/opengl_renderer/

cp -r $SOURCE/.github/scripts/releases/error-code-metadata.json $DEST/data/launcher/error-code-metadata.json
cp -r $SOURCE/decompiler/config $DEST/data/decompiler/
cp -r $SOURCE/goal_src $DEST/data
cp -r $SOURCE/game/assets $DEST/data/game/
cp -r $SOURCE/game/graphics/opengl_renderer/shaders $DEST/data/game/graphics/opengl_renderer
cp -r $SOURCE/custom_assets $DEST/data

python ./.github/scripts/releases/replace-mod-version-timestamp.py $DEST/data/goal_src
29 changes: 29 additions & 0 deletions .github/scripts/releases/extract_mod_build_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

DEST=${1}
BIN_SOURCE=${2}
SOURCE=${3}

mkdir -p $DEST

cp $BIN_SOURCE/gk.exe $DEST
cp $BIN_SOURCE/goalc.exe $DEST
cp $BIN_SOURCE/extractor.exe $DEST

mkdir -p $DEST/data
mkdir -p $DEST/data/launcher/
mkdir -p $DEST/data/decompiler/
mkdir -p $DEST/data/game
mkdir -p $DEST/data/log
mkdir -p $DEST/data/game/graphics/opengl_renderer/

cp -r $SOURCE/.github/scripts/releases/error-code-metadata.json $DEST/data/launcher/error-code-metadata.json
cp -r $SOURCE/decompiler/config $DEST/data/decompiler/
cp -r $SOURCE/goal_src $DEST/data
cp -r $SOURCE/game/assets $DEST/data/game/
cp -r $SOURCE/game/graphics/opengl_renderer/shaders $DEST/data/game/graphics/opengl_renderer
cp -r $SOURCE/custom_assets $DEST/data

python ./.github/scripts/releases/replace-mod-version-timestamp.py $DEST/data/goal_src
41 changes: 41 additions & 0 deletions .github/scripts/releases/replace-mod-version-timestamp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import datetime
import json
import os
import glob
import shutil
import tarfile
import urllib.request
import zipfile
import sys

def patch_mod_timestamp(goal_src_path):
try:
mod_settings_files = glob.glob(f"{goal_src_path}/**/mod-settings.gc", recursive=True)
for settings_file_path in mod_settings_files:
file = open(settings_file_path, "r")
file_data = file.read()
file.close()
# Check if the placeholder string is present in the file
if "%MODVERSIONPLACEHOLDER%" in file_data:
# Replace the placeholder string with the version and date string
version_str = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
file_data = file_data.replace("%MODVERSIONPLACEHOLDER%", version_str)
# Write the updated content back to the mod-settings
file = open(settings_file_path, "w")
file.write(file_data)
file.close()
print(
f"String %MODVERSIONPLACEHOLDER% replaced with '{version_str}' in the file."
)
else:
print(f"Couldn't find %MODVERSIONPLACEHOLDER% in the file.")
except Exception as e:
print(
f"Something went wrong trying to replace placeholder text with mod version info:"
)
print(e)

if len(sys.argv) > 1:
patch_mod_timestamp(sys.argv[1])
else:
print(f"No goal_src path provided to replace-mod-version-timestamp")
27 changes: 0 additions & 27 deletions .github/workflows/linux-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,6 @@ jobs:
- name: Checkout Repository
if: ${{ ! inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/macos-build-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
build:
name: ARM
runs-on: macos-12
runs-on: macos-15
timeout-minutes: 120

steps:
Expand All @@ -23,18 +23,15 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Set up ARM64 environment
run: sudo softwareupdate --install-rosetta --agree-to-license

- name: Install Package Dependencies
run: arch -arm64 brew install cmake ninja
run: brew install cmake ninja nasm

- name: Setup sccache
uses: hendrikmuhs/[email protected]
with:
variant: sccache
key: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}-${{ github.sha }}
restore-keys: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
key: macos-15-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}-${{ github.sha }}
restore-keys: macos-15-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
max-size: 1000M

- name: CMake Generation
Expand All @@ -55,7 +52,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengoal-macos-${{ inputs.cachePrefix }}
name: opengoal-macos-arm-${{ inputs.cachePrefix }}
if-no-files-found: error
path: |
./build/goalc/goalc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/macos-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
build:
name: Intel
runs-on: macos-12
runs-on: macos-13
timeout-minutes: 120

steps:
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
variant: sccache
key: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}-${{ github.sha }}
restore-keys: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
key: macos-13-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}-${{ github.sha }}
restore-keys: macos-13-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
max-size: 1000M

- name: CMake Generation
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/mod-release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ jobs:
run: |
mkdir -p ./ci-artifacts/windows
mkdir -p ${{ inputs.outputDir }}/dist
chmod +x ./.github/scripts/releases/extract_build_windows.sh
./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/windows ./ci-artifacts/opengoal-windows-static ./
chmod +x ./.github/scripts/releases/extract_mod_build_windows.sh
./.github/scripts/releases/extract_mod_build_windows.sh ./ci-artifacts/windows ./ci-artifacts/opengoal-windows-static ./
TAG_VAL=${{ needs.create_release.outputs.bundleTagName }}
7z a -tzip ${{ inputs.outputDir }}/dist/windows-${TAG_VAL}.zip ./ci-artifacts/windows/*
Expand Down Expand Up @@ -206,8 +206,8 @@ jobs:
run: |
mkdir -p ./ci-artifacts/linux
mkdir -p ${{ inputs.outputDir }}/dist
chmod +x ./.github/scripts/releases/extract_build_unix.sh
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/linux ./ci-artifacts/opengoal-linux-static ./
chmod +x ./.github/scripts/releases/extract_mod_build_unix.sh
./.github/scripts/releases/extract_mod_build_unix.sh ./ci-artifacts/linux ./ci-artifacts/opengoal-linux-static ./
pushd ci-artifacts/linux
TAG_VAL=${{ needs.create_release.outputs.bundleTagName }}
tar czf ../../${{ inputs.outputDir }}/dist/linux-${TAG_VAL}.tar.gz .
Expand All @@ -227,7 +227,7 @@ jobs:
# assumes that this file is defined in your mod repo
uses: ./.github/workflows/macos-build.yaml
with:
cmakePreset: "Release-macos-clang-static"
cmakePreset: "Release-macos-x86_64-clang-static"
cachePrefix: "static"
uploadArtifacts: true
secrets: inherit
Expand Down Expand Up @@ -262,8 +262,8 @@ jobs:
run: |
mkdir -p ./ci-artifacts/macos-intel
mkdir -p ${{ inputs.outputDir }}/dist
chmod +x ./.github/scripts/releases/extract_build_unix.sh
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos-intel ./ci-artifacts/opengoal-macos-static ./
chmod +x ./.github/scripts/releases/extract_mod_build_unix.sh
./.github/scripts/releases/extract_mod_build_unix.sh ./ci-artifacts/macos-intel ./ci-artifacts/opengoal-macos-static ./
pushd ci-artifacts/macos-intel
TAG_VAL=${{ needs.create_release.outputs.bundleTagName }}
tar czf ../../${{ inputs.outputDir }}/dist/macos-intel-${TAG_VAL}.tar.gz .
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,30 @@ jobs:
name: "🍎 MacOS"
uses: ./.github/workflows/macos-build.yaml
with:
cmakePreset: "Release-macos-clang-static"
cmakePreset: "Release-macos-x86_64-clang-static"
cachePrefix: "static"
uploadArtifacts: true
secrets: inherit

build_macos_arm:
needs:
- cut_release
name: "🍎 MacOS"
uses: ./.github/workflows/macos-build.yaml
with:
cmakePreset: "Release-macos-x86_64-clang-static"
cachePrefix: "static-arm"
uploadArtifacts: true
secrets: inherit

# Upload the Artifacts
upload_artifacts:
needs:
- cut_release
- build_windows_clang
- build_linux_clang
- build_macos_intel
- build_macos_arm
name: "Upload Artifacts"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -124,7 +136,7 @@ jobs:
7z a -tzip ./ci-artifacts/final/opengoal-windows-${TAG_VAL}.zip ./ci-artifacts/windows/*
cp ./ci-artifacts/opengoal-windows-static/lsp.exe ./ci-artifacts/final/opengoal-lsp-windows-${TAG_VAL}.exe
- name: Prepare macOS Build Assets
- name: Prepare Intel macOS Build Assets
run: |
mkdir -p ./ci-artifacts/macos
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos ./ci-artifacts/opengoal-macos-static ./
Expand All @@ -135,6 +147,17 @@ jobs:
chmod +x ./ci-artifacts/opengoal-macos-static/lsp/lsp
cp ./ci-artifacts/opengoal-macos-static/lsp/lsp ./ci-artifacts/final/opengoal-lsp-macos-intel-${TAG_VAL}.bin
- name: Prepare ARM macOS Build Assets
run: |
mkdir -p ./ci-artifacts/macos-arm
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos-arm ./ci-artifacts/opengoal-macos-static-arm ./
pushd ci-artifacts/macos-arm
TAG_VAL=${{ needs.cut_release.outputs.new_tag }}
tar czf ../final/opengoal-macos-arm-${TAG_VAL}.tar.gz .
popd
chmod +x ./ci-artifacts/opengoal-macos-static-arm/lsp/lsp
cp ./ci-artifacts/opengoal-macos-static-arm/lsp/lsp ./ci-artifacts/final/opengoal-lsp-macos-arm-${TAG_VAL}.bin
- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/windows-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@ jobs:
- name: Checkout Repository
if: ${{ ! inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
if: ${{ inputs.uploadArtifacts }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

# full checkout with tags if we ARE uploading artifacts
- name: Checkout Repository with Tags
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
cmake_minimum_required(VERSION 3.12)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(jak)
include(CTest)

Expand Down Expand Up @@ -44,6 +45,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-Wall \
-Wno-c++11-narrowing \
-Wno-c++98-compat \
-Wno-deprecated-this-capture \
-Wno-missing-field-initializers \
-Wno-sign-compare \
-Wno-ignored-qualifiers \
-O3 \
-D_CRT_SECURE_NO_WARNINGS")

Expand All @@ -53,7 +58,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Note: this is only _reserved_ memory, not necessarily _committed_ memory
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LDFLAGS} -Xlinker /STACK:16000000")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -g -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -g")
endif()

# additional c++ and linker flags for release mode for our projects
Expand Down
Loading

0 comments on commit 3ad2f72

Please sign in to comment.