I finally got it to work somewhat. It’s kind of a dirty setup, but it worked…
To clarify I’m using Visual Studio 2015 Community.
Sorry if this is a super long and messy guide, but maybe reading it will help someone else set VS2015 up.
There may also be errors as I did this over the course of 2 days, usually in the evening and after midnight, and I tried a lot of things so I might not be 100% sure exactly which step was the correct one…
The order I describe this in is likely not the same order I tried everything in…
Anyway, this is a good place to start
I started with the project to build an x64 Release.
It was a bit messy with the include paths and libs. For instance it expectes all SDL h-files to be in the same directory and it has to be called SDL2. Because:
In [tt]stdafx.h[/tt] you find:
[code]# include <SDL2/SDL.h>
include <SDL2/SDL_ttf.h>
include <SDL2/SDL_image.h>
if defined(SDL_SOUND)
include <SDL2/SDL_mixer.h>
[/code]
and in [tt]cata_tiles.h[/tt] you see:
So you either change the code, or need to have add two paths to the include dir paths in the project config (path to SDL2 folder and path into SDL2 folder).
However getting the SDL h-files and libs in order were the easiest part. Just download and place them where the compiler/linker is looking for them and fix the paths.
I noticed, the first thing in the build output the compiler begins by running LUA to generate a cpp file. The instructions tell you how to compile the library but don’t mention need for an executable.
This I had to download. I think I got this one:
http://netix.dl.sourceforge.net/project/luabinaries/5.3.3/Tools%20Executables/lua-5.3.3_Win32_bin.zip
and then just unpacked the archive in [tt]src\lua[/tt] where it seemd to look for it renamed the executable to [tt]lua.exe[/tt]. That got past the first code generation step.
Building LUA lib was a bit messy.
The instructions tell you to how to compile it, but VS2015 (my installation at least) defaults to the x86 compiler.
To fix this there’s a bat script you can run to setup x64 compilation.
There are 32-bit compilers and 64-bit compilers for 32-bit targets and 64-bit targets, and depending on which one you want to use it seems you should run the corresponding setup script.
They all begin with the name [tt]vcvars[/tt].
In my case, I tried running this:
[tt]C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat[/tt]
which means run a 32-bit executable and create 64-bit target (which is what I needed).
After running that, I then followed the instructions I found here: https://www.youtube.com/watch?v=X5D_h2X8LCk
which seem to be really close to the compilation guide, but it uses a couple more arguments.
Rename the lib and DLL files as required.
Leave the [tt]#include <libintl.h>[/tt] as is. Don’t change it like I first did in the post above.
Downloading and compiling gettext was a bit of a mess as well.
Please see:
It then seemed to compile fine, but I had problems getting libintl to work so I instead eventually downloaded the stuff from
http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/
In my case:
http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/gettext-runtime-dev_0.18.1.1-2_win64.zip
http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/gettext-runtime_0.18.1.1-2_win64.zip
Rename as required.
The libiconv lib and dll were however usable.
I THINK that was it.
Of course when I tried to run it I then had to copy all the DLLs (SDL, libiconv, etc…) to where Cataclysm.exe was created.
I also had to find and download [tt]libfreetype-6.dll[/tt] which I got from here:
In case I forgot any library or DLL it’s probably easy to see what it is and just copy it to the project root folder.
I then decided to change to Debug x64 to do the debugging stuff.
The include paths and library paths were copied from the Release x64 config.
I got a new compiler error now for some reason. I don’t remember exactly what it was, but it seemed like more of a warning. This could be ignored by adding [tt]_SCL_SECURE_NO_WARNINGS[/tt] to the preprocessor definitions in the project config.
Also, pay close attention to this: https://github.com/CleverRaven/Cataclysm-DDA/blob/master/COMPILING.md#debugging
The VS project file is NOT in the same folder as the Cataclysm.exe, so you need those two [tt]…[/tt] added to make it work.
After all that I could FINALLY build and debug!
A minor annoyance is that the ^-key works differently when I compile myself. In the pre-built downloaded binaries it works with a single keypress, but when I build myself I have to press the key twice. It’s this key that makes you write ô and stuff like that, so it just eats the first keypress. I don’t know why that differs, but… meh…
Again, sorry for the messy “instructions”.