Downloading and Compiling under Windows: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
(Remove references to Visual Studio 2008)
m (update the directories, changing some use of words, adding some line to help others understand)
Line 3: Line 3:


This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under {{Windows}}.<br>
This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under {{Windows}}.<br>
There is also a easier way to compile Arx Libertatis using the binary version http://wiki.arx-libertatis.org/Download. This instruction is mainly for developers who want the debug function as well.
There are also instructions available for [[Downloading and Compiling under Linux|{{Linux}} / {{FreeBSD}}]] and [[Downloading and Compiling under Mac OS X|{{MacOSX}}]]
There are also instructions available for [[Downloading and Compiling under Linux|{{Linux}} / {{FreeBSD}}]] and [[Downloading and Compiling under Mac OS X|{{MacOSX}}]]


Line 12: Line 13:
* CMake: http://www.cmake.org/cmake/resources/software.html
* CMake: http://www.cmake.org/cmake/resources/software.html
* MinGW: http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst
* MinGW: http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst
** In the installer, make sure you check MSYS
** In the installer, make sure you check msys-base
* msysgit: Follow the setup described on GitHub: http://help.github.com/win-set-up-git/
** For installing MinGW guide, please visit http://ingar.satgnu.net/devenv/mingw32/base.html.
* msysgit: http://git-scm.com/downloads
* Optional: TortoiseGit: http://code.google.com/p/tortoisegit/
* Optional: TortoiseGit: http://code.google.com/p/tortoisegit/


== Getting the libs ==
== Getting the libraries ==
Getting all libraries to work under Windows required a lot of work and was error prone... So we decided to provide prebuilt versions (32-bit and 64-bit) to simply the process.  
Getting all libraries to work under Windows required a lot of work and was error prone... So we decided to provide pre-built versions (32-bit and 64-bit) to simply the process.  
Arx Libertatis depends on the following libraries on Windows. Those followed by an asterisk are optional; depending on which backend you want to use they might not be needed.
Arx Libertatis depends on the following libraries on Windows. Those followed by an asterisk are optional; depending on which backend you want to use they might not be needed.
* Boost - ArxWindows only contains the Boost source, it doesn't contain any prebuilt libraries, but those aren't needed for arx.
* Boost - ArxWindows only contains the Boost source, it doesn't contain any prebuilt libraries, but those aren't needed for arx.
Line 29: Line 31:


