Compilation guide

Bradley Walters edited this page Oct 19, 2016 · 48 revisions

This guide will describe how to install OpenJK (Jedi Academy) and optionally OpenJO (Jedi Outcast) by compiling from this source repository.

Warning: This guide is meant for those with minimal technical expertise, as developer tools are necessary to build OpenJK. If you would like to install OpenJK from pre-built binaries, see Installing OpenJK.

Before we begin

You will need the following applications installed on your system:

  • CMake
  • Git
  • C and C++ compiler of your choice

Quick Overview

  1. Get the source code.
  2. Get the dependencies.
  3. Run CMake to build the project files.
  4. Open the project files (if necessary), and compile!

Getting the source code

The source code for OpenJK, which includes Jedi Outcast and Jedi Academy, can be downloaded from the git repository:

$ git clone openjk

Alternatively, you can fork our project if you would like to contribute back! Either way, you must adhere to the GNU GPLv2 license, under which the original Jedi Outcast/Jedi Academy source was licensed. This means any changes to the code must be publicly available.

Getting the dependencies

The following libraries are required to build OpenJK:

  • libjpeg
  • libpng
  • zlib
  • OpenGL
  • OpenAL (Windows only)
  • SDL2


For Windows builds, all the dependencies are provided with the source code.


On Debian-based distros, the following command will download and install the required dependencies:

$ sudo apt-get install libjpeg8-dev libpng12-dev zlib1g-dev libsdl2-dev build-essential

There will be equivalent commands on other Linux distros.

For example on openSUSE you will need:

$ sudo zypper in libjpeg8-devel libpng16-devel zlib-devel libSDL2-devel

CentOS 7 for dedicated server and MP libraries

Install the dependencies:

$ sudo yum install libjpeg-devel libpng-devel zlib-devel

Run cmake with -i to select the desired parts of OpenJK to build.

Or when cross-compiling for 32 bit:

$ sudo yum install glibc-devel.i686 libstdc++-devel.i686 libjpeg-turbo-devel.i686 libpng-devel.i686 zlib-devel.i686

Run cmake with -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32


We recommend using a package manager similar MacPorts or Homebrew to download and install the dependencies. Using Homebrew, you can use the following command:

$ brew install zlib libjpeg libpng sdl2 --universal

zlib is installed as part of libpng.

Generating project files

We use CMake as our cross-platform makefile generator. This allows us to maintain a single set of project files, and have CMake generate the Visual Studio solution, Makefile, or Xcode project files for us. CMake can be downloaded from the CMake website, or through your package manager. Instructions for installing CMake can be found here.

There are three ways to run CMake:

CMake GUI (Windows, Linux and OS X)

This method is recommended for people using Windows, or who are new to CMake.

  1. Open CMake GUI
  2. In the "Where is the source code" text box, enter the path to the OpenJK source code.
  3. Copy and paste the patch into the "Where to build the binaries" text box, and add /build at the end of the path.
  4. Click the Configure button at the bottom-left of the window.
  5. Follow the on-screen instructions. If you don't know which compiler to use, then leave it as default.
  6. The window should now be filled with some settings. Edit the settings to suit your needs. We highly recommend setting CMAKE_INSTALL_PREFIX to JKA's GameData folder to make running and testing easier later on. Hovering over each setting will give a description of what it does.
  7. Press the Generate button to generate the project files.
  8. The project files will be generated in the build/ folder located in your OpenJK source folder.

CMake Curses (Linux and OS X)

This method is recommended for people new to CMake and are comfortable using the terminal. On Linux, the curses GUI for CMake might need to be installed separately. For Debian-based distros, the package can be downloaded by running:

sudo apt-get install cmake-curses-gui

To create the project files:

  1. cd to the OpenJK source folder and run mkdir build.
  2. cd build
  3. ccmake .. (note the double c in ccmake)
  4. You can optionally provide the -G <generator name> option to specify what type of project file to generate. For example: ccmake -G Ninja .. will create project files for the Ninja build system. A list of generators can be found by running cmake (single c).
  5. Configure the project (press the C key), and then edit the settings to suit your needs. We highly recommend setting CMAKE_INSTALL_PREFIX to JKA's GameData folder to make running and testing easier later on.
  6. Generate the project (press the G key).
  7. Your project files will be created in the build/ directory.
  8. Exit the GUI by pressing the E key.

