Compiling (OpenApoc)

From UFOpaedia
Revision as of 19:05, 9 March 2019 by SupSuper (talk | contribs) (Fix code blocks)
Jump to navigation Jump to search

Building

OpenApocalypse is built leveraging a number of libraries - to provide needed functionality (and save us the time of implementing it ourselves badly)

  • SDL2
  • Boost - specifially the 'locale' library, used for localisation, 'program-options' for settings management, and 'filesystem'.
  • 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.

Windows

  1. Checkout OpenApoc from GitHub.
  2. 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).
git submodule init
git submodule update -f
  1. 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.
  2. 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.
  3. Open openapoc.sln in Visual Studio.
  4. Build (Release/Debug x86/x64 should all work).
  5. 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.

Linux

(Tested on Ubuntu 16.04)

  1. Install the following packages:
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
  1. Checkout OpenApoc from GitHub.
  2. Fetch the dependencies from git with the following terminal command (run from the just-created OpenApoc folder).
git submodule init
git submodule update
  1. 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).
cp /path/to/cd.iso data/
  1. Create a subdirectory ('build' in this example) in the OpenApoc checkout directory, and from that use cmake to configure OpenApoc.
cd /path/to/OpenApoc
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  1. 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).
  2. Build the project with the following command.
make -j4
  1. 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.
./build/bin/OpenApoc