1. We strongly recommend you use the [OpenAL Soft](http://kcat.strangesoft.net/openal.html) implementation of OpenAL. Creative's OpenAL implementation is severely limited, which can cause missing sounds in arx. OAL implementations from IHVs are just buggy and the cause for many crash reports.
1. We strongly recommend you use the [OpenAL Soft](http://kcat.strangesoft.net/openal.html) implementation of OpenAL. Creative's OpenAL implementation is severely limited, which can cause missing sounds in arx. OAL implementations from IHVs are just buggy and the cause for many crash reports.
2. If you using the pre-built libraries from the Arx Libertatis, you don't need to worry about the above issue.


'''Here's how to obtain them:'''
'''Here's how to obtain them:'''
Line 36: Line 39:
  git clone --depth 1 git://github.com/arx/ArxWindows.git
  git clone --depth 1 git://github.com/arx/ArxWindows.git


Then we need to tell cmake where to search for our libs
Then we need to tell cmake where to search for our libraries
* Add CMAKE_PREFIX_PATH to your environment variable:
* Add CMAKE_PREFIX_PATH to your environment variable:
** CMAKE_PREFIX_PATH=C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp
** CMAKE_PREFIX_PATH=C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp
*** if on windows 7 then here: http://arx.parpg.net/File:Win7_env.png
*** if on windows 7 then here: http://arx.parpg.net/File:Win7_env.png
* After that, you need to start a new prompt (GitBash, Command Prompt, etc) so that the new environment variable is available
* After that, you need to start a new prompt (GitBash, Command Prompt, etc) so that the new environment variable is available
* Start a new GitBash instance
* Start a new GitBash instance
** Run the following: echo $CMAKE_PREFIX_PATH
** Run the following to check it you make the cmake path correctly or not: echo $CMAKE_PREFIX_PATH
** It should echo: C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp
** It should echo: C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp
Finally, copy the necessary dlls to C:\Code\git\ArxFatalis\bin\...
C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll
C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll


== Getting the source code ==
== Getting the source code ==
Line 62: Line 62:
== Generating VC++ projects ==
== Generating VC++ projects ==
We'll use CMake for that
We'll use CMake for that
In GitBash
  mkdir build_vc10
  mkdir build_vc10
  cd build_vc10
  cd build_vc10
  cmake .. -G "Visual Studio 10" -DUNITY_BUILD=1
  cmake .. -G "Visual Studio 10" -DUNITY_BUILD=1 -DBUILD_CRASHREPORTER=OFF -DBUILD_PROFILER=OFF
*Note that here we disable crash reporter and profiler to avoid the "Cannot find QApplication" error.


== Building ArxFatalis ==
== Building ArxFatalis ==
* Open the solution in Visual Studio: C:\Code\git\ArxFatalis\build_vc10\ArxFatalis.sln
* Open the solution in Visual Studio: C:\Code\git\ArxLibertatis\build_vc10\ArxLibertatis.sln as shown in this picture:[[File:BuildSolution.png]]
** If you use Visual C++ 2010, there's a bug causing all cpp files to be place in the root of the project... it is annoying but has no effect on the build itself. See http://public.kitware.com/Bug/view.php?id=11925.
** If you use Visual C++ 2010, there's a bug causing all cpp files to be place in the root of the project... it is annoying but has no effect on the build itself. See http://public.kitware.com/Bug/view.php?id=11925.
* You can build the debug target (has debug symbols & can be debugged) or the release target (faster, but currently without debug information)
* You can build the debug target (has debug symbols & can be debugged) or the release target (faster, but currently without debug information)


== Debugging ArxFatalis ==
== Copying Data File ==
* By default, the Arx Liberatis search for data file (original game file) under the following three paths.
**C:\Code\git\ArxLibertatis\build_vc10
**C:\Code\git\ArxLibertatis\data\core
**C:\Users\[YOUR NAME]\Saved Games\Arx Libertatis
*So simply place your data file into one of the three directories.
*Finally, copy the necessary dlls to C:\Code\git\ArxLibertatis\build_vc10\Debug because that's where your arx.exe located
C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll
C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll
 
== Running ArxLibertatis ==
*Simply click on arx.exe under C:\Code\git\ArxLibertatis\build_vc10\Debug
 
== Debugging ArxLibertatis ==
* Right click on the arx project and select "Properties..."
* Right click on the arx project and select "Properties..."
* Go to "Configuration Properties->Debugging"
* Go to "Configuration Properties->Debugging"

Revision as of 08:04, 9 December 2014

ℹ️  This page describes compiling Arx Libertatis from source under Windows and assumes some familiarity with the command-line. If you just want to play the game, it might be easier to grab a binary release or snapshot if available.


This page documents how to compile Arx Libertatis from https://github.com/arx/ArxLibertatis under Windows.
There is also a easier way to compile Arx Libertatis using the binary version http://wiki.arx-libertatis.org/Download. This instruction is mainly for developers who want the debug function as well. There are also instructions available for Linux / FreeBSD and macOS

Here's a quick guide describing how to compile and debug Arx Fatalis under Windows using Visual Studio 2010. It should also work using Visual Studio 2012 or newer, given that you generate the right projects using CMake. Paths used here are only to give as an example...

Applications

Getting the libraries

Getting all libraries to work under Windows required a lot of work and was error prone... So we decided to provide pre-built versions (32-bit and 64-bit) to simply the process. Arx Libertatis depends on the following libraries on Windows. Those followed by an asterisk are optional; depending on which backend you want to use they might not be needed.

  • Boost - ArxWindows only contains the Boost source, it doesn't contain any prebuilt libraries, but those aren't needed for arx.
  • GLM
  • FreeType
  • OpenAL 1
  • OpenGL
  • GLEW
  • SDL
  • ZLib

1. We strongly recommend you use the [OpenAL Soft](http://kcat.strangesoft.net/openal.html) implementation of OpenAL. Creative's OpenAL implementation is severely limited, which can cause missing sounds in arx. OAL implementations from IHVs are just buggy and the cause for many crash reports. 2. If you using the pre-built libraries from the Arx Libertatis, you don't need to worry about the above issue.

Here's how to obtain them:

In GitBash

cd /c/Code/git
git clone --depth 1 git://github.com/arx/ArxWindows.git

Then we need to tell cmake where to search for our libraries

  • Add CMAKE_PREFIX_PATH to your environment variable:
    • CMAKE_PREFIX_PATH=C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp
  • After that, you need to start a new prompt (GitBash, Command Prompt, etc) so that the new environment variable is available
  • Start a new GitBash instance
    • Run the following to check it you make the cmake path correctly or not: echo $CMAKE_PREFIX_PATH
    • It should echo: C:\Code\git\ArxWindows\libs\zlib;C:\Code\git\ArxWindows\libs\freetype;C:\Code\git\ArxWindows\libs\openal;C:\Code\git\ArxWindows\libs\boost;C:\Code\git\ArxWindows\libs\glm;C:\Code\git\ArxWindows\libs\opengl;C:\Code\git\ArxWindows\libs\sdl;C:\Code\git\ArxWindows\libs\dbghelp

Getting the source code

In GitBash

cd /c/Code/git
git clone git://github.com/arx/ArxLibertatis.git
cd ArxLibertatis

Alternatively you can download a stable source code release and extract that:


There are several methods to get the Arx Libertatis source code - choose the one that suits you best:

Downloading a released version

The easiest way to get the AL source code is to download a versioned release. This will get you a reasonably up to date copy of the source code that has been tested to work.

Cloning the repository

If you want the absolute latest version of the Arx Libertatis development code and stay up to date, you can clone the AL source code repository. Beware that this will give you the current master development branch that we are actively working on. While the code in that branch should always work, it hasn't undergone any significant testing. If you just want to play the game, consider using a released version instead.

To clone the repository, type:

git clone git://github.com/arx/ArxLibertatis.git

This creates a directory called ArxLibertatis and downloads the current source code from github.

Later if you want to update your local copy of the source code, run

git pull

The git repository does not contain raster images for the icon and logo. These will be generated from scalable versions when building Arx Libertatis, but doing so requires additional dependencies (Inkscape, ImageMagick and OptiPNG). To avoid this, you can instead get the generated images from the ArxLibertatisData repo:

git clone --depth 1 git://github.com/arx/ArxLibertatisData.git

Downloading a snapshot

Alternatively you can download the current snapshot of the source code repository as a .zip or .tar.gz file and extract that:

This will give you the same code as cloning the repository, but won't let you update it without downloading everything again.

Generating VC++ projects

We'll use CMake for that In GitBash

mkdir build_vc10
cd build_vc10
cmake .. -G "Visual Studio 10" -DUNITY_BUILD=1 -DBUILD_CRASHREPORTER=OFF -DBUILD_PROFILER=OFF
  • Note that here we disable crash reporter and profiler to avoid the "Cannot find QApplication" error.

Building ArxFatalis

  • Open the solution in Visual Studio: C:\Code\git\ArxLibertatis\build_vc10\ArxLibertatis.sln as shown in this picture:BuildSolution.png
  • You can build the debug target (has debug symbols & can be debugged) or the release target (faster, but currently without debug information)

Copying Data File

  • By default, the Arx Liberatis search for data file (original game file) under the following three paths.
    • C:\Code\git\ArxLibertatis\build_vc10
    • C:\Code\git\ArxLibertatis\data\core
    • C:\Users\[YOUR NAME]\Saved Games\Arx Libertatis
  • So simply place your data file into one of the three directories.
  • Finally, copy the necessary dlls to C:\Code\git\ArxLibertatis\build_vc10\Debug because that's where your arx.exe located
C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll
C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll

Running ArxLibertatis

  • Simply click on arx.exe under C:\Code\git\ArxLibertatis\build_vc10\Debug

Debugging ArxLibertatis

  • Right click on the arx project and select "Properties..."
  • Go to "Configuration Properties->Debugging"
  • Change the "Working Directoy" property to "..\bin"
    • Note that this needs to be done for each target you wish to build/debug
  • Change full_screen to 0 in bin\cfg.ini, as debugging with a fullscreen dx windows is a pain
  • Click the "debug" button (F5) and enjoy :D