Difference between revisions of "Compiling using CMake"

From OdaWiki
(Server notes)
(Client notes)
Line 50: Line 50:
 
* odamex.wad from the base odamex SVN checkout folder.
 
* odamex.wad from the base odamex SVN checkout folder.
 
* A DOOM IWAD from one of your installations of DOOM.
 
* A DOOM IWAD from one of your installations of DOOM.
...into the folder where odamex.exe is.  The location of odamex.exe depends on your compiler.  For Visual Studio, it depends on what software configuration you used when compiling the client, the default is "Debug" so that's the subfolder of your build folder that you should look in.
+
...into the folder where odamex.exe is.  It is either located in the ''client'' subfolder of your build folder, or in one of the subfolders within ''client''.
  
 
==== Server notes ====
 
==== Server notes ====

Revision as of 00:27, 10 July 2011

According to the Wikipedia page, CMake is a unified, cross-platform, open-source build system that enables developers to build, test and package software by specifying build parameters in simple, portable text files. It works in a compiler-independent manner and the build process works in conjunction with native build environments, such as make, Apple's Xcode and Microsoft Visual Studio. It also has minimal dependencies, C++ only. CMake is open source software and is developed by Kitware.

CMake can:

  • Create libraries
  • Generate wrappers
  • Compile source code
  • Build executables in arbitrary combinations

Since the CMake build files are not in Odamex's source tree yet, you can grab a patch file that can be applied against the base directory of an SVN checkout link here. The correct patch is by Alexander Mayfield, the one by Albert Brown has not been updated since 2007.

Windows

Installing CMake

The latest version of CMake can be downloaded from Kitware's website here.

Compiling Odamex

Once you have Odamex checked out from SVN, start cmake-gui. From there, you need to fill out two pieces of information:

  • Where is the source code: Pick out the folder where you checked out Odamex.
  • Where to build the binaries: Create a folder somewhere where you would like the project files or makefile to be stored. If you're not sure where to put it, create a new folder called build in the folder where you checked out Odamex.

Once you've done that, click the button that says "Configure". A box should pop up asking you for a "generator". The choice you make here will vary depending on your compiler:

  • Visual Studio 8 2005: For compiling with Visual Studio 2005
  • Visual Studio 9 2008: For compiling with Visual Studio 2008
  • Visual Studio 10: For compiling with Visual Studio 2010

Make sure "Use default native compilers" is selected before hitting Finish.

Now, at this point you will see some output from CMake. Once it finishes, you might notice that there are a few warning messages that pop up saying that CMake can't find SDL.

  • If you are not interested in compiling the client, you can ignore those warnings and click Generate.
  • If you want to compile the client, select the row in the upper box that says "SDLDIR" and click on the button with three dots in it. Once you see the folder dialog, select the folder where you extracted SDL to and hit OK. Repeat the process for "SDLMIXERDIR" except this time you are looking for the folder where you extracted SDL_mixer to. From there, click Configure again and this time you should get no warnings, so click Generate.

If you take a look at the folder that you selected for Where to build the binaries, you should now see a bunch of new files. What you do now depends on your compiler:

Visual Studio 2010

Double click on the .sln file to open it. If you want to build all three projects simply hit F7 to build the entire solution, otherwise simply right click on the project you want to compile in the Solution Explorer and click Build. From there, you can individually right click on each project in the Solution Explorer and click Debug -> Start new instance to launch the given project.

Running Odamex

The first time you run the client or server, you might run into some issues.

Client notes

The first time you run the client after building it, you will get an error message about a missing SDL.dll file. You need to copy:

  • SDL.dll from the SDL Development Library's lib folder.
  • All of the DLL files from the SDL_mixer Development Library's lib folder.
  • odamex.wad from the base odamex SVN checkout folder.
  • A DOOM IWAD from one of your installations of DOOM.

...into the folder where odamex.exe is. It is either located in the client subfolder of your build folder, or in one of the subfolders within client.

Server notes

The first time you build the server after building it, you will get an error message about not being able to find odamex.wad. You need to copy:

  • odamex.wad from the base odamex SVN checkout folder.
  • A DOOM IWAD from one of your installations of DOOM.

...into the folder where odasrv.exe is. It is either located in the server subfolder of your build folder, or in one of the subfolders within server.

Linux

Compiling Odamex using CMake has been tested on Debian Linux 6.0. The instructions for the other distributions have been inferred using available documentation. If you are having trouble with a specific configuration, please add a response to this bug.

Installing CMake

Depending on your Linux distribution, you may or may not have a copy of CMake in your software repository. Even if you do, the version that is available might not be up-to-date. The following distributions have a version of CMake 2.8, which is what the current build script requires.

  • Debian 6.0: CMake 2.8.2 aptitude install cmake
  • Fedora 15: CMake 2.8.4 yum install cmake
  • openSUSE 11.4: CMake 2.8.3 zypper in cmake
  • Slackware 13.37 CMake 2.8.4 pkgtool
  • Ubuntu 10.04 LTS: CMake 2.8.0 apt-get install cmake
  • Ubuntu 11.04: CMake 2.8.3 apt-get install cmake

The following distributions have an out-of-date version of CMake. You are welcome to bypass the version check and see if it still works. Assuming that there isn't too much breakage and workarounds needed to support it, "official" support for CMake 2.6 will be considered.

  • CentOS 5.x: CMake 2.6.4 (through EPEL) yum install cmake
  • Debian 5.0: CMake 2.6.0 aptitude install cmake
  • Red Hat Enterprise Linux 5.x: CMake 2.6.4 (through EPEL) yum install cmake
  • Scientific Linux 5.x: CMake 2.6.4 (through EPEL) yum install cmake

If you do not have an up-to-date CMake, or would prefer to use the absolute latest version, both binary and source tarballs can be downloaded here.

FreeBSD

FreeBSD has CMake in its ports tree as a port and a package.

  • Package: pkg_add -r cmake
  • Port: cd /usr/ports/devel/cmake && make install clean