Marble/WindowsCompiling: Difference between revisions

From KDE Community Wiki
*>Multimedial
No edit summary
*>Multimedial
No edit summary
Line 3: Line 3:




===== Preliminaries: =====
===== Preliminaries: =====


#The Marble project uses [http://www.cmake.org/ CMake] to manage the building process depending of your needs&nbsp;: operating system, build options. So, first of all, you need to download the latest [http://www.cmake.org/cmake/resources/software.html CMake binary for windows]. Install it and don't forget during the installation to check "define cmake path in environment variables" or something like that.<br><br>
#The Marble project uses [http://www.cmake.org/ CMake] to manage the building process depending of your needs&nbsp;: operating system, build options. So, first of all, you need to download the latest [http://www.cmake.org/cmake/resources/software.html CMake binary for windows]. Install it and don't forget during the installation to check "define cmake path in environment variables" or something like that.<br><br>  
#Marble is a Qt dependent application ("No way!?" "Way!!"&nbsp;:) ) so you also need Qt. Download the latest [http://qt.nokia.com/downloads Qt sdk] for windows and install it.<br><br>From hereon, there are two ways to compile Marble - both are currently working (as of 1st of july 2010):
#Marble is a Qt dependent application ("No way!?" "Way!!"&nbsp;:) ) so you also need Qt. Download the latest [http://qt.nokia.com/downloads Qt sdk] for windows and install it.<br><br>From hereon, there are two ways to compile Marble - both are currently working (as of 1st of july 2010):


*using the open source MingW compiler provided with Qt, or ...
*using the open source MingW compiler provided with Qt, or ...  
*
*using the Microsoft Visual C++ compiler (steps below were tested with MSVC++ 2008 Express edition).
using the Microsoft Visual C++ compiler (steps below were tested with MSVC++ 2008 Express edition).


=== Compiling Marble using MingW ===
=== Compiling Marble using MingW ===

Revision as of 15:27, 1 July 2010

This page present only how to build Marble on windows. Here is an other howto about using libmarblewidget in a application built for windows. You should also have already read this too.


Preliminaries:
  1. The Marble project uses CMake to manage the building process depending of your needs : operating system, build options. So, first of all, you need to download the latest CMake binary for windows. Install it and don't forget during the installation to check "define cmake path in environment variables" or something like that.

  2. Marble is a Qt dependent application ("No way!?" "Way!!" :) ) so you also need Qt. Download the latest Qt sdk for windows and install it.

    From hereon, there are two ways to compile Marble - both are currently working (as of 1st of july 2010):
  • using the open source MingW compiler provided with Qt, or ...
  • using the Microsoft Visual C++ compiler (steps below were tested with MSVC++ 2008 Express edition).

