Jump to content

Compiling (OpenApoc): Difference between revisions

From UFOpaedia
SupSuper (talk | contribs)
Created page with "== Building == OpenApocalypse is built leveraging a number of libraries - to provide needed functionality (and save us the time of implementing it ourselves badly) * [http:/..."
 
Deldonut1 (talk | contribs)
m Added reference to build documentation
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Building ==
{{DISPLAYTITLE:Compiling (OpenApoc)}}
This page describes how to compile '''[[OpenApoc]]''' from source on Windows, Linux, and macOS.


OpenApocalypse is built leveraging a number of libraries - to provide needed functionality (and save us the time of implementing it ourselves badly)
OpenApoc is written in '''C++17''' and uses '''[https://cmake.org CMake]''' (minimum version '''3.30''') as its build system. It targets GCC 8+, Clang 7+, and MSVC 2019+ (Visual Studio 2017 or later).


* [http://www.libsdl.org SDL2]
'''Important:''' You will need a copy of the original X-COM: Apocalypse CD image (<code>cd.iso</code>) placed in the <code>data/</code> directory of the source tree. The build process extracts game data tables from this file.
* [http://boost.org Boost] - specifially the 'locale' library, used for localisation, 'program-options' for settings management, and 'filesystem'.
* [http://www.nongnu.org/libunwind/download.html Libunwind] - debug backtracing on linux - not needed on windows.


The following libraries are also used, but are shipped as submodules in the repository and directly included in the build, so you don't need to install these dependencies to build or use openapoc.
== Prerequisites ==


* [http://glm.g-truc.net GLM] - Math library.
All platforms require:
* [http://libsmacker.sourceforge.net/ libsmacker] - Decoder for .smk video files.
* [http://lodev.org/lodepng/ lodepng] - Reading/writing PNG image files.
* [https://github.com/richgel999/miniz miniz] - Zlib-comptible compression library.
* [https://icculus.org/physfs/ physfs] - Library for reading data from .iso files or directory trees (Note: We use a patched version, available on [https://github.com/JonnyH/physfs-hg-import/tree/fix-iso) - required to read the .iso files we use GitHub].
* [http://http://pugixml.org/ pugixml] - XML library used for reading/writing the game data files.
* [https://github.com/c42f/tinyformat tinyformat] - A c++ typesafe string formatting library.


=== Windows ===
* '''[https://git-scm.com Git]''' &mdash; to clone the repository and fetch submodules
* '''[https://cmake.org CMake] 3.30''' or newer
* A C++17-capable compiler:
** '''GCC 8+''' (Linux)
** '''Clang 7+''' (Linux / macOS)
** '''MSVC 2019+''' / Visual Studio 2017 or later (Windows)
* The original '''X-COM: Apocalypse''' disc image (<code>cd.iso</code>) &mdash; placed in <code>data/</code>


# Checkout OpenApoc from GitHub.
== External Dependencies ==
# If you are using the GitHub client for Windows, the submodules should already be setup at first checkout. If not using the github client, or if the submodules have been updated, run the following commands in the 'git shell' from the root of the OpenApoc repository. This should reset the submodule checkouts to the latest versions (NOTE: This will overwrite any changes to code in the dependencies/ directory).


<nowiki>cmd
The following libraries must be installed on your system (or via vcpkg on Windows). These are '''not''' bundled with the source code:
git submodule init
git submodule update -f</nowiki>


# All the other dependencies (Boost, SDL2) are provided automatically by nuget packages, and Visual Studio should automatically download and install these at the first build.
{| class="wikitable"
# Copy the original XCom:Apocalypse .iso file into the "data/" directory. This could also be a directory containing all the extracted files from the CD, and it should be named the same (IE the directory should be data/cd.iso/). This is used during the build to extract some data tables.
|-
# Open openapoc.sln in Visual Studio.
! Library !! Purpose !! Notes
# Build (Release/Debug x86/x64 should all work).
|-
# When running from the Visual Studio UI, the working directory is set to the root of the project, so the data folder should already be in the right place. If you want to run outside of Visual Studio, you need to copy the whole 'data' folder (including the cd.iso file) into the folder openapoc.exe resides in.
| '''[https://www.libsdl.org SDL2]''' || Windowing, input, audio || Required on all platforms
|-
| '''[https://boost.org Boost]''' (locale, program-options, uuid, crc) || Localisation, settings management, hash functions || Only these specific Boost libraries are needed
|-
| '''[https://xiph.org/vorbis/ LibVorbis]''' || Ogg Vorbis music decoding || Required on all platforms
|-
| '''[https://www.qt.io/ Qt]''' (Qt5 or Qt6 base) || Launcher GUI || Optional; can be disabled with <code>BUILD_LAUNCHER=OFF</code>
|-
| '''[https://nongnu.org/libunwind/download.html libunwind]''' || Debug backtracing || Linux only; not needed on Windows or macOS
|}


=== Linux ===
'''Note:''' Previous versions of this wiki page incorrectly listed <code>tinyformat</code>, <code>libboost-filesystem-dev</code>, <code>libboost-system-dev</code>, and <code>qtdeclarative5-dev</code> as dependencies. These are '''not''' required. The formatting library is <code>fmtlib</code> (bundled as a submodule), and only <code>boost-locale</code> and <code>boost-program-options</code> (plus <code>boost-uuid</code> and <code>boost-crc</code>) are needed from Boost.


(Tested on Ubuntu 16.04)
== Bundled Dependencies (Submodules) ==


# Install the following packages:
The following libraries are included as Git submodules in the <code>dependencies/</code> directory and are built automatically as part of the OpenApoc build. You do '''not''' need to install these separately:


<nowiki>sh
{| class="wikitable"
sudo apt-get install libsdl2-dev cmake build-essential git libunwind8-dev libboost-locale-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev</nowiki>
|-
! Library !! Purpose
|-
| '''[https://glm.g-truc.net GLM]''' || Math library (vectors, matrices, etc.)
|-
| '''[https://sourceforge.net/projects/libsmacker/ libsmacker]''' || Decoder for <code>.smk</code> video files
|-
| '''[https://github.com/lvandeve/lodepng lodepng]''' || Reading/writing PNG image files
|-
| '''[https://www.lua.org/ Lua]''' || Scripting language
|-
| '''[https://github.com/richgel999/miniz miniz]''' || Zlib-compatible compression library
|-
| '''[https://icculus.org/physfs/ PhysFS]''' (patched) || Reading data from <code>.iso</code> files and directory trees
|-
| '''[https://pugixml.org pugixml]''' || XML library for game data files
|-
| '''[https://github.com/fmtlib/fmt fmtlib (fmt)]''' || C++ string formatting library
|-
| '''[https://github.com/Neargye/magic_enum magic_enum]''' || Header-only C++17 static reflection for enums
|}


# Checkout OpenApoc from GitHub.
To fetch or update all submodules, run:
# Fetch the dependencies from git with the following terminal command (run from the just-created OpenApoc folder).


  <nowiki>sh
  git submodule update --init --recursive
git submodule init
git submodule update</nowiki>


# Copy the cd.iso file to the 'data' directory under the repository root (Note - despite dosbox having good linux support, the steam version of X-Com Apocalypse refuses to install in steam for linux - you may need to snatch the cd.iso file off a windows steam install).
== Building on Windows ==


<nowiki>sh
=== Requirements ===
cp /path/to/cd.iso data/</nowiki>


# Create a subdirectory ('build' in this example) in the OpenApoc checkout directory, and from that use cmake to configure OpenApoc.
* '''[https://visualstudio.microsoft.com/vs/ Visual Studio]''' 2017 or later, with the "Desktop Development with C++" workload installed
* '''[https://github.com/Microsoft/vcpkg Vcpkg]''' package manager (for external dependencies)


<nowiki>sh
=== Step-by-step ===
cd /path/to/OpenApoc
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..</nowiki>


# This cmake command will fail if we're missing a dependency, or your system is for some other reason unable to build - if you have any issues please contact us (see above for links).
# Install Visual Studio with the "Desktop Development with C++" workload.
# Build the project with the following command.
# Install a Git client (e.g. [https://desktop.github.com/ GitHub Desktop]) and clone the OpenApoc repository.
# Initialize the submodules:
#: <code>git submodule update --init --recursive</code>
# Install [https://github.com/Microsoft/vcpkg Vcpkg] and integrate it with Visual Studio.
# Install the required dependencies via vcpkg. For '''x64''' builds:
#: <code>vcpkg --triplet x64-windows install sdl2 boost-locale boost-program-options boost-uuid boost-crc qt-base6-dev libvorbis</code>
#: For '''x86''' builds, replace <code>x64-windows</code> with <code>x86-windows</code>.
#: To see all supported architectures: <code>vcpkg help triplet</code>
# Copy your <code>cd.iso</code> file into the <code>data/</code> directory.
# Open the OpenApoc directory in Visual Studio. If your version of Visual Studio does not have an "Open Folder" option, generate a project using CMake.
# Set the configuration to '''x64-Release''' (or '''x86-Release''') &mdash; must match your vcpkg triplet. Release is recommended because Debug builds are very slow.
# Visual Studio should automatically detect and configure CMake. If you did not integrate vcpkg globally, set the CMake toolchain file manually:
#* '''Visual Studio 2017:''' Add to your CMake settings JSON:
#*: <code>"CMAKE_TOOLCHAIN_FILE": "&lt;path to vcpkg&gt;\\scripts\\buildsystems\\vcpkg.cmake"</code>
#* '''Visual Studio 2019+:''' Build &rarr; CMake Settings &rarr; Toolchain file &rarr; <code><path to vcpkg>\scripts\buildsystems\vcpkg.cmake</code>
# Build the project. The first build may take a while, especially if vcpkg has not yet built all dependencies.


<nowiki>sh
=== Running ===
make -j4</nowiki>


# This should create a directory 'bin' under the build directory, with the 'OpenApoc' executable file. OpenApoc by default expects the data folder to be in the current working directory, so running the executable from the root of the git checkout should work.
When running from Visual Studio, the working directory is set to the project root, so the <code>data/</code> folder is found automatically. If running outside Visual Studio, copy the entire <code>data/</code> folder (including <code>cd.iso</code>) into the directory containing <code>openapoc.exe</code>.


  <nowiki>sh
== Building on Linux ==
./build/bin/OpenApoc</nowiki>
 
=== Ubuntu (22.04 / 24.04) ===
 
Install the required packages:
 
  sudo apt-get install libsdl2-dev cmake build-essential git libunwind8-dev \
    libboost-locale-dev libboost-program-options-dev qtbase5-dev libvorbis-dev
 
Clone the repository and initialize submodules:
 
git clone <nowiki>https://github.com/OpenApoc/OpenApoc.git</nowiki>
cd OpenApoc
git submodule update --init --recursive
 
Copy the CD image:
 
cp /path/to/cd.iso data/
 
Configure and build:
 
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j$(nproc)
 
Run:
 
cd ..
./build/bin/OpenApoc
 
=== Fedora / Red Hat ===
 
Install the required packages (as root):
 
yum groupinstall "Development Tools" "Development Libraries"
yum install git SDL2-devel cmake libunwind-devel qt6-qtbase-devel libvorbis-devel
 
Then follow the same clone, submodule, configure, and build steps as Ubuntu above.
 
=== Mageia ===
 
Install the required packages (as root):
 
urpmi "cmake(sdl2)" libstdc++-static-devel boost-devel boost unwind-devel \
    task-c++-devel cmake git qt6-devel libvorbis-devel
 
Then follow the same clone, submodule, configure, and build steps as Ubuntu above.
 
=== Optional CMake flags (all distributions) ===
 
{| class="wikitable"
|-
! Flag !! Default !! Description
|-
| <code>CMAKE_BUILD_TYPE</code> || (none) || Set to <code>RelWithDebInfo</code> for optimized builds with debug symbols, or <code>Release</code> for maximum optimization
|-
| <code>BUILD_LAUNCHER</code> || <code>ON</code> || Build the Qt-based launcher GUI; set to <code>OFF</code> to skip Qt dependency
|-
| <code>USE_SYSTEM_QT</code> || <code>OFF</code> || Use system-installed Qt instead of the vcpkg package
|-
| <code>ENABLE_TESTS</code> || <code>ON</code> || Build unit tests (run with <code>ctest</code> from the build directory)
|-
| <code>LTO</code> || <code>OFF</code> || Enable link-time optimization
|-
| <code>EXTRACT_DATA</code> || <code>ON</code> || Run the data extractor as part of the default build target
|-
| <code>CD_PATH</code> || <code>data/cd.iso</code> || Path to the X-COM: Apocalypse disc image
|}
 
== Building on macOS ==
 
Tested on macOS Sequoia 15.6.
 
=== Requirements ===
 
* '''[https://brew.sh Homebrew]''' package manager
 
=== Step-by-step ===
 
# Install Homebrew if not already present:
#: <code>/bin/bash -c "$(curl -fsSL <nowiki>https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh</nowiki>)"</code>
# Clone the repository and initialize submodules:
#: <code>git clone <nowiki>https://github.com/OpenApoc/OpenApoc.git</nowiki></code>
#: <code>cd OpenApoc</code>
#: <code>git submodule update --init --recursive</code>
# Install dependencies via Homebrew:
#: <code>brew install cmake boost pkg-config sdl2 qt@6 libvorbis</code>
# Add Qt to your PATH. If using '''zsh''' (default since macOS Catalina):
#: <code>echo 'export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"' >> ~/.zprofile</code>
#: If using '''bash''':
#: <code>echo 'export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"' >> ~/.bashrc</code>
#: Then reload your shell or run <code>source ~/.zprofile</code> (or <code>source ~/.bashrc</code>).
# Copy the CD image:
#: <code>cp /path/to/cd.iso data/</code>
# Configure and build:
#: <code>mkdir build</code>
#: <code>cd build</code>
#: <code>cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..</code>
#: <code>make -j$(sysctl -n hw.ncpu)</code>
# Run the application:
#: <code>cd ..</code>
#: <code>open ./build/bin/OpenApoc.app</code>
 
== Running Tests ==
 
After building, you can run the unit tests from the build directory:
 
cd build
ctest
 
== Common Issues / Troubleshooting ==
 
=== CMake version too old ===
 
OpenApoc requires '''CMake 3.30''' or newer. If your distribution ships an older version, download the latest from [https://cmake.org/download/ cmake.org] or install via <code>pip install cmake</code>.
 
=== Submodule errors / missing dependencies directory ===
 
If you see errors about missing files in <code>dependencies/</code>, ensure you have initialized the submodules:
 
git submodule update --init --recursive
 
If you previously cloned without <code>--recursive</code>, this command will fetch all required submodules.
 
=== cd.iso not found ===
 
The build expects the original X-COM: Apocalypse disc image at <code>data/cd.iso</code> by default. You can change this path with:
 
cmake -DCD_PATH=/path/to/cd.iso ..
 
Supported formats:
* A standard <code>.iso</code> file (rename to <code>cd.iso</code>)
* A directory containing extracted CD files (name the directory <code>cd.iso</code>)
* GOG <code>.cue</code>/<code>.bin</code> files: rename the <code>.cue</code> file to <code>cd.iso</code> and place the <code>.bin</code> file alongside it in <code>data/</code>
 
=== Debug builds are very slow ===
 
This is expected. Use <code>RelWithDebInfo</code> for a build that is optimized but still has debug symbols:
 
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
 
=== Missing Qt / launcher build fails ===
 
If you do not need the launcher GUI, disable it:
 
cmake -DBUILD_LAUNCHER=OFF ..
 
=== Windows: Visual C++ Runtime errors ===
 
When running a pre-built binary on Windows, ensure you have the latest [https://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist Visual C++ Redistributable] installed.
 
=== OpenGL requirements ===
 
OpenApoc requires '''OpenGL 2.0''' capable graphics hardware and drivers.
 
=== Linux: libunwind not found ===
 
On Ubuntu/Debian:
 
sudo apt-get install libunwind8-dev
 
On Fedora/RHEL:
 
sudo yum install libunwind-devel
 
=== macOS: Qt not found by CMake ===
 
Ensure Qt is on your PATH. After installing via Homebrew:
 
export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"
 
Then re-run <code>cmake</code>.
 
== See Also ==
 
* [[OpenApoc]] &mdash; Main OpenApoc wiki page
* [[Coding Style (OpenApoc)]] &mdash; C++ code style guidelines
* [[Differences to X-COM (OpenApoc)]] &mdash; How OpenApoc differs from the original game
* [https://github.com/ayrtondenner/OpenApoc-wiki/blob/master/development/building.md OpenApoc Wiki: Building] &mdash; Extended build documentation
* [https://github.com/OpenApoc/OpenApoc OpenApoc on GitHub] &mdash; Source code repository
* [https://discord.gg/d6DAHEb OpenApoc Discord] &mdash; Community discussion and support
 
[[Category:OpenApoc]]

Latest revision as of 21:21, 1 March 2026

This page describes how to compile OpenApoc from source on Windows, Linux, and macOS.

OpenApoc is written in C++17 and uses CMake (minimum version 3.30) as its build system. It targets GCC 8+, Clang 7+, and MSVC 2019+ (Visual Studio 2017 or later).

Important: You will need a copy of the original X-COM: Apocalypse CD image (cd.iso) placed in the data/ directory of the source tree. The build process extracts game data tables from this file.

Prerequisites

All platforms require:

  • Git — to clone the repository and fetch submodules
  • CMake 3.30 or newer
  • A C++17-capable compiler:
    • GCC 8+ (Linux)
    • Clang 7+ (Linux / macOS)
    • MSVC 2019+ / Visual Studio 2017 or later (Windows)
  • The original X-COM: Apocalypse disc image (cd.iso) — placed in data/

External Dependencies

The following libraries must be installed on your system (or via vcpkg on Windows). These are not bundled with the source code:

Library Purpose Notes
SDL2 Windowing, input, audio Required on all platforms
Boost (locale, program-options, uuid, crc) Localisation, settings management, hash functions Only these specific Boost libraries are needed
LibVorbis Ogg Vorbis music decoding Required on all platforms
Qt (Qt5 or Qt6 base) Launcher GUI Optional; can be disabled with BUILD_LAUNCHER=OFF
libunwind Debug backtracing Linux only; not needed on Windows or macOS

Note: Previous versions of this wiki page incorrectly listed tinyformat, libboost-filesystem-dev, libboost-system-dev, and qtdeclarative5-dev as dependencies. These are not required. The formatting library is fmtlib (bundled as a submodule), and only boost-locale and boost-program-options (plus boost-uuid and boost-crc) are needed from Boost.

Bundled Dependencies (Submodules)

The following libraries are included as Git submodules in the dependencies/ directory and are built automatically as part of the OpenApoc build. You do not need to install these separately:

Library Purpose
GLM Math library (vectors, matrices, etc.)
libsmacker Decoder for .smk video files
lodepng Reading/writing PNG image files
Lua Scripting language
miniz Zlib-compatible compression library
PhysFS (patched) Reading data from .iso files and directory trees
pugixml XML library for game data files
fmtlib (fmt) C++ string formatting library
magic_enum Header-only C++17 static reflection for enums

To fetch or update all submodules, run:

git submodule update --init --recursive

Building on Windows

Requirements

  • Visual Studio 2017 or later, with the "Desktop Development with C++" workload installed
  • Vcpkg package manager (for external dependencies)

Step-by-step

  1. Install Visual Studio with the "Desktop Development with C++" workload.
  2. Install a Git client (e.g. GitHub Desktop) and clone the OpenApoc repository.
  3. Initialize the submodules:
    git submodule update --init --recursive
  4. Install Vcpkg and integrate it with Visual Studio.
  5. Install the required dependencies via vcpkg. For x64 builds:
    vcpkg --triplet x64-windows install sdl2 boost-locale boost-program-options boost-uuid boost-crc qt-base6-dev libvorbis
    For x86 builds, replace x64-windows with x86-windows.
    To see all supported architectures: vcpkg help triplet
  6. Copy your cd.iso file into the data/ directory.
  7. Open the OpenApoc directory in Visual Studio. If your version of Visual Studio does not have an "Open Folder" option, generate a project using CMake.
  8. Set the configuration to x64-Release (or x86-Release) — must match your vcpkg triplet. Release is recommended because Debug builds are very slow.
  9. Visual Studio should automatically detect and configure CMake. If you did not integrate vcpkg globally, set the CMake toolchain file manually:
    • Visual Studio 2017: Add to your CMake settings JSON:
      "CMAKE_TOOLCHAIN_FILE": "<path to vcpkg>\\scripts\\buildsystems\\vcpkg.cmake"
    • Visual Studio 2019+: Build → CMake Settings → Toolchain file → <path to vcpkg>\scripts\buildsystems\vcpkg.cmake
  10. Build the project. The first build may take a while, especially if vcpkg has not yet built all dependencies.

Running

When running from Visual Studio, the working directory is set to the project root, so the data/ folder is found automatically. If running outside Visual Studio, copy the entire data/ folder (including cd.iso) into the directory containing openapoc.exe.

Building on Linux

Ubuntu (22.04 / 24.04)

Install the required packages:

sudo apt-get install libsdl2-dev cmake build-essential git libunwind8-dev \
    libboost-locale-dev libboost-program-options-dev qtbase5-dev libvorbis-dev

Clone the repository and initialize submodules:

git clone https://github.com/OpenApoc/OpenApoc.git
cd OpenApoc
git submodule update --init --recursive

Copy the CD image:

cp /path/to/cd.iso data/

Configure and build:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j$(nproc)

Run:

cd ..
./build/bin/OpenApoc

Fedora / Red Hat

Install the required packages (as root):

yum groupinstall "Development Tools" "Development Libraries"
yum install git SDL2-devel cmake libunwind-devel qt6-qtbase-devel libvorbis-devel

Then follow the same clone, submodule, configure, and build steps as Ubuntu above.

Mageia

Install the required packages (as root):

urpmi "cmake(sdl2)" libstdc++-static-devel boost-devel boost unwind-devel \
    task-c++-devel cmake git qt6-devel libvorbis-devel

Then follow the same clone, submodule, configure, and build steps as Ubuntu above.

Optional CMake flags (all distributions)

Flag Default Description
CMAKE_BUILD_TYPE (none) Set to RelWithDebInfo for optimized builds with debug symbols, or Release for maximum optimization
BUILD_LAUNCHER ON Build the Qt-based launcher GUI; set to OFF to skip Qt dependency
USE_SYSTEM_QT OFF Use system-installed Qt instead of the vcpkg package
ENABLE_TESTS ON Build unit tests (run with ctest from the build directory)
LTO OFF Enable link-time optimization
EXTRACT_DATA ON Run the data extractor as part of the default build target
CD_PATH data/cd.iso Path to the X-COM: Apocalypse disc image

Building on macOS

Tested on macOS Sequoia 15.6.

Requirements

Step-by-step

  1. Install Homebrew if not already present:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Clone the repository and initialize submodules:
    git clone https://github.com/OpenApoc/OpenApoc.git
    cd OpenApoc
    git submodule update --init --recursive
  3. Install dependencies via Homebrew:
    brew install cmake boost pkg-config sdl2 qt@6 libvorbis
  4. Add Qt to your PATH. If using zsh (default since macOS Catalina):
    echo 'export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"' >> ~/.zprofile
    If using bash:
    echo 'export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"' >> ~/.bashrc
    Then reload your shell or run source ~/.zprofile (or source ~/.bashrc).
  5. Copy the CD image:
    cp /path/to/cd.iso data/
  6. Configure and build:
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
    make -j$(sysctl -n hw.ncpu)
  7. Run the application:
    cd ..
    open ./build/bin/OpenApoc.app

Running Tests

After building, you can run the unit tests from the build directory:

cd build
ctest

Common Issues / Troubleshooting

CMake version too old

OpenApoc requires CMake 3.30 or newer. If your distribution ships an older version, download the latest from cmake.org or install via pip install cmake.

Submodule errors / missing dependencies directory

If you see errors about missing files in dependencies/, ensure you have initialized the submodules:

git submodule update --init --recursive

If you previously cloned without --recursive, this command will fetch all required submodules.

cd.iso not found

The build expects the original X-COM: Apocalypse disc image at data/cd.iso by default. You can change this path with:

cmake -DCD_PATH=/path/to/cd.iso ..

Supported formats:

  • A standard .iso file (rename to cd.iso)
  • A directory containing extracted CD files (name the directory cd.iso)
  • GOG .cue/.bin files: rename the .cue file to cd.iso and place the .bin file alongside it in data/

Debug builds are very slow

This is expected. Use RelWithDebInfo for a build that is optimized but still has debug symbols:

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..

Missing Qt / launcher build fails

If you do not need the launcher GUI, disable it:

cmake -DBUILD_LAUNCHER=OFF ..

Windows: Visual C++ Runtime errors

When running a pre-built binary on Windows, ensure you have the latest Visual C++ Redistributable installed.

OpenGL requirements

OpenApoc requires OpenGL 2.0 capable graphics hardware and drivers.

Linux: libunwind not found

On Ubuntu/Debian:

sudo apt-get install libunwind8-dev

On Fedora/RHEL:

sudo yum install libunwind-devel

macOS: Qt not found by CMake

Ensure Qt is on your PATH. After installing via Homebrew:

export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"

Then re-run cmake.

See Also