-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathbuild-for-mingw.sh
More file actions
101 lines (86 loc) · 3.15 KB
/
Copy pathbuild-for-mingw.sh
File metadata and controls
101 lines (86 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2026 citron Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Automated MinGW (MSYS2 UCRT64) build script for Citron Neo.
# Run from the MSYS2 UCRT64 shell, or use build-for-mingw.bat to launch it.
set -euo pipefail
# ---------- configuration ----------
BUILD_DIR="${1:-build-mingw}"
BUILD_TYPE="${2:-Release}"
JOBS="${3:-$(nproc)}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="$SCRIPT_DIR"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
info() { echo -e "${CYAN}[INFO]${NC} $*"; }
ok() { echo -e "${GREEN}[ OK ]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
fail() { echo -e "${RED}[FAIL]${NC} $*"; exit 1; }
# ---------- environment check ----------
if [[ -z "${MSYSTEM:-}" ]]; then
fail "Not running inside an MSYS2 shell. Use the UCRT64 terminal or build-for-mingw.bat."
fi
if [[ "$MSYSTEM" != "UCRT64" ]]; then
warn "MSYSTEM is '$MSYSTEM', expected 'UCRT64'. Builds may use the wrong toolchain."
fi
command -v pacman >/dev/null 2>&1 || fail "pacman not found — is this really MSYS2?"
# ---------- dependency installation ----------
info "Installing / updating build tools and dependencies via pacman …"
PACKAGES=(
# build tools
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-toolchain
# required libraries
mingw-w64-ucrt-x86_64-boost
mingw-w64-ucrt-x86_64-fmt
mingw-w64-ucrt-x86_64-nlohmann-json
mingw-w64-ucrt-x86_64-opus
mingw-w64-ucrt-x86_64-SDL2
mingw-w64-ucrt-x86_64-qt6-base
mingw-w64-ucrt-x86_64-qt6-multimedia
mingw-w64-ucrt-x86_64-qt6-svg
mingw-w64-ucrt-x86_64-qt6-tools
mingw-w64-ucrt-x86_64-ffmpeg
mingw-w64-ucrt-x86_64-openal
mingw-w64-ucrt-x86_64-vulkan-headers
mingw-w64-ucrt-x86_64-vulkan-utility-libraries
mingw-w64-ucrt-x86_64-vulkan-memory-allocator
mingw-w64-ucrt-x86_64-libusb
mingw-w64-ucrt-x86_64-enet
mingw-w64-ucrt-x86_64-stb
)
pacman -S --needed --noconfirm "${PACKAGES[@]}" || fail "pacman install failed"
ok "All dependencies installed."
# ---------- configure ----------
info "Configuring CMake (${BUILD_TYPE}) in ${BUILD_DIR} …"
mkdir -p "${SOURCE_DIR}/${BUILD_DIR}"
cd "${SOURCE_DIR}/${BUILD_DIR}"
cmake "$SOURCE_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCITRON_USE_BUNDLED_VCPKG=OFF \
-DCITRON_USE_BUNDLED_SDL2=OFF \
-DCITRON_USE_BUNDLED_QT=OFF \
-DCITRON_USE_BUNDLED_FFMPEG=OFF \
-DCITRON_USE_EXTERNAL_VULKAN_HEADERS=OFF \
-DCITRON_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=OFF \
-DENABLE_QT_TRANSLATION=OFF \
-DUSE_DISCORD_PRESENCE=OFF \
-DCITRON_TESTS=OFF \
-DENABLE_WEB_SERVICE=OFF \
-DCITRON_USE_FASTER_LD=OFF \
|| fail "CMake configuration failed"
ok "CMake configuration succeeded."
# ---------- build ----------
info "Building with ${JOBS} parallel jobs …"
ninja -j"$JOBS" || fail "Build failed"
ok "Build complete!"
echo ""
info "Executables are in: ${SOURCE_DIR}/${BUILD_DIR}/bin/"
ls -lh "${SOURCE_DIR}/${BUILD_DIR}/bin/"*.exe 2>/dev/null || true
echo ""
ok "Done. You can run citron from: ${BUILD_DIR}/bin/citron.exe"