Skip to content

Commit 79a4ce2

Browse files
committed
Add support for the Amiga CD32 Intro video
Remove AppVeyor testing, and add it for github actions
1 parent 25f51da commit 79a4ce2

14 files changed

Lines changed: 1089 additions & 83 deletions

.github/workflows/windows-build.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,82 @@ jobs:
1515
cmake_platform: x64
1616
configuration: Release
1717
cmake_extra_args: ""
18+
vcpkg_triplet: x64-windows
1819
- arch: x86
1920
cmake_platform: Win32
2021
configuration: Release
2122
cmake_extra_args: -DWITH_ASM=OFF
23+
vcpkg_triplet: x86-windows
2224
steps:
2325
- uses: actions/checkout@v4
26+
- name: Install FFmpeg (vcpkg)
27+
shell: pwsh
28+
run: |
29+
$vcpkgRoot = "C:\vcpkg"
30+
if (-not (Test-Path $vcpkgRoot)) {
31+
git clone https://github.com/microsoft/vcpkg $vcpkgRoot
32+
}
33+
& "$vcpkgRoot\bootstrap-vcpkg.bat"
34+
Push-Location $env:GITHUB_WORKSPACE
35+
& "$vcpkgRoot\vcpkg.exe" install --triplet ${{ matrix.vcpkg_triplet }}
36+
Pop-Location
2437
- name: Cache CMake deps
2538
uses: actions/cache@v4
2639
with:
2740
path: Projects/VS/_deps
2841
key: ${{ runner.os }}-${{ matrix.arch }}-cmake-deps-${{ hashFiles('CMakeLists.txt') }}
2942
- name: Configure
30-
run: cmake -S . -B Projects/VS -G "Visual Studio 17 2022" -A ${{ matrix.cmake_platform }} ${{ matrix.cmake_extra_args }}
43+
run: cmake -S . -B Projects/VS -G "Visual Studio 17 2022" -A ${{ matrix.cmake_platform }} ${{ matrix.cmake_extra_args }} -DOPENFODDER_ENABLE_FFMPEG=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }}
3144
- name: Build
3245
run: cmake --build Projects/VS --config ${{ matrix.configuration }}
3346
- name: Test
3447
shell: pwsh
3548
run: |
36-
New-Item -ItemType Directory -Path C:\built -Force | Out-Null
37-
Set-Location C:\built
38-
git clone --single-branch https://github.com/OpenFodder/data.git .
39-
git clone https://github.com/OpenFodder/tests.git Tests
40-
Copy-Item "$env:GITHUB_WORKSPACE\Run\openfodder.exe" -Destination C:\built -Force
41-
Copy-Item "$env:GITHUB_WORKSPACE\Run\SDL3.dll" -Destination C:\built -Force
42-
Copy-Item "$env:GITHUB_WORKSPACE\Run\SDL3_mixer.dll" -Destination C:\built -Force
49+
$runDir = "$env:GITHUB_WORKSPACE\Run"
50+
$dataRepo = "$runDir\_data_repo"
51+
$testsDir = "$runDir\Tests"
52+
New-Item -ItemType Directory -Path $runDir -Force | Out-Null
53+
if (Test-Path "$dataRepo\.git") {
54+
git -C $dataRepo pull
55+
} else {
56+
if (Test-Path $dataRepo) { Remove-Item $dataRepo -Recurse -Force }
57+
git clone --single-branch https://github.com/OpenFodder/data.git $dataRepo
58+
}
59+
if (Test-Path "$dataRepo\Data") {
60+
Copy-Item "$dataRepo\Data" "$runDir\Data" -Recurse -Force
61+
} else {
62+
Copy-Item "$dataRepo\*" $runDir -Recurse -Force -Exclude ".git"
63+
}
64+
if (Test-Path "$testsDir\.git") {
65+
git -C $testsDir pull
66+
} else {
67+
git clone https://github.com/OpenFodder/tests.git $testsDir
68+
}
69+
$ffmpegBin = "C:\vcpkg\installed\${{ matrix.vcpkg_triplet }}\bin"
70+
Copy-Item "$ffmpegBin\avcodec*.dll" -Destination $runDir -Force
71+
Copy-Item "$ffmpegBin\avformat*.dll" -Destination $runDir -Force
72+
Copy-Item "$ffmpegBin\avutil*.dll" -Destination $runDir -Force
73+
Copy-Item "$ffmpegBin\swscale*.dll" -Destination $runDir -Force
74+
Copy-Item "$ffmpegBin\swresample*.dll" -Destination $runDir -Force
75+
Push-Location $runDir
4376
.\openfodder.exe --appveyor --unit-test-headless
77+
Pop-Location
4478
- name: Package
4579
shell: pwsh
4680
run: |
4781
$archive = "OpenFodder-${{ matrix.arch }}-${{ matrix.configuration }}-latest.zip"
82+
$ffmpegBin = "C:\vcpkg\installed\${{ matrix.vcpkg_triplet }}\bin"
83+
$ffmpegDlls = Get-ChildItem $ffmpegBin -Filter *.dll | Where-Object {
84+
$_.Name -match "^(avcodec|avformat|avutil|swscale|swresample)"
85+
} | Select-Object -ExpandProperty FullName
4886
$items = @(
4987
"$env:GITHUB_WORKSPACE\Run\openfodder.exe",
5088
"$env:GITHUB_WORKSPACE\Run\SDL3.dll",
5189
"$env:GITHUB_WORKSPACE\Run\SDL3_mixer.dll",
5290
"$env:GITHUB_WORKSPACE\README.md",
5391
"$env:GITHUB_WORKSPACE\COPYING",
5492
"$env:GITHUB_WORKSPACE\openfodder.ini.example"
55-
)
93+
) + $ffmpegDlls
5694
if (Test-Path $archive) { Remove-Item $archive -Force }
5795
Compress-Archive -Path $items -DestinationPath $archive
5896
- name: Upload artifact

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ endif()
1212
project(openfodder VERSION 1.5.4 LANGUAGES CXX)
1313

