mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-09-24 09:03:44 +00:00
fix: goldmapper on ci
This commit is contained in:
@@ -3,7 +3,37 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-goldmapper:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: install mingw toolchain
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
- name: build GoldMapper
|
||||
run: pnpm goldmapper
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: goldmapper
|
||||
path: |
|
||||
src-tauri/resources/GoldMapperLib.dll
|
||||
src-tauri/resources/GoldMapperLauncher.exe
|
||||
src-tauri/resources/SDL2.dll
|
||||
|
||||
build-tauri:
|
||||
needs: [build-goldmapper]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -27,10 +57,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: build GoldMapper
|
||||
shell: bash
|
||||
run: pnpm goldmapper
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
run: |
|
||||
@@ -47,6 +73,12 @@ jobs:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
|
||||
- name: download GoldMapper
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: goldmapper
|
||||
path: src-tauri/resources
|
||||
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
||||
@@ -17,8 +17,37 @@ jobs:
|
||||
cat RELEASE_NOTES.md >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build-goldmapper:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: install mingw toolchain
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
- name: build GoldMapper
|
||||
run: pnpm goldmapper
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: goldmapper
|
||||
path: |
|
||||
src-tauri/resources/GoldMapperLib.dll
|
||||
src-tauri/resources/GoldMapperLauncher.exe
|
||||
src-tauri/resources/SDL2.dll
|
||||
|
||||
publish-tauri:
|
||||
needs: get-version
|
||||
needs: [get-version, build-goldmapper]
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
@@ -40,10 +69,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: build GoldMapper
|
||||
shell: bash
|
||||
run: pnpm goldmapper
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
run: |
|
||||
@@ -60,6 +85,12 @@ jobs:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
|
||||
- name: download GoldMapper
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: goldmapper
|
||||
path: src-tauri/resources
|
||||
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
"post-build:macos": "bash src-tauri/scripts/post-build-macos.sh",
|
||||
"android:assets": "node scripts/download-android-assets.mjs",
|
||||
"flatpak": "flatpak-builder --user --install-deps-from=flathub --repo=emerald-repo --force-clean build-flatpak flatpak/io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.yml && flatpak build-bundle emerald-repo emerald.flatpak io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher",
|
||||
"goldmapper": "bash scripts/build-goldmapper.sh"
|
||||
"goldmapper": "node scripts/build-goldmapper.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2",
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { existsSync, copyFileSync, mkdirSync, readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT_DIR = path.resolve(SCRIPT_DIR, "..");
|
||||
const GOLDMAPPER_DIR = path.join(ROOT_DIR, "GoldMapper");
|
||||
const BUILD_DIR = path.join(GOLDMAPPER_DIR, "build");
|
||||
const RESOURCES_DIR = path.join(ROOT_DIR, "src-tauri", "resources");
|
||||
const TOOLCHAIN_MINGW = path.join(SCRIPT_DIR, "toolchain-mingw.cmake");
|
||||
const IS_WINDOWS = process.platform === "win32";
|
||||
function run(cmd, args, cwd) {
|
||||
console.log(`> ${cmd} ${args.join(" ")}`);
|
||||
const res = spawnSync(cmd, args, {
|
||||
cwd,
|
||||
stdio: "inherit",
|
||||
shell: IS_WINDOWS,
|
||||
});
|
||||
if (res.status !== 0) {
|
||||
process.exit(res.status ?? 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!existsSync(
|
||||
path.join(GOLDMAPPER_DIR, "third_party", "minhook", "include", "MinHook.h"),
|
||||
)
|
||||
) {
|
||||
console.log("Initializing minhook submodule...");
|
||||
run(
|
||||
"git",
|
||||
["-C", GOLDMAPPER_DIR, "submodule", "update", "--init", "--recursive"],
|
||||
ROOT_DIR,
|
||||
);
|
||||
}
|
||||
|
||||
console.log("Configuring GoldMapper...");
|
||||
const configureArgs = ["-B", BUILD_DIR, "-DCMAKE_BUILD_TYPE=Release"];
|
||||
if (!IS_WINDOWS) {
|
||||
configureArgs.push("-DCMAKE_TOOLCHAIN_FILE=" + TOOLCHAIN_MINGW);
|
||||
}
|
||||
configureArgs.push(GOLDMAPPER_DIR);
|
||||
run("cmake", configureArgs, ROOT_DIR);
|
||||
console.log("Building GoldMapper...");
|
||||
run("cmake", ["--build", BUILD_DIR, "--config", "Release"], ROOT_DIR);
|
||||
console.log("Copying binaries to resources...");
|
||||
mkdirSync(RESOURCES_DIR, { recursive: true });
|
||||
const outputs = [
|
||||
{
|
||||
source: "GoldMapperLib.dll",
|
||||
names: ["GoldMapperLib.dll", "libGoldMapperLib.dll"], //neo: dont ask me vro idk why it does that
|
||||
},
|
||||
{ source: "GoldMapperLauncher.exe", names: ["GoldMapperLauncher.exe"] },
|
||||
{
|
||||
source: "SDL2.dll",
|
||||
names: ["SDL2.dll"],
|
||||
dir: path.join(GOLDMAPPER_DIR, "third_party", "SDL2-2.32.6", "lib", "x64"),
|
||||
},
|
||||
];
|
||||
|
||||
for (const entry of outputs) {
|
||||
const dir = entry.dir ?? BUILD_DIR;
|
||||
const file = path.join(dir, entry.source);
|
||||
if (existsSync(file)) {
|
||||
copyFileSync(file, path.join(RESOURCES_DIR, entry.source));
|
||||
continue;
|
||||
}
|
||||
const candidate = readdirSync(dir).find((f) =>
|
||||
entry.names.some((n) => f.toLowerCase() === n.toLowerCase()),
|
||||
);
|
||||
if (!candidate) {
|
||||
console.error(`Missing build output: ${entry.source}`);
|
||||
process.exit(1);
|
||||
}
|
||||
copyFileSync(
|
||||
path.join(dir, candidate),
|
||||
path.join(RESOURCES_DIR, entry.source),
|
||||
);
|
||||
}
|
||||
|
||||
console.log("GoldMapper build complete.");
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
GOLDMAPPER_DIR="$ROOT_DIR/GoldMapper"
|
||||
BUILD_DIR="$GOLDMAPPER_DIR/build"
|
||||
RESOURCES_DIR="$ROOT_DIR/src-tauri/resources"
|
||||
|
||||
if ! command -v xwin &> /dev/null; then
|
||||
echo "Installing xwin..."
|
||||
cargo install xwin
|
||||
fi
|
||||
|
||||
if [ ! -d "$HOME/.cache/xwin/splat" ]; then
|
||||
echo "Downloading Windows SDK and CRT..."
|
||||
xwin --accept-license 16299.309000601.3633040603 splat --output "$HOME/.cache/xwin/splat"
|
||||
fi
|
||||
|
||||
if [ ! -f "$GOLDMAPPER_DIR/third_party/minhook/include/MinHook.h" ]; then
|
||||
echo "Initializing minhook submodule..."
|
||||
git -C "$GOLDMAPPER_DIR" submodule update --init --recursive
|
||||
fi
|
||||
|
||||
echo "Configuring GoldMapper..."
|
||||
cmake -B "$BUILD_DIR" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$GOLDMAPPER_DIR/toolchain-xwin.cmake" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
"$GOLDMAPPER_DIR"
|
||||
|
||||
echo "Building GoldMapper..."
|
||||
cmake --build "$BUILD_DIR" --config Release
|
||||
|
||||
echo "Copying binaries to resources..."
|
||||
mkdir -p "$RESOURCES_DIR"
|
||||
cp "$BUILD_DIR/GoldMapperLib.dll" "$RESOURCES_DIR/"
|
||||
cp "$BUILD_DIR/GoldMapperLauncher.exe" "$RESOURCES_DIR/"
|
||||
cp "$BUILD_DIR/../third_party/SDL2-2.32.6/lib/x64/SDL2.dll" "$RESOURCES_DIR/"
|
||||
|
||||
echo "GoldMapper build complete."
|
||||
@@ -0,0 +1,5 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
Reference in New Issue
Block a user