Compiling Marble using MingW

  1. You have to add mingw's path and qmake's path in the environment variable. (use C:\Qt\20xx.xx.x\MinGW\bin and C:\Qt\20xx.xx.x\qt\bin )(follow those instructions if needed). To check that cmake.exe, gcc.exe and qmake.exe are in your %PATH% :
    1. open a commandline-window (start->run program->cmd)
    2. run "cmake" , it should give you a help message and show you what compilation options it found
    3. run "gcc -v" , it should give you version info
    4. run "qmake" , it should give you help output
    5. (Hint: make sure not to add the directory %QT-installation-dir%/bin but rather %QT-installation-dir%/qt/bin, there are for some reason incompatible dll's that might lead to crashes)
    6. If one of those command are not known then something is wrong.
  2. Then check out marble's svn : svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeedu/marble (Note: this is for the development version. You may want a more stable version. So look for the appropriate url)
  3. now you can compile marble :
    1. open the cmd-window
    2. cd to the marble dir
    3. create a build directory (mkdir build)
    4. cd build
    5. cmake -G "MinGW Makefiles" -DQTONLY=ON -DCMAKE_BUILD_TYPE=Release .. (add -DWITH_DESIGNER_PLUGIN=ON if you want the MarbleWidget Plugin )(note that the "-DCMAKE_BUILD_TYPE=Release" is important because without it you will have trouble like no downloading tiles etc)
    6. mingw32-make (you can add "-j2" if you have a 2 cores cpu)
    7. mingw32-make install (Note: if you are under Windows seven you must be root to install marble in the standard place. See this )
  4. Now if all went well you should find marble.exe in Program Files>marble> directory.

Test it... Yeah!



Compiling Marble using Microsoft Visual C++

  1. The Windows version of Marble distributed on the KDE website is compiled using the
    Microsoft VC++ compiler. For Marble to work right, you'll need the MSVC+ compiled
    version of QT
  2. Once you got these installed, make sure that you add the bin Path of the
    framework to your PATH variable. E.g. "C:\Qt\4.6.3\bin". This will point
    the system to the DLLs of the framework eventually needed.
  3. Get the Marble sources from SVN into a fresh directory (see above for steps). Then you can open a command line window (with administrator privileges - on Vista
    and Windows 7, you need to hold down SHIFT and Control when executing
    "CMD.exe" from the start button menu). You need to make sure that you
    got those privileges, otherwise the build will fail due to missing
    rights to write files later on during linking and installing.
  4. Make sure to set the environment variables for the MS Visual C++
    compiler by doing "vcvarsall.bat" in the tool subdirectory of your
    Microsoft Visual C++ installation.

    Example:
    C:\>cd "\Program Files\Microsoft Visual Studio 9.0\VC
    C:\Program Files\Microsoft Visual Studio 9.0\VC>vcvarsall
    Setting environment for using Microsoft Visual Studio 2008 x86 tools.
    C:\
  5. Change to the directory with the Marble sources, and enter the following build commands (thanks to Patrick Spendrin for that):

    C:\Marble-Src\cmake -G "NMake Makefiles" -DQTONLY=ON
    -DCMAKE_INSTALL_PREFIX=C:\marble-tmp && nmake && nmake install
  6. Once issued, you will get the build kicked off. First, the cmake cross-compiler will make the MakeFile, and Nmake will then compile it, while nmake install will install the application at the path specified at CMAKE_IMSTALL_PATH Prefix.
  7. Once you got your version of Marble  "installed", you need to manually copy the missing Qt Framework DLLs as well as the missing imageformat DLL for importing tiles.The following DLLs go from the Qt/bin directory right next to the
    marble.exe file in the installation directory:

    QtCore4.dll
    QtGui4.dll
    QtNetwork4.dll
    QtSvg4.dll
    QtWebKit4.dll
    QtXml4.dll
  8. Additionally, you need to create a directory in the "plugins" folder
    named "imageformats". This is the plugin for different image formats. In
    Marble 0.8.0, there was just one DLL in there, namely "qjpeg4.dll",
    which is the support for JPEG file tiles in Marble.
    [NOTE: what about PNG support? Would that be "qmng4.dll" to be added?]
  9. The "qjpeg4.dll" is not build yet after downloading and installing the
    MSVC version of the Qt Framework, yet you will find a MS VC Project file
    in your Qt source directory (e.g. "C:\Qt\4.6.3\src\plugins\imageformats\imageformats.dsw"). Open that up,
    set the release configuration in the compiler and compile the project.
  10. Note that the output files will be found in another place! Namely in the
    plugins folder of Qt (e.g. "C:\Qt\4.6.3\plugins\imageformats"). From there, you can copy the qjpeg4.dll needed, and you should be all set - you now got a fresh Marble version compiled with MSVC.


Tested with CMake 2.8.1, Qt sdk 2010.02.1 ( Qt 4.6.2 ; Qt Creator 1.3.1 ; MinGW 3.15 ; GCC4.4.0 ) and rev. 1128605 of marble for the MingW part, and the Qt SDK 4.6.3 for MSVC.