How to compile: Difference between revisions

From The Cataclysm: Dark Days Ahead Wiki
Jump to navigation Jump to search
No edit summary
(Just copied TDW's post here. Edited it and formatted it accordingly)
Line 1: Line 1:
= How to Compile, Debug and Mod Cataclysm:DDA =
== Windows ==
There are a few ways to run Cataclysm-DDA in windows.


[http://www.cataclysmdda.com/smf/index.php?topic=3.0 The Darkling Wolf's Forum post on Downloading and Compiling the Game in Windows, Linux and OSX]
=== Cygwin===
Start off by downloading cygwin from the [http://www.cygwin.com/ 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


That's all we got for now.
==== Compile ====
Once it's finished installing, run the program which should open a terminal window, from there, type:


git clone <nowiki>git://github.com/TheDarklingWolf/Cataclysm-DDA.git</nowiki>


---
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 [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ MinGW + MSYS bundle]. Then grab [https://github.com/TheDarklingWolf/Cataclysm-DDA/archive/master.zip 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 <nowiki>git://github.com/TheDarklingWolf/Cataclysm-DDA.git</nowiki>
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 [http://stackoverflow.com/questions/9622089/g-and-non-const-copy-constructor-issue 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 <nowiki>git://github.com/TheDarklingWolf/Cataclysm-DDA.git</nowiki>
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!
 
 
----
*[[LuaMod]]
*[[LuaMod]]
*Automated Source code Documentation
*Automated Source code Documentation

Revision as of 10:57, 31 March 2013

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!