How to compile

From The Cataclysm: Dark Days Ahead Wiki
Revision as of 10:57, 31 March 2013 by Kenoxite (talk | contribs) (Just copied TDW's post here. Edited it and formatted it accordingly)
Jump to navigation Jump to search

Windows

There are a few ways to run Cataclysm-DDA in windows.

Cygwin

Start off by downloading cygwin from the official site. Follow the download instructions on the site, and select all of the following packages when prompted to:

  • make
  • G++
  • libncurses-dev
  • libncursesw-dev
  • git

Compile

Once it's finished installing, run the program which should open a terminal window, from there, type:

git clone git://github.com/TheDarklingWolf/Cataclysm-DDA.git

Wait for it to finish downloading, then type:

cd Cataclysm-DDA

Once in the folder type:

make

At this point, Cataclysm should begin compiling. Once it finishes compiling, type:

./cataclysm

in order to run it.

Run

In order to run Cataclysm in the future, you need to open Cygwin, type:

cd Cataclysm-DDA

and type:

./cataclysm

Update

To update, simply open the folder and type:

git pull

then:

Make clean

and:

make


MinGW & Msys

To start, you'll need the MinGW + MSYS bundle. Then grab the game's source and unpack it somewhere.

Run the MinGW shell, navigate to the code directory and type:

make -f makefile.windows

Once compiled, run the executable (cataclysm.exe) located in that directory.

Note: To redistribute, you only need the data folder and executable.


Linux

First, open the terminal. On Ubuntu, it is accessible under Applications / Accessories. Now, let's install the dependencies we'll need. It may ask you to type in your password or Y to confirm. Do it and continue.

sudo apt-get install libncurses5-dev libncursesw5-dev g++ git-core

This is it. Now to pull the source. You're likely in your "home" or "root" directory in the terminal. You can use ls to list the directories and cd to move into them. Once you are where you want the source to be, type:

git clone git://github.com/TheDarklingWolf/Cataclysm-DDA.git

This'll make a directory called Cataclysm-DDA and pull the source into it. It might take a while.

Type cd Cataclysm-DDA to move into the directory. Now type make to compile it. If it fails, try make clean.

If it works, try running the game with ./cataclysm. If that also works, you're ready to mod.

To update the game, move into the game directory and write "git pull". Afterwards, type make clean (which clears all object files and such) and make. There, updated!


Mac

Mac is the least supported platform, due to almost nobody owning one. Still, it seems it's pretty much solid, some errors notwithstanding.

Fixing errors

You might get these errors when compiling:

error: no matching function for call to `player_activity::player_activity(player_activity)'
note: candidates are: player_activity::player_activity(player_activity&)

This is due to non-const copy constructors (see this), which some C++ compilers just kludge for you with auto pointer magic... and others don't (like recent XCode GCC).

To fix this change:

pldata.h:113 player_activity(player_activity &copy)

to:

pldata.h:113 player_activity(player_activity const &copy)

You'll also need to change:

npc.h:197 npc_opinion(npc_opinion &copy)

to:

npc.h:197 npc_opinion(npc_opinion const &copy)

And, finally, force a 32-bit executable:

Makefile:8  OTHERS = -O3 -m32

Compile

Mac OS doesn't have apt-get, so you'll need something like Fink or MacPorts to get that. Other than that, the setup is pretty much the same as with Linux.

Now, let's install the dependencies we'll need. It may ask you to type in your password or Y to confirm. Do it and continue.

sudo apt-get install libncurses5-dev libncursesw5-dev g++ git-core

This is it. Now to pull the source. You're likely in your "home" or "root" directory in the terminal. You can use "ls" to list the directories and "cd" to move into them. Once you are where you want the source to be, type:

git clone git://github.com/TheDarklingWolf/Cataclysm-DDA.git

This'll make a directory called Cataclysm-DDA and pull the source into it. It might take a while.

Type:

cd Cataclysm-DDA

to move into the directory. Now type:

make

to compile it. If it fails, try:

make clean

If it works, try running the game with:

./cataclysm

If that also works, you're ready to mod.

Note: Mac OS's terminal is normally set to 8-bit colors. Set it to 16-bit colors to get the colors needed for Cataclysm. An alternative may be to check the "display bright colours for bold text" on in terminal preferences / text tab.

To update the game, move into the game directory and write:

git pull

Afterwards, type:

make clean

Then:

make

There, updated!