Downloading and Compiling under Windows: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
(Changed lib setup to use the ArxDependencies repository)
Line 10: Line 10:
* Optional: TortoiseGit: http://code.google.com/p/tortoisegit/
* Optional: TortoiseGit: http://code.google.com/p/tortoisegit/


== Libraries ==
== Getting the libs ==
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.
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
* DevIL
* DirectX SDK (*)
* FreeType
* OpenAL (*)
* OpenGL (*)
* GLEW (*)
* SDL (*)
* ZLib


=== ZLib - http://www.zlib.net ===
Here's how to obtain them.
* Download the latest version of the "zlib compiled DLL": http://zlib.net/zlib125-dll.zip
** Extract in C:\Code\Libs\zlib
* Download the latest version of the "zlib source code": http://zlib.net/zlib125.zip
** Extract in C:\Code\Libs\zlib-src
* Open this VC10 solution: C:\Code\Libs\zlib-src\contrib\vstudio\vc10\zlibvc.sln
** Build the ReleaseWithoutAsm target
* Copy the generated library
** C:\Code\Libs\zlib-src\contrib\vstudio\vc10\x86\ZlibDllReleaseWithoutAsm\zlibwapi.lib
** To the following location (replace the existing file): C:\Code\Libs\zlib\lib\zdll.lib
* Copy the generated dll
** C:\Code\Libs\zlib-src\contrib\vstudio\vc10\x86\ZlibDllReleaseWithoutAsm\zlibwapi.dll
** To the arx bin folder: C:\Code\git\ArxFatalis\bin\zlibwapi.dll


=== Freetype - http://freetype.sourceforge.net ===
In GitBash
* Download freetype2: http://freetype.sourceforge.net/download.html
cd /c/Code/git
* Extract in C:\Code\Libs\freetype
git clone git@github.com:arx/ArxDependencies.git
* Open VC2008 solution: C:\Code\Libs\freetype\builds\win32\vc2008\freetype.sln"
** VC2010 should convert it without any problem.
Then we need to tell cmake where to search for our libs
** Select the "LIB Release Multithreaded" target
** Build, should give you a lot of warnings but succeed anyway
* Copy the generated library
** C:\Code\Libs\freetype\objs\win32\vc2008\freetype244MT.lib
** To the following location: C:\Code\Libs\freetype\lib\freetype.lib
 
=== DevIL - http://openil.sourceforge.net ===
* Download "DevIL 1.x.y SDK for 32-bit Windows": http://openil.sourceforge.net/download.php
* Extract in "C:\Code\Libs\devil"
* Copy the following DLL
** C:\Code\Libs\devil\lib\DevIL.dll
** To the arx bin folder: C:\Code\git\ArxFatalis\bin\DevIL.dll
 
=== DirectX 7 SDK ===
* Not available anymore from Microsoft... so download it here: http://bcb-tools.com/Downloads/Microsoft/dx7adxf.exe
* Run it, its a setup in a self extracting exe (extracted to C:\dx7asdk\ by default)
* Run the setup
** C:\dx7asdk\DXF\setup.exe
** Install to C:\Code\Libs\directx7
* Add DX7SDK_PATH to your environment variable:
** DX7SDK_PATH=C:\Code\Libs\directx7
*** if on windows 7 then here: http://arx.parpg.net/File:Win7_env.png
 
=== OpenAL - http://connect.creativelabs.com/openal ===
* Download the latest OpenAL Core SDK (an installer) : http://connect.creativelabs.com/openal/Downloads/
** Install SDK to C:\Code\Libs\openal
** Also install redist (can be done from the installer, or run C:\Code\Libs\openal\redist)
* If we ever wish to provide Arx as a standalone package, we'll have to provide OpenAL32.dll alongside our exe
** Can be found under C:\Windows\System32\OpenAL32.dll
 
=== Boost - http://www.boost.org ===
* Download the latest Boost library: http://sourceforge.net/projects/boost/files/boost/
* Extract in "C:\Code\Libs\boost"
* Download prebuilt libraries: http://boost.teeks99.com
* Extract the files and copy the content of the lib32 folder to "C:\Code\Libs\boost\lib"
* Alternatively, instead of downloading the prebuilt libraries, you can compile them yourself (takes a while!):
** Open a command prompt in "C:\Code\Libs\boost" and type:
*** ./boostrap
*** ./b2 --toolset=msvc-10.0 --build-type=complete lib
 