If you need to change any settings, run make edit_cache, and the curses GUI will be shown again. Edit the settings, and generate the project again.

Using cmake directly

This method is recommended for build scripts such as those used in automated builds or for experienced users who are comfortable with using the terminal, and know the flags to pass to CMake. The following commands will create the build directory, and generate the project files for the default generator. You should edit it for your specific needs.

cd $HOME/openjk
mkdir build
cd build
cmake ..

It is recommended to set the install prefix: `cmake -DCMAKE_INSTALL_PREFIX=/path/to/GameData ..


Compiling the source code depends on the project/makefile generated. Instructions for the main build tool on each supported platform are supplied below.


  1. Open the OpenJK.sln file in the build folder with Visual Studio.
  2. Select the build configuration to use (Debug/Release/RelWithDebInfo/MinSizeRel).
  3. Build the solution.
  4. Built files can be found in build/<project name>/<build configuration>/.

OpenJK makes use of some standard C/C++ headers which aren't available by default in older versions of Visual Studio. Please make sure you're running the latest version of Visual Studio!

Linux/OS X

Simply run make from the build folder. On multicore CPUs, you can improve the speed of compilation by passing the -j option: make -jN, Where N is the number of cores in your CPU.

This will build all the projects. Individual projects can be built by passing the project names as arguments to make:

$ make openjk_sp.i386

A list of projects can be found by running make help.

If you have set CMAKE_INSTALL_PREFIX correctly, running make install will copy all the built files into their correct places in your GameData folder, ready to run and test.

Linux and multiarch builds

If you are attempting to build 32-bit binaries under 64-bit Linux, chances are you will be able to make use of multiarch support in most modern Linux distros. If you are having problems, then we suggest creating a 32-bit chroot and building inside of the chroot. This is what we do for our automated builds!


If you set the install prefix as mentioned before, you have already moved the files and can skip to the part where we rename the binaries for use in Steam.

Now that you have built binaries for the game, you can move them to the appropriate places.

  1. Find your Jedi Academy GameData folder. If you're using Steam, it should be in <steam folder>/steamapps/common/Jedi Academy/GameData.
  2. Delete all files currently in this folder with the exception of SDL2.dll, version.inf, OpenAL32.dll, and the base folder. (Alternatively, move them to some other place (such as a subfolder, like _original_files) in case you need to restore the original Jedi Academy binaries).
  3. Move all the folders generated by compiling in the previous step to this folder. This should include files like openjk.ARCH, openjk_sp.ARCH, jagamex86.dll/so, etc.
  4. Rename openjk.ARCH(.exe) to jamp(.exe)
  5. Rename openjk_sp.ARCH(.exe) to jasp(.exe)
  6. You're done! You can now launch OpenJK singleplayer by running jasp, or multiplayer by running jamp!

Compiling OpenJO

Some users wish to compile OpenJO (Jedi Outcast) instead of just Jedi Academy. Due to possible bugs and lack of support, OpenJO compilation is disabled by default. Additionally, there is no multiplayer OpenJO build support at this time. To enable OpenJO compilation, follow these steps:

  1. Edit CMakeLists.txt in the repository directory.
  2. Change the BuildJK2SPEngine, BuildJK2SPGame, and BuildJK2SPRdVanilla options to ON.
  3. Follow the 'Getting the Dependencies', 'Generating Project Files', 'Compiling', and 'Installing' sections above.
  4. In your Jedi Outcast GameData folder, delete/move all existing files except for the base folder and version.inf.
  5. Copy the following files from the Jedi Academy GameData to the Jedi Outcast GameData:
  • cgamex86.dll/so, uix86.dll/so,
  • SDL2.dll/so, OpenAL32.dll/so,
  • jospgamex86.dll/so, rdjosp-vanilla_x86.dll/so
  1. Copy openjo_sp(.exe) from the Jedi Academy GameData to the Jedi Outcast GameData and rename it to jk2sp(.exe).
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.