|
| 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