= Windows with MinGW-w64 and GCC = == CMake == {{{ #!div style="background-color: #D0D0F0; border: solid 1px #000000; margin-right: 200px;" ''Info: CMake is a build-system. It is used to generate make-files or project-files for IDEs'' }}} Download the latest binary release from [http://www.cmake.org/download/ here] and install it. * '''While installing check the option to "add CMake to the system PATH"''' == MSYS2 and MinGW-w64 == {{{ #!div style="background-color: #D0D0F0; border: solid 1px #000000; margin-right: 200px;" ''Info: MSYS2 is a command shell, used to execute build scripts and more.'' }}} {{{ #!div style="background-color: #D0D0F0; border: solid 1px #000000; margin-right: 200px;" ''Info: MinGW-w64 is a collection of tools (like GCC and more), used to compile source code on Windows. Despite its name it supports both 32bit and 64bit builds, depending on how you install it.'' }}} Download and install MSYS2 according to the the installation guide on this page: [http://msys2.github.io/ MSYS2 installer]. 1. Open the MSYS2 console and type "{{{pacman -S make}}}" to install make 1. Install MinGW-w64: A. For 32bit-builds type "{{{pacman -S mingw-w64-i686-gcc}}}" in the MSYS2 console B. For 64bit-builds type "{{{pacman -S mingw-w64-x86_64-gcc}}}" in the MSYS2 console 1. Close MSYS2 and open it again by using the correct shortcut (see the note below). Type "{{{gcc --version}}}" to find the version of gcc. Use this version later on to chose the correction dependency-package. Note: MSYS2 installs three shortcuts: 1. {{{msys2_shell.bat}}}: a neutral version that does not contain MinGW-w64 (not important for us) 1. {{{mingw32_shell.bat}}}: adds the 32bit-installation of MinGW-w64 to {{{$PATH}}} (if installed) -> use this for 32bit-builds 1. {{{mingw64_shell.bat}}}: adds the 64bit-installation of MinGW-w64 to {{{$PATH}}} (if installed) -> use this for 64bit-builds You can install both versions of MinGW-w64 (32bit and 64bit) at the same time. You can determine which version to use by starting MSYS2 with the corresponding shortcut. Switch to the home-directory of your MSYS2 installation: {{{c:\\home\\}}}[[br]] This is your homedirectory in MSYS2, this is where the action takes place. '''In the following, we'll call this directory {{{c:\\}}} to make things shorter.''' ''Note: It's also possible to install different versions of GCC. Follow the link on [http://mingw-w64.org/doku.php/download/mingw-builds this page] and install an independent version of MinGW-w64. Next go to /etc/fstab in MSYS2 and map the installation either to mingw32 or mingw64.'' == SVN == {{{ #!div style="background-color: #D0D0F0; border: solid 1px #000000; margin-right: 200px;" ''Info: We use SVN to upload code to the server and to manage different versions (branches).'' }}} ==== Get SVN: ==== To use [wiki:code/tools/SVN SVN] on your system we recommend TortoiseSVN, a very useful GUI-client. [http://tortoisesvn.net/downloads Download] TortoiseSVN is a shell extension. You can use it within Windows Explorer, which is very practical. Most options are available through the context menu (right mouse button). ==== Get the source: ==== Check out the Orxonox-repository into a folder named "trunk", for example {{{c:\\trunk\}}}. '''It's very important to use a directory inside your MSYS2 homedirectory, otherwise you can't compile.''' * URL: {{{https://svn.orxonox.net/game/code/trunk/}}} * Checkout directory: {{{c:\\trunk\}}} Now do the same with the data repository and store it in a directoy called "data_extern": * URL: {{{https://svn.orxonox.net/game/data/trunk}}} * Checkout directory: {{{c:\\data_extern}}} Now you should have the following directories in your home: {{{ c:\\data_extern c:\\trunk }}} {{{ #!div style="background-color: #D0F0D0; border: solid 1px #000000;" In TortoiseSVN this is done by right clicking into {{{c:\\}}} and chosing "SVN Checkout...". ([attachment:wiki:dev/WindowsMinGW:orxonox_svn_checkout.gif see this picture]) Then set the URL of the repository to {{{https://svn.orxonox.net/game/code/trunk/}}} and the checkout directory to {{{c:\\trunk\}}} (checkout depth should be "Fully recursive" and revision "HEAD"). Accept the certificate and enter your username and password in the authentication form (only if it's the first time you check out code from our server). ([attachment:wiki:dev/WindowsMinGW:orxonox_svn_checkout_trunk.gif see this picture]) }}} {{{ #!div style="background-color: #D0F0D0; border: solid 1px #000000; margin-top: 10px;" If you're not using TortoiseSVN, use the "svn co " command. See [wiki:code/tools/SVN SVN] for more information. }}} == Dependencies == {{{ #!div style="background-color: #D0D0F0; border: solid 1px #000000; margin-right: 200px;" ''Info: Dependencies are external libraries that aren't included in the orxonox source.'' }}} Go to [wiki:download#PrecompiledDependencies the Download page] and download the dependency package for MinGW-w64 that fits your version of GCC (type "{{{gcc --version}}}" in the MSYS2 console to find the installed version of GCC).[[br]] Extract the archive into {{{c:\\}}} (get 7-Zip [http://www.7-zip.org/ here]) Now you should have the following directories in your home: ([attachment:wiki:dev/WindowsMinGW:orxonox_directories.gif see this picture]) {{{ c:\\data_extern c:\\dependencies c:\\trunk }}} ''Note: If someone is interested in building the dependencies on his own, the current build-scripts can be found [http://svn.orxonox.net/downloads/windows/precompiled_dependencies/mingw64/ here].'' ==== OpenAL: ==== Make sure you have installed OpenAL, which might not be shipped with Windows. Download and install it from [http://www.openal.org/downloads/oalinst.zip here]. == Build Orxonox == First we add an alias to the profile of MSYS2 which helps us creating make-files with CMake. Open the MSYS2 console and type the following lines: {{{ echo alias cm=\'cmake .. -G \"MSYS Makefiles\"\' >> ~/.profile source ~/.profile }}} Change into the trunk folder and create a build directory: {{{ cd trunk mkdir build cd build }}} Now we use the alias "cm" we created before. This shortcut will invoke CMake and create the Makefiles. Type the following into the MSYS2 console: {{{ cm make -j8 }}} The first command ({{{cm}}}) will check your system (and the dependency directory) for all needed libraries, create the configuration and generate the makefiles. The second command ({{{make}}}) builds Orxonox (-j8 will spawn 8 threads). If you get an error while executing one of those steps, report it in the [http://forum.orxonox.net/ Forum] or ask us in [irc://irc.orxonox.net/orxonox IRC]. Compiling will take some time (CMake shows you the percentage). Be patient.[[br]] See some pictures of this: - [attachment:wiki:dev/WindowsMinGW:orxonox_build1.gif Step 1] - [attachment:wiki:dev/WindowsMinGW:orxonox_build2.gif Step 2] - [attachment:wiki:dev/WindowsMinGW:orxonox_build3.gif Step 3] == Run Orxonox == If everything worked fine, start Orxonox with {{{c:\\trunk\build\run.bat}}} (you can't execute orxonox.exe directly).