1414
set(CMAKE_CXX_STANDARD 14)
15+
option(OPENFODDER_ENABLE_FFMPEG "Enable FFmpeg intro video playback" OFF)
16+
option(OPENFODDER_AUTO_FFMPEG "Auto-enable FFmpeg when found (non-Windows)" ON)
1517

1618
if(EMSCRIPTEN)
1719
set(OPENFODDER_EMSCRIPTEN ON)
@@ -129,6 +131,18 @@ target_compile_definitions(openfodder PRIVATE
129131
_UNICODE
130132
_USE_MATH_DEFINES)
131133

134+
if (OPENFODDER_ENABLE_FFMPEG OR (OPENFODDER_AUTO_FFMPEG AND NOT WIN32))
135+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
136+
find_package(FFmpeg)
137+
if (FFmpeg_FOUND)
138+
target_compile_definitions(openfodder PRIVATE OPENFODDER_ENABLE_FFMPEG)
139+
target_include_directories(openfodder PRIVATE ${FFMPEG_INCLUDE_DIRS})
140+
target_link_libraries(openfodder PRIVATE ${FFMPEG_LIBRARIES})
141+
elseif(OPENFODDER_ENABLE_FFMPEG)
142+
message(WARNING "FFmpeg not found; intro video playback disabled.")
143+
endif()
144+
endif()
145+
132146
if(EMSCRIPTEN)
133147
target_compile_definitions(openfodder PRIVATE EMSCRIPTEN OPENFODDER_NO_MIXER)
134148
target_compile_options(openfodder PRIVATE "-sUSE_SDL=3")
@@ -142,7 +156,7 @@ if(EMSCRIPTEN)
142156
"-sASSERTIONS=1"
143157
"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/Run@/")
144158
else()
145-
target_link_libraries(openfodder SDL3::SDL3 SDL3_mixer::SDL3_mixer Threads::Threads)
159+
target_link_libraries(openfodder PRIVATE SDL3::SDL3 SDL3_mixer::SDL3_mixer Threads::Threads)
146160
endif()
147161

148162
if(WIN32)

