Downloading and Compiling under Windows: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
(update the wiki page for the current VS versio)
Line 5: Line 5:
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}}]]


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...
Here's a quick guide describing how to compile and debug Arx Fatalis under Windows using Visual Studio 2013. It should also work using Visual Studio 2013 or older, given that you generate the right projects using CMake. Paths used here are only to give as an example...


== Applications ==
== Step 1: Download Required Applications ==


* Visual C++ 2010 Express Edition: http://www.microsoft.com/express/Downloads/
* '''Visual C++ 2013 Express Edition'''
** You can optionally install Visual Studio 2010 Service Pack 1: http://www.microsoft.com/express/Downloads/#2010-Service-Pack-1
**[http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Download here]
** Other Visual Studio version should also work.
** Other Visual Studio version should also work.
* CMake: http://www.cmake.org/cmake/resources/software.html
* '''CMake'''
** [http://www.cmake.org/cmake/resources/software.html Download here]
**Make sure you add cmake to your PATH so that you can use it from the command line.  
**Make sure you add cmake to your PATH so that you can use it from the command line.  
** For CMake installation guide, please visit http://johnlamp.net/cmake-tutorial-1-getting-started.html
** For CMake installation guide, please visit http://johnlamp.net/cmake-tutorial-1-getting-started.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 Download here]
** In the installer, make sure you check msys-base
** In the installer, make sure you check msys-base
** For MinGW installation guide, please visit http://ingar.satgnu.net/devenv/mingw32/base.html.
** For MinGW installation guide, please visit http://ingar.satgnu.net/devenv/mingw32/base.html.
* msysgit: http://git-scm.com/downloads
* '''msysgit'''
* Optional: TortoiseGit: http://code.google.com/p/tortoisegit/
**[http://git-scm.com/downloads Download here]
* Optional: Doxygen :http://www.stack.nl/~dimitri/doxygen/ for developer documentation
* Optional: '''TortoiseGit''': For better Git GUI [http://code.google.com/p/tortoisegit/ Download here]
* Optional: Qt5: http://qt-project.org/wiki/Qt_5.0 for building crash reporters and profiler
* Optional: '''Doxygen''' :For developer documentation [http://www.stack.nl/~dimitri/doxygen/ Download here]
* Optional: '''Qt5''': For building crash reporters and profiler [http://qt-project.org/wiki/Qt_5.0 Download here]
** Profiler helps to determine why some frames are slower than others.
** Profiler helps to determine why some frames are slower than others.


== Getting the libraries ==
=== Optional Application ===


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 simplify the process. Arx Libertatis depends on the following libraries on Windows.
If you want to use the crash reporter or profiler, you need to [http://www.qt.io/download/ download and install Qt5]. You also need to append the full path to Qt's msvc2013 directory to your <code>CMAKE_PREFIX_PATH</code>. The Qt's msvc2013 directory is under Qt\5.4 folder.
 
== Step 2: 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 under [https://github.com/arx/ArxWindows ArxWindow repo] (both 32-bit and 64-bit) to simplify the process. Arx Libertatis depends on the following libraries on Windows.


* <code>SDL</code> 1.2.10 or newer, <code>SDL</code> 2 recommended (http://www.libsdl.org/)
* <code>SDL</code> 1.2.10 or newer, <code>SDL</code> 2 recommended (http://www.libsdl.org/)
Line 37: Line 44:
* <code>FreeType</code> 2.3.0 or newer (http://www.freetype.org/)
* <code>FreeType</code> 2.3.0 or newer (http://www.freetype.org/)


1. The ArxWindows repo only contains the Boost source, it doesn't contain any prebuilt libraries - those aren't needed for AL.
1. The ArxWindows repo only contains the Boost source, it doesn't contain any prebuilt libraries - those aren't needed for Arx Libertatis.
 
2. 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. 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.


If you using the pre-built libraries from the ArxWindows repo, all of these should be included for you.
If you using the pre-built libraries from the ArxWindows repo, all of these should be included for you.


'''Here's how to obtain them:'''
===Here's how to obtain them:===


In GitBash
In GitBash
Line 59: Line 67:
  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
  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


=== Optional dependencies ===
== Step 3: Getting the source code ==
 
If you want to use the crash reporter or profiler, you need to [http://www.qt.io/download/ download and install Qt5]. You also need to append the full path to Qt's msvc2010 directory to your <code>CMAKE_PREFIX_PATH</code>.
 
== Getting the source code ==


{{GetTheSourceCode}}
{{GetTheSourceCode}}


== Generating VC++ projects ==
== Step 4: Generating VC++ projects ==


We'll use CMake for that in GitBash:
We'll use CMake for that in GitBash:
  mkdir build_vc10
  mkdir build_vc12
  cd build_vc10
  cd build_vc12
  cmake .. -G "Visual Studio 10" -DUNITY_BUILD=ON
  cmake .. -G "Visual Studio 12" -DUNITY_BUILD=ON


* "Visual Studio 10" in the command refers to using Visual Studio 2010 to generate the project. If you are using Visual Studio 2012, use ""Visual Studio 11" instead. Use the following command to check the available compilers on your computer.
* "Visual Studio 12" in the command refers to using Visual Studio 2013 to generate the project. If you are using Visual Studio 2012, use ""Visual Studio 11" instead. Use <code>cmake --help</code> to check the available compilers on your computer.
cmake --help
* -DUNITY_BUILD=ON enables building of each program as one big source file. This is somewhat like link-time optimization but provides faster builds as each header only needs to be parsed once for the whole executable. It also prevents incremental builds - if you plan on using <code>git bisect</code> or trying a lot of small changes, consider leaving it out.
* -DUNITY_BUILD=ON enables building of each program as one big source file. This is somewhat like link-time optimization but provides faster builds as each header only needs to be parsed once for the whole executable. It also prevents incremental builds - if you plan on using <code>git bisect</code> or trying a lot of small changes, consider leaving it out.


For further build options, please refer to the [https://github.com/arx/ArxLibertatis/blob/master/README.md#build-options README file].
For further build options, please refer to the [https://github.com/arx/ArxLibertatis/blob/master/README.md#build-options README file].


== Building Arx Libertatis ==
== Step 5: Building Arx Libertatis ==


Build the whole solution (ArxLibertatis.sln) in Visual Studio: C:\Code\git\ArxLibertatis\build_vc10\ArxLibertatis.sln as shown in the picture.<br>
Build the whole solution (ArxLibertatis.sln) in Visual Studio: C:\Code\git\ArxLibertatis\build_vc10\ArxLibertatis.sln as shown in the picture.<br>
Line 89: Line 92:
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)


== Installing the data files ==
== Step 6: Installing the data files ==


After [[getting the game data]], you need to put the files in the correct location for Arx Libertatis to find them.
After [[getting the game data]], you need to put the data files in the correct location for Arx Libertatis to find them.


By default, Arx Libertatis searches for data files (from the original game) under the following paths.:
By default, Arx Libertatis searches for data files (from the original game) under the following paths.:
Line 98: Line 101:
* <code>C:\Users\[YOUR NAME]\Saved Games\Arx Libertatis</code>
* <code>C:\Users\[YOUR NAME]\Saved Games\Arx Libertatis</code>
Simply place your data file into one of these directories.
Simply place your data file into one of these directories.
**If you want to specify your own data file location, create a Window registry key HKCU\Software\ArxLibertatis\DataDir with the value pointing to your game data directory.
** Arx Libertatis only needs the following game data file:
***data.pak
***data2.pak
***loc.pak
***sfx.pak
***speech.pak


Finally, copy the necessary dlls to <code>C:\Code\git\ArxLibertatis\build_vc10\Debug</code> because that's where your arx.exe is located
Finally, copy the necessary dlls to <code>C:\Code\git\ArxLibertatis\build_vc10\Debug</code> because that's where your arx.exe is located
  C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll
  C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll \\if you are using 32-bit Windows
  C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll
  C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll \\if you are using 64-bit Windows


The complete search path is described on the [[Data directories]] page.
The complete search path is described on the [[Data directories]] page.


== Running Arx Libertatis ==
== Step 7: Running Arx Libertatis ==


Simply click on <code>arx.exe</code> under <code>C:\Code\git\ArxLibertatis\build_vc10\Debug</code>
Simply click on <code>arx.exe</code> under <code>C:\Code\git\ArxLibertatis\build_vc12\Debug</code>


== Debugging ArxLibertatis ==
== Step 8: Debugging ArxLibertatis ==


* Right click on the arx project and select "Properties..."
* Right click on the arx project under the Solution Explorer in Visual Studio 2013
* Go to "Configuration Properties->Debugging"
* Select "Set as StartUp Project"
* Change the "Working Directoy" property to "..\bin"
* Change full_screen to false in %USERPROFILE%\Saved Games\Arx Libertatis\cfg.ini, as debugging with a fullscreen windows is a pain.
** Note that this needs to be done for each target you wish to build/debug
**Otherwise, you can change to full_screen after you run the game.
* 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
* Click the "debug" button (F5) and enjoy :D

Revision as of 08:09, 13 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 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 2013. It should also work using Visual Studio 2013 or older, given that you generate the right projects using CMake. Paths used here are only to give as an example...

Step 1: Download Required Applications

Optional Application

If you want to use the crash reporter or profiler, you need to download and install Qt5. You also need to append the full path to Qt's msvc2013 directory to your CMAKE_PREFIX_PATH. The Qt's msvc2013 directory is under Qt\5.4 folder.

Step 2: 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 under ArxWindow repo (both 32-bit and 64-bit) to simplify the process. Arx Libertatis depends on the following libraries on Windows.

1. The ArxWindows repo only contains the Boost source, it doesn't contain any prebuilt libraries - those aren't needed for Arx Libertatis.

2. 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.

If you using the pre-built libraries from the ArxWindows repo, all of these should be included for you.

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

On Windows 7 or later this can be done here:
Win7 env.png

After that, you need to start a new prompt (GitBash, Command Prompt, etc) so that the new environment variables are available.

Run the following to check if you set 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

Step 3: Getting the source code

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.

Step 4: Generating VC++ projects

We'll use CMake for that in GitBash:

mkdir build_vc12
cd build_vc12
cmake .. -G "Visual Studio 12" -DUNITY_BUILD=ON
  • "Visual Studio 12" in the command refers to using Visual Studio 2013 to generate the project. If you are using Visual Studio 2012, use ""Visual Studio 11" instead. Use cmake --help to check the available compilers on your computer.
  • -DUNITY_BUILD=ON enables building of each program as one big source file. This is somewhat like link-time optimization but provides faster builds as each header only needs to be parsed once for the whole executable. It also prevents incremental builds - if you plan on using git bisect or trying a lot of small changes, consider leaving it out.

For further build options, please refer to the README file.

Step 5: Building Arx Libertatis

Build the whole solution (ArxLibertatis.sln) in Visual Studio: C:\Code\git\ArxLibertatis\build_vc10\ArxLibertatis.sln as shown in the picture.
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.

You can build the debug target (has debug symbols & can be debugged) or the release target (faster, but currently without debug information)

Step 6: Installing the data files

After getting the game data, you need to put the data files in the correct location for Arx Libertatis to find them.

By default, Arx Libertatis searches for data files (from the original game) under the following paths.:

  • C:\Code\git\ArxLibertatis\build_vc10 <--preferred
  • C:\Code\git\ArxLibertatis\data\core
  • C:\Users\[YOUR NAME]\Saved Games\Arx Libertatis

Simply place your data file into one of these directories.

    • If you want to specify your own data file location, create a Window registry key HKCU\Software\ArxLibertatis\DataDir with the value pointing to your game data directory.
    • Arx Libertatis only needs the following game data file:
      • data.pak
      • data2.pak
      • loc.pak
      • sfx.pak
      • speech.pak

Finally, copy the necessary dlls to C:\Code\git\ArxLibertatis\build_vc10\Debug because that's where your arx.exe is located

C:\Code\git\ArxWindows\libs\sdl\bin\SDL32.dll  \\if you are using 32-bit Windows
C:\Code\git\ArxWindows\libs\sdl\bin\SDL64.dll  \\if you are using 64-bit Windows

The complete search path is described on the Data directories page.

Step 7: Running Arx Libertatis

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

Step 8: Debugging ArxLibertatis

  • Right click on the arx project under the Solution Explorer in Visual Studio 2013
  • Select "Set as StartUp Project"
  • Change full_screen to false in %USERPROFILE%\Saved Games\Arx Libertatis\cfg.ini, as debugging with a fullscreen windows is a pain.
    • Otherwise, you can change to full_screen after you run the game.
  • Click the "debug" button (F5) and enjoy :D