== Configure CMake ==
We need to tell cmake where to search for our libs
* Add CMAKE_PREFIX_PATH to your environment variable:
* Add CMAKE_PREFIX_PATH to your environment variable:
** CMAKE_PREFIX_PATH=C:\Code\Libs\zlib;C:\Code\Libs\freetype;C:\Code\Libs\devil;C:\Code\Libs\devil\include\IL;C:\Code\Libs\openal;C:\Code\Libs\boost
** CMAKE_PREFIX_PATH=C:\Code\git\ArxDependencies\zlib;C:\Code\git\ArxDependencies\freetype;C:\Code\git\ArxDependencies\devil;C:\Code\git\ArxDependencies\openal;C:\Code\git\ArxDependencies\boost;C:\Code\git\ArxDependencies\opengl;C:\Code\git\ArxDependencies\sdl;C:\Code\git\ArxDependencies\directx
*** 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
* 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: echo $CMAKE_PREFIX_PATH
** It should echo: C:\Code\Libs\zlib;C:\Code\Libs\freetype;C:\Code\Libs\devil;C:\Code\Libs\devil\include\IL;C:\Code\Libs\openal
** It should echo: C:\Code\git\ArxDependencies\zlib;C:\Code\git\ArxDependencies\freetype;C:\Code\git\ArxDependencies\devil;C:\Code\git\ArxDependencies\openal;C:\Code\git\ArxDependencies\boost;C:\Code\git\ArxDependencies\opengl;C:\Code\git\ArxDependencies\sdl;C:\Code\git\ArxDependencies\directx
 
Finally, copy the necessary dlls to C:\Code\git\ArxFatalis\bin\...
C:\Code\git\ArxDependencies\devil\bin\DevIL32.dll
C:\Code\git\ArxDependencies\devil\bin\DevIL64.dll
C:\Code\git\ArxDependencies\sdl\bin\SDL32.dll
C:\Code\git\ArxDependencies\sdl\bin\SDL64.dll


== Get the code ==
== Get the code ==

Revision as of 01:07, 29 September 2011

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 2008, given that you generate the right projects using CMake. Paths used here are only to give as an example...

Applications

Getting the libs

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. 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
  • DevIL
  • DirectX SDK (*)
  • FreeType
  • OpenAL (*)
  • OpenGL (*)
  • GLEW (*)
  • SDL (*)
  • ZLib

Here's how to obtain them.

In GitBash

cd /c/Code/git
git clone git@github.com:arx/ArxDependencies.git

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

  • Add CMAKE_PREFIX_PATH to your environment variable:
    • CMAKE_PREFIX_PATH=C:\Code\git\ArxDependencies\zlib;C:\Code\git\ArxDependencies\freetype;C:\Code\git\ArxDependencies\devil;C:\Code\git\ArxDependencies\openal;C:\Code\git\ArxDependencies\boost;C:\Code\git\ArxDependencies\opengl;C:\Code\git\ArxDependencies\sdl;C:\Code\git\ArxDependencies\directx
  • 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: echo $CMAKE_PREFIX_PATH
    • It should echo: C:\Code\git\ArxDependencies\zlib;C:\Code\git\ArxDependencies\freetype;C:\Code\git\ArxDependencies\devil;C:\Code\git\ArxDependencies\openal;C:\Code\git\ArxDependencies\boost;C:\Code\git\ArxDependencies\opengl;C:\Code\git\ArxDependencies\sdl;C:\Code\git\ArxDependencies\directx

Finally, copy the necessary dlls to C:\Code\git\ArxFatalis\bin\...

C:\Code\git\ArxDependencies\devil\bin\DevIL32.dll
C:\Code\git\ArxDependencies\devil\bin\DevIL64.dll
C:\Code\git\ArxDependencies\sdl\bin\SDL32.dll
C:\Code\git\ArxDependencies\sdl\bin\SDL64.dll

Get the code

In GitBash

cd /c/Code/git
git clone git@github.com:lubosz/ArxFatalis.git
cd ArxFatalis

Generating VC++ projects

We'll use CMake for that

mkdir build_vc10
cd build_vc10
cmake .. -G "Visual Studio 10" -DARX_USE_UNITYBUILD=1

Building ArxFatalis

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

Debugging ArxFatalis

  • 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