COMPILING.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Open Fodder build instructions
2+
3+
This document describes how to build Open Fodder from source.
4+
5+
## Windows (Visual Studio 2022 + CMake)
6+
7+
Open Fodder uses CMake's FetchContent to download SDL3 and SDL3_mixer on Windows,
8+
so a network connection and `git` in `PATH` are required for the first configure.
9+
10+
### Option A: Use the helper script (recommended)
11+
12+
The script locates a Visual Studio installation and builds the default `Release`
13+
configuration.
14+
15+
```
16+
Projects\build_vs.cmd
17+
```
18+
19+
Optional arguments:
20+
21+
```
22+
Projects\build_vs.cmd x64 Release
23+
Projects\build_vs.cmd Win32 Release
24+
Projects\build_vs.cmd x64 Debug
25+
Projects\build_vs.cmd x64 Release noffmpeg
26+
```
27+
28+
If `VCPKG_ROOT` (or `vcpkg` in `PATH`) points to a full vcpkg checkout with
29+
`scripts/buildsystems/vcpkg.cmake`, the script runs `vcpkg install` in the
30+
repo root and enables intro video playback by default. Use the `noffmpeg`
31+
argument to skip FFmpeg. The manifest pins a minimal FFmpeg feature set
32+
(avcodec/avformat/swresample/swscale).
33+
34+
The executable and runtime DLLs are copied to `Run\`.
35+
36+
### Option B: Run CMake manually
37+
38+
From the repo root:
39+
40+
```
41+
cmake -S . -B Projects/VS -G "Visual Studio 17 2022" -A x64
42+
cmake --build Projects/VS --config Release
43+
```
44+
45+
For 32-bit builds, use:
46+
47+
```
48+
cmake -S . -B Projects/VS -G "Visual Studio 17 2022" -A Win32 -DWITH_ASM=OFF
49+
cmake --build Projects/VS --config Release
50+
```
51+
52+
The executable and runtime DLLs are copied to `Run\`.
53+
54+
### FFmpeg intro video (optional)
55+
56+
Linux/macOS: CMake auto-detects FFmpeg by default. If FFmpeg is installed, the
57+
intro video support is enabled; if not, it is skipped.
58+
59+
Windows: the helper script enables FFmpeg automatically when vcpkg is
60+
available (use `noffmpeg` to skip it).
61+
62+
Manual enable (any platform):
63+
64+
```
65+
-DOPENFODDER_ENABLE_FFMPEG=ON
66+
```
67+
68+
Manual disable of auto-detect (non-Windows):
69+
70+
```
71+
-DOPENFODDER_AUTO_FFMPEG=OFF
72+
```
73+
74+
## Linux (Ubuntu example)
75+
76+
On Linux the build links against system-installed SDL3 and SDL3_mixer, so you
77+
must install them in a way that provides CMake package config files.
78+
The CI workflow builds and installs them from source:
79+
80+
```
81+
sudo apt-get update
82+
sudo apt-get install -y cmake ninja-build build-essential git pkg-config \
83+
libasound2-dev libpulse-dev libudev-dev libx11-dev libxext-dev \
84+
libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxtst-dev \
85+
libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev \
86+
libegl1-mesa-dev libgl1-mesa-dev \
87+
libflac-dev libogg-dev libvorbis-dev libmpg123-dev libopusfile-dev \
88+
libxmp-dev
89+
90+
git clone --depth 1 --branch release-3.4.0 https://github.com/libsdl-org/SDL.git /tmp/SDL
91+
cmake -S /tmp/SDL -B /tmp/SDL/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
92+
cmake --build /tmp/SDL/build
93+
sudo cmake --install /tmp/SDL/build
94+
95+
git clone --depth 1 https://github.com/libsdl-org/SDL_mixer.git /tmp/SDL_mixer
96+
cmake -S /tmp/SDL_mixer -B /tmp/SDL_mixer/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
97+
-DSDLMIXER_VENDORED=OFF -DSDLMIXER_MOD_XMP=ON -DSDLMIXER_MOD_XMP_LITE=OFF -DSDLMIXER_MOD_XMP_SHARED=OFF
98+
cmake --build /tmp/SDL_mixer/build
99+
sudo cmake --install /tmp/SDL_mixer/build
100+
```
101+
102+
Then configure and build:
103+
104+
```
105+
cmake -S . -B build -G Ninja
106+
cmake --build build
107+
```
108+
109+
## Tests (optional)
110+
111+
The Windows CI test step uses the data and tests repositories and runs:
112+
113+
```
114+
openfodder.exe --appveyor --unit-test-headless
115+
```
116+
117+
You can reproduce this by placing `openfodder.exe` (and its SDL3 DLLs) alongside
118+
the checked-out data and tests folders.

0 commit comments

Comments
 (0)