Skip to content
Razish edited this page May 6, 2013 · 22 revisions

The source code for OpenJK, which includes Jedi Outcast and Jedi Academy, can be downloaded from the git repository git@github.com:Razish/OpenJK.git. 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.

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. The following instructions explain how to use CMake.

  1. Get CMake for your platform.
  2. Get the dependencies. In Windows, they're included (although external version of the libraries can be used.) Otherwise, consult the Readme for a list of required libraries, like zlib and OpenAL.
  3. Go to the folder where the OpenJK source code is located, and create a build folder.
  4. In the build folder, run cmake ... The project/make files will now be generated for you for your platform's primary build tool. If you wish to use a different generator to generate different project/makefiles (e.g., generating mingw32 makefiles on Windows), you can specify a generator using the -G flag: cmake .. -G <generator-name>. A list of generators can be found by typing cmake -h.
  5. The generated project/makefile can be found in the build directory.

Linux/Mac OS X CMake notes

  • Building on Linux or Mac OS X requires SDL2.
  • If you wish to build on 64-bit Linux, you should force it to build 32-bit for now, by adding the CMake flags -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 -DCMAKE_SHARED_LINKER_FLAGS=-m32 -DCMAKE_SIZEOF_VOID_P=4
  • If you wish to build on Mac OS X, you should force it to build 32-bit and to use gcc rather than clang, by adding to the CMake commands -DCMAKE_CXX_FLAGS="-m32 -fasm-blocks" -DCMAKE_C_FLAGS=-m32 -DCMAKE_SHARED_LINKER_FLAGS=-m32 -DCMAKE_CXX_COMPILER=g++ -DCMAKE_SIZEOF_VOID_P=4

Compiling

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

Windows

  • Open the OpenJK.sln file in the build folder.
  • Select the build configuration to use (Debug/Release/RelWithDebInfo/MinSizeRel).
  • Build the solution.
  • Built files can be found in build/<project name>/<build configuration>/.

Linux/Mac OS X

  • Run make from the build folder.
  • Built files can be found in the same folder?

Ubuntu and Debian 32-bit step-by-step

Note: If you're running a 64-bit system, setting up the proper 32-bit dependencies and adding the 32-bit build flags can be messy. If possible, I recommend setting up a virtual machine with a 32-bit version of the distro you're running and using that to build.

  1. Before building, install the following system dependencies:
sudo apt-get install build-essential cmake git libopenal1 libopenal-dev nasm zlib1g-dev
  1. Install SDL2 and its development files

There are multiple ways to do this. You can build from source or use a PPA. Building from source works with all Debian-based distros. To do this, first install mercurial:

sudo apt-get install mercurial

install the SDL2 dependencies

sudo apt-get install debhelper dh-autoreconf libasound2-dev libgl1-mesa-dev libpulse-dev libudev-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev

clone the SDL 2 repository:

hg clone http://hg.libsdl.org/SDL SDL2

then change directory into the SDL directory and build the package

cd SDL2
dpkg-buildpackage

If all dependencies were met, you should have several libsdl2 .deb packages. Install them with:

cd ..
sudo dpkg -i libsdl2*.deb
  1. With SDL2 installed, you're ready to clone the OpenJK repository
git clone http://github.org/Razish/OpenJK OpenJK
cd OpenJK
  1. Create a build directory and go into it.
mkdir build
cd build
  1. Run cmake to generate your makefiles and select components to build
cmake -G "Unix Makefiles" -i ../

Enter ON or OFF to the prompts (they default to ON so you can just hit Enter at each prompt to build everything). This will produce a makefile. To compile, run make -jX, where X is the number of cores/threads your computer supports. For instance, on a quad-core i7 with hyper threading, enter -j8.

make -j8

This should build everything. Move the compiled .so files and the .i386 binaries to a folder with your JKA base folder, move all the .so's except rd-vanilla.so into base, and launch the game with one of the .i386 binaries. If you were using a virtual machine to compile, copy the compiled .so's and .i386's out of the VM to your native OS or to another machine running Linux. Virtual machines almost always lack the graphics drivers required to play the game directly.

Clone this wiki locally