Marble/WindowsCompiling: Difference between revisions

From KDE Community Wiki
*>Multimedial
No edit summary
m (fix typos)
 
(25 intermediate revisions by 8 users not shown)
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>
Compiling Marble under the Windows operating system can be done, but it can be very difficult if you do not have your tool chain set up properly. Of first importance is that you get all of the necessary tools installed on your machine and configured.
#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 ...  
#The Marble source code is stored on a Git repository.  The Windows installer for Git can be downloaded [http://git-scm.com/downloads here]. When you run the installer under Windows, you get the Git program itself and a minimal command line environment called Git Bash for executing Git commands the same as you would under Linux. As an option, you may install Tortoise-Git (download [https://code.google.com/p/tortoisegit/ here]), which is a graphical interface with Git that integrates with the Windows File Explorer.
*using the Microsoft Visual C++ compiler (steps below were tested with MSVC++ 2008 Express edition).
#The Marble project uses [http://www.cmake.org/ CMake] to manage the building process depending on your needs, operating system, and build options.The Windows installer for cmake can be downloaded [http://www.cmake.org/download/ here]. The latest version of the cmake installer modifies the PATH variable to point to the cmake binary.
#Marble is a Qt dependent application so you also need Qt. Download the community edition of Qt for Windows [https://www.qt.io/download/ here]. It is safe to install it with the default options.
#The Windows version of the Qt SDK ships with the MinGW compile and make tool chain.It is important to set the PATH variable to point to the tool chain folders. Under the Windows Control Panel -> System -> Advanced Settings -> Environment Variables, add the following items to the PATH variable: 
##C:\Qt\5.12.4\mingw73_64\bin
##C:\Qt\Tools\mingw730_64\lib
##C:\Qt\Tools\mingw730_64\bin <br>The specific folders will depend on the version of Qt and MinGW available at the time that you install them. See these [http://www.computerhope.com/issues/ch000549.htm instructions] for additional advice for setting the path variable in Windows.  
#If you plan to use the Microsoft compilers in Visual Studio you will need to download the Visual Studio add-ins for Qt  [http://www.qt.io/download-open-source/#section-7 here].


=== Compiling Marble using MingW  ===
<br>It is important that you take the time to test your newly installed tool chain. Type in the following commands:
#<syntaxhighlight lang="bash">cmake --version</syntaxhighlight>
#<syntaxhighlight lang="bash">qmake --version</syntaxhighlight>
#<syntaxhighlight lang="bash">gcc --version</syntaxhighlight>
#<syntaxhighlight lang="bash">g++ --version</syntaxhighlight>
If any of these fail, check the PATH variable.


#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 [http://www.computerhope.com/issues/ch000549.htm instructions] if needed). To check that cmake.exe, gcc.exe and qmake.exe are in your&nbsp;%PATH%&nbsp;:
=== Getting the Marble Source Code  ===
##open a commandline-window (start-&gt;run program-&gt;cmd)
It is probably best that you get accustomed to using the command line. For that reason we will give the directions for downloading the Marble source code using Git Bash.  
##run "cmake" , it should give you a help message and show you what compilation options it found
#Use the start menu (if you have one) to start up the Git Bash interface.
##run "gcc -v" , it should give you version info
# We recommend that you change the working directory to your user's documents folder: <syntaxhighlight lang="bash">cd  Documents</syntaxhighlight>
##run "qmake" , it should give you help output
#We download the source code by cloning the developer repository with the following command: <syntaxhighlight lang="bash">git clone [email protected].org:education/marble.git</syntaxhighlight>
##(Hint: make sure not to add the directory&nbsp;%QT-installation-dir%/bin but rather&nbsp;%QT-installation-dir%/qt/bin, there are for some reason incompatible dll's that might lead to crashes)
##If one of those command are not known then something is wrong.
#Then check out marble's svn&nbsp;: <code bash="bash">svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeedu/marble</code> (Note: this is for the development version. You may want a more stable version. So look for the appropriate url)
#now you can compile marble&nbsp;:
##open the cmd-window
##cd to the marble dir
##create a build directory (mkdir build)
##<code bash="bash">cd build</code>
##<code bash="bash">cmake -G "MinGW Makefiles" -DQTONLY=ON -DCMAKE_BUILD_TYPE=Release ..</code> (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)
##<code bash="bash">mingw32-make</code> (you can add "-j2" if you have a 2 cores cpu)
##<code bash="bash">mingw32-make install</code> (Note: if you are under Windows seven you must be root to install marble in the standard place. See [http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/ this] )
#Now if all went well you should find marble.exe in Program Files&gt;marble&gt; directory.


Test it... Yeah!
After you run the git clone command (shown above), all the Marble source files and considerable resource files will be found in a folder called marble.  


=== Compiling Marble using Microsoft Visual C++ ===
=== Compiling Marble using MinGW and mingw32-make  ===
Marble compiles under a "cmake, make, make install" process as under Linux:


#The Windows version of Marble distributed on the KDE website is compiled using the <br>Microsoft VC++ compiler. For Marble to work right, you'll need the [http://qt.nokia.com/downloads/windows-cpp-vs2008 MSVC+ compiled <br>version of QT].&nbsp;
#Open a command prompt window
#Once you got these installed, make sure that you add the bin Path of the <br>framework to your PATH variable. E.g. "C:\Qt\4.6.3\bin". This will point <br>the system to the DLLs of the framework eventually needed.
#Navigate to the Documents\marble folder using the <b>cd</b> command.
#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 <br>and Windows 7, you need to hold down SHIFT and Control when executing <br>"CMD.exe" from the start button menu). You need to make sure that you <br>got those privileges, otherwise the build will fail due to missing <br>rights to write files later on during linking and installing.
#Create a build directory in the marble folder by typing: <syntaxhighlight lang="bash">mkdir build</syntaxhighlight> and switch to it: <syntaxhighlight lang="bash">cd build</syntaxhighlight> By running cmake from inside the build folder, we avoid spreading object files and other build cruft throughout the source tree.
#Make sure to set the environment variables for the MS Visual C++ <br>compiler by doing "vcvarsall.bat" in the tool subdirectory of your <br>Microsoft Visual C++ installation.<br><br>Example:<br>C:\&gt;cd "\Program Files\Microsoft Visual Studio 9.0\VC<br>C:\Program Files\Microsoft Visual Studio 9.0\VC&gt;vcvarsall<br>Setting environment for using Microsoft Visual Studio 2008 x86 tools.<br>C:\<br>
#Run cmake to configure the build process: <syntaxhighlight lang="bash">cmake -G "MinGW Makefiles" -DQTONLY=TRUE -DQT5BUILD=TRUE -DCMAKE_BUILD_TYPE=Release ..</syntaxhighlight>  (Add -DWITH_DESIGNER_PLUGIN=ON if you want the MarbleWidget Plugin )
#Change to the directory with the Marble sources, and enter the following build commands (thanks to Patrick Spendrin for that):<br><br>C:\Marble-Src\cmake -G "NMake Makefiles" -DQTONLY=ON <br>-DCMAKE_INSTALL_PREFIX=C:\marble-tmp &amp;&amp; nmake &amp;&amp; nmake install<br>
#Run make to actually build the program: <syntaxhighlight lang="bash">mingw32-make</syntaxhighlight> (You can add "--jobs=2" to compile 2 files at a time if your cpu has two cores.)
#Once issued, you will get the build kicked off. First, the cmake&nbsp;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.<br>
#Bring up an administrator command prompt by right clicking the command prompt icon from the start menu, and selecting "run as administrator". See [http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/ this] )
#Once you got your version of Marble &nbsp;"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 <br>marble.exe file in the installation directory:<br><br>QtCore4.dll<br>QtGui4.dll<br>QtNetwork4.dll<br>QtSvg4.dll<br>QtWebKit4.dll<br>QtXml4.dll<br>
#Use cd to navigate to the user Documents\marble\build folder.
#Additionally, you need to create a directory in the "plugins" folder <br>named "imageformats". This is the plugin for different image formats. In <br>Marble 0.8.0, there was just one DLL in there, namely "qjpeg4.dll", <br>which is the support for JPEG file tiles in Marble.<br>[NOTE: what about PNG support? Would that be "qmng4.dll" to be added?]<br>
#Install marble: <syntaxhighlight lang="bash">mingw32-make install</syntaxhighlight>
#The "qjpeg4.dll" is not build yet after downloading and installing the <br>MSVC version of the Qt Framework, yet you will find a MS VC Project file <br>in your Qt source directory (e.g.&nbsp;"C:\Qt\4.6.3\src\plugins\imageformats\imageformats.dsw"). Open that up, <br>set the release configuration in the compiler and compile the project.<br>
#Now if all went well you should find marble-qt.exe in Program Files (x86)\marble.
 
Double click on the marble-qt.exe file from the Windows File Explorer to test it out.
 
(This was tested to work well using Qt 5.12.4 on September 12, 2019)
 
=== Compiling Marble using Microsoft Visual C++ and nmake  ===
 
#The Windows version of Marble distributed on the KDE website is compiled using the <br>Microsoft VC++ compiler. For Marble to work right, you'll need the [http://qt.nokia.com/downloads/windows-cpp-vs2008 MSVC+ compiled <br>version of QT].&nbsp;<br><br>
#Once you got these installed, make sure that you add the bin Path of the <br>framework to your PATH variable. E.g. "C:\Qt\4.6.3\bin". This will point <br>the system to the DLLs of the framework eventually needed.<br><br>
#Get the Marble sources from Git into a fresh directory (see above for steps). Then you can open a command line window (with administrator privileges - on Vista <br>and Windows 7, you need to hold down SHIFT and Control when executing <br>"CMD.exe" from the start button menu). You need to make sure that you <br>got those privileges, otherwise the build will fail due to missing <br>rights to write files later on during linking and installing.<br><br>
#Make sure to set the environment variables for the MS Visual C++ <br>compiler by doing "vcvarsall.bat" in the tool subdirectory of your <br>Microsoft Visual C++ installation.<br><u>Example:</u><br>C:\&gt;cd "\Program Files\Microsoft Visual Studio 9.0\VC<br>C:\Program Files\Microsoft Visual Studio 9.0\VC&gt;vcvarsall<br>Setting environment for using Microsoft Visual Studio 2008 x86 tools.<br>C:\<br><br>  
#Change to the directory with the Marble sources, and enter the following build commands (thanks to Patrick Spendrin for that):<br><br>C:\Marble-Src\cmake -G "NMake Makefiles" -DQTONLY=ON <br>-DCMAKE_INSTALL_PREFIX=C:\marble-tmp &amp;&amp; nmake &amp;&amp; nmake install<br><br>  
#Once issued, you will get the build kicked off. First, the cmake&nbsp;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.<br><br>  
#Once you got your version of Marble &nbsp;"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 <br>marble.exe file in the installation directory:<br><br>QtCore4.dll<br>QtGui4.dll<br>QtNetwork4.dll<br>QtSvg4.dll<br>QtWebKit4.dll<br>QtXml4.dll<br><br>  
#Additionally, you need to create a directory in the "plugins" folder <br>named "imageformats". This is the plugin for different image formats. In <br>Marble 0.8.0, there was just one DLL in there, namely "qjpeg4.dll", <br>which is the support for JPEG file tiles in Marble.<br>[NOTE: what about PNG support? Would that be "qmng4.dll" to be added?]<br><br>  
#The "qjpeg4.dll" is not build yet after downloading and installing the <br>MSVC version of the Qt Framework, yet you will find a MS VC Project file <br>in your Qt source directory (e.g.&nbsp;"C:\Qt\4.6.3\src\plugins\imageformats\imageformats.dsw"). Open that up, <br>set the release configuration in the compiler and compile the project.<br><br>  
#Note that the output files will be found in another place! Namely in the <br>plugins folder of Qt (e.g. "C:\Qt\4.6.3\plugins\imageformats").&nbsp;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.<br>
#Note that the output files will be found in another place! Namely in the <br>plugins folder of Qt (e.g. "C:\Qt\4.6.3\plugins\imageformats").&nbsp;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.<br>


<br> Tested with CMake 2.8.1, Qt sdk 2010.02.1 (&nbsp;Qt 4.6.2&nbsp;; Qt Creator 1.3.1&nbsp;; MinGW 3.15&nbsp;; GCC4.4.0 ) and rev. 1128605 of marble for the MingW part, and the&nbsp;Qt SDK 4.6.3 for MSVC.
<br> Tested with CMake 2.8.1, Qt sdk 2010.02.1 (&nbsp;Qt 4.6.2&nbsp;; Qt Creator 1.3.1&nbsp;; MinGW 3.15&nbsp;; GCC4.4.0 ) and rev. 1128605 of marble for the MingW part, and the&nbsp;Qt SDK 4.6.3 for MSVC.
=== Compiling Marble using Microsoft Visual C++ and Visual Studio ===
;Installing the tools
#Standard tools:
#:Install cmake and Git as described in the preliminaries section.
#Qt.
#:For Marble to work right, you'll need the [http://qt-project.org/downloads MSVC++ compiled version of QT]. If needed and no x64 version of Qt is available, you can compile it from source in a few easy [http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/ steps]. Long and CPU intensive, but easy....
;Preparing the workplace
:The following steps and configuration/compilation commands assume source in one directory, Visual Studio generated files (config and objects in a second directory, and then prepared binaries in a third. This way the source directory is kept clean, the final binaries are easy to find, and debug/release versions of each file kept in separate directories. It is very inconvenient to have these mixed.
::Example of directories tree:
:*Marble-Src
:*Marble-Build
:** Debug
:** Release
:* Marble-Bin
:** Debug
:** Release
;Getting the sources
:When Tortoise Git is properly installed and integrated with windows file explorer, you should be able to right click on a directory where you whant to download the sources to ex. '''Marble-Src''', and select "Clone Git repository", pointing to the address of the source code, from the [http://marble.kde.org/sources.php official Marble page]. (todo, screenshot here)
;Configuring and Compiling:
:Like mentioned before, it is desirable to keep the sources clean on a large project like this. Visual Studio will create a lot of files and it is also much easier to work on. You'll be able to change files and configurations more easily if you keep sources and built objects separate.
:In the directory to use to build in debug mode for example, open a command prompt. No need of elevated priviledges or setting of VS specific variables. Run cmake with ONE (in case its being presented on multiple lines) command similar to this:
:cmake -G "Visual Studio 9 2008 Win64" -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=..\..\Marble-Bin\Debug  ..\..\Marble-Src
:*This command specifies x64 project files and solutions vor Visual Studio 2008. CMake supports different targets, adjust if necessary.
:*-Wno-dev hides some unwanted warnings
:* -DCMAKE_BUILD_TYPE=Debug specifies in advance to link/build in debug mode in the generated vcproj/sln files
:* -DCMAKE_INSTALL_PREFIX=..\..\Marble-Bin\Debug specifies where the '''final''' binaries should be placed. It will only be populated by the "INSTALL''  project target part of the complete solution. You can specify a relative or absolute path.
:*  ..\..\Marble-Src points to the root directory containing the marble files, where you cloned the Git repository. (It contains the '''top-level''' CMakeLists.txt file.) '''Not'''  the "src" directory within.
: If all options and paths are correct, the current directory should now be populated with Visual Studio project files, a lot of them, and one single solution file. Repeat the above steps in another directory for a release build if desired.
:Double click/open "marble.sln" in VS Studio. No further command line work necessary.
:Once inside VS, use ALL_BUILD project to build all binaries, looking for errors. Expect a few minor problems. The stable sources may not be perfectly visual studio friendly. Last time I checked out the "Stable" sources, VS Compiler complained about some code that compiles under Gcc, but that VC compiler does not accept. An Implicit Type conversion issue in something as simple as atan2() function. Another problem was missing functions implementations for the Null-Audio plugin. The NUll audio plugin is used on windows, if there is no phonon server.
:When all compiles without errors, run the project "INSTALL" to copy the binaries to the install folder. It is important to have all executables and plugins and data in the correct place relative to each other. Double click on marble-qt.exe to start it. The directory with Qt libraries (Qt5Core.dll, Qt5Gui.dll, ... for a Release build and Qt5Cored.dll, Qt5Guid.dll, ... for a Debug build) must be part of the PATH environment variable also.

Latest revision as of 19:31, 29 April 2021

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

Compiling Marble under the Windows operating system can be done, but it can be very difficult if you do not have your tool chain set up properly. Of first importance is that you get all of the necessary tools installed on your machine and configured.

  1. The Marble source code is stored on a Git repository. The Windows installer for Git can be downloaded here. When you run the installer under Windows, you get the Git program itself and a minimal command line environment called Git Bash for executing Git commands the same as you would under Linux. As an option, you may install Tortoise-Git (download here), which is a graphical interface with Git that integrates with the Windows File Explorer.
  2. The Marble project uses CMake to manage the building process depending on your needs, operating system, and build options.The Windows installer for cmake can be downloaded here. The latest version of the cmake installer modifies the PATH variable to point to the cmake binary.
  3. Marble is a Qt dependent application so you also need Qt. Download the community edition of Qt for Windows here. It is safe to install it with the default options.
  4. The Windows version of the Qt SDK ships with the MinGW compile and make tool chain.It is important to set the PATH variable to point to the tool chain folders. Under the Windows Control Panel -> System -> Advanced Settings -> Environment Variables, add the following items to the PATH variable:
    1. C:\Qt\5.12.4\mingw73_64\bin
    2. C:\Qt\Tools\mingw730_64\lib
    3. C:\Qt\Tools\mingw730_64\bin
      The specific folders will depend on the version of Qt and MinGW available at the time that you install them. See these instructions for additional advice for setting the path variable in Windows.
  5. If you plan to use the Microsoft compilers in Visual Studio you will need to download the Visual Studio add-ins for Qt here.


It is important that you take the time to test your newly installed tool chain. Type in the following commands:

  1. cmake --version
    
  2. qmake --version
    
  3. gcc --version
    
  4. g++ --version
    

If any of these fail, check the PATH variable.

Getting the Marble Source Code

It is probably best that you get accustomed to using the command line. For that reason we will give the directions for downloading the Marble source code using Git Bash.

  1. Use the start menu (if you have one) to start up the Git Bash interface.
  2. We recommend that you change the working directory to your user's documents folder:
    cd  Documents
    
  3. We download the source code by cloning the developer repository with the following command:
    git clone [email protected]:education/marble.git
    

After you run the git clone command (shown above), all the Marble source files and considerable resource files will be found in a folder called marble.

Compiling Marble using MinGW and mingw32-make

Marble compiles under a "cmake, make, make install" process as under Linux:

  1. Open a command prompt window
  2. Navigate to the Documents\marble folder using the cd command.
  3. Create a build directory in the marble folder by typing:
    mkdir build
    
    and switch to it:
    cd build
    
    By running cmake from inside the build folder, we avoid spreading object files and other build cruft throughout the source tree.
  4. Run cmake to configure the build process:
    cmake -G "MinGW Makefiles" -DQTONLY=TRUE -DQT5BUILD=TRUE -DCMAKE_BUILD_TYPE=Release ..
    
    (Add -DWITH_DESIGNER_PLUGIN=ON if you want the MarbleWidget Plugin )
  5. Run make to actually build the program:
    mingw32-make
    
    (You can add "--jobs=2" to compile 2 files at a time if your cpu has two cores.)
  6. Bring up an administrator command prompt by right clicking the command prompt icon from the start menu, and selecting "run as administrator". See this )
  7. Use cd to navigate to the user Documents\marble\build folder.
  8. Install marble:
    mingw32-make install
    
  9. Now if all went well you should find marble-qt.exe in Program Files (x86)\marble.

Double click on the marble-qt.exe file from the Windows File Explorer to test it out.

(This was tested to work well using Qt 5.12.4 on September 12, 2019)

Compiling Marble using Microsoft Visual C++ and nmake

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

Compiling Marble using Microsoft Visual C++ and Visual Studio

Installing the tools
  1. Standard tools:
    Install cmake and Git as described in the preliminaries section.
  2. Qt.
    For Marble to work right, you'll need the MSVC++ compiled version of QT. If needed and no x64 version of Qt is available, you can compile it from source in a few easy steps. Long and CPU intensive, but easy....
Preparing the workplace
The following steps and configuration/compilation commands assume source in one directory, Visual Studio generated files (config and objects in a second directory, and then prepared binaries in a third. This way the source directory is kept clean, the final binaries are easy to find, and debug/release versions of each file kept in separate directories. It is very inconvenient to have these mixed.
Example of directories tree:
  • Marble-Src
  • Marble-Build
    • Debug
    • Release
  • Marble-Bin
    • Debug
    • Release
Getting the sources
When Tortoise Git is properly installed and integrated with windows file explorer, you should be able to right click on a directory where you whant to download the sources to ex. Marble-Src, and select "Clone Git repository", pointing to the address of the source code, from the official Marble page. (todo, screenshot here)
Configuring and Compiling
Like mentioned before, it is desirable to keep the sources clean on a large project like this. Visual Studio will create a lot of files and it is also much easier to work on. You'll be able to change files and configurations more easily if you keep sources and built objects separate.
In the directory to use to build in debug mode for example, open a command prompt. No need of elevated priviledges or setting of VS specific variables. Run cmake with ONE (in case its being presented on multiple lines) command similar to this:
cmake -G "Visual Studio 9 2008 Win64" -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=..\..\Marble-Bin\Debug ..\..\Marble-Src
  • This command specifies x64 project files and solutions vor Visual Studio 2008. CMake supports different targets, adjust if necessary.
  • -Wno-dev hides some unwanted warnings
  • -DCMAKE_BUILD_TYPE=Debug specifies in advance to link/build in debug mode in the generated vcproj/sln files
  • -DCMAKE_INSTALL_PREFIX=..\..\Marble-Bin\Debug specifies where the final binaries should be placed. It will only be populated by the "INSTALL project target part of the complete solution. You can specify a relative or absolute path.
  • ..\..\Marble-Src points to the root directory containing the marble files, where you cloned the Git repository. (It contains the top-level CMakeLists.txt file.) Not the "src" directory within.
If all options and paths are correct, the current directory should now be populated with Visual Studio project files, a lot of them, and one single solution file. Repeat the above steps in another directory for a release build if desired.
Double click/open "marble.sln" in VS Studio. No further command line work necessary.
Once inside VS, use ALL_BUILD project to build all binaries, looking for errors. Expect a few minor problems. The stable sources may not be perfectly visual studio friendly. Last time I checked out the "Stable" sources, VS Compiler complained about some code that compiles under Gcc, but that VC compiler does not accept. An Implicit Type conversion issue in something as simple as atan2() function. Another problem was missing functions implementations for the Null-Audio plugin. The NUll audio plugin is used on windows, if there is no phonon server.
When all compiles without errors, run the project "INSTALL" to copy the binaries to the install folder. It is important to have all executables and plugins and data in the correct place relative to each other. Double click on marble-qt.exe to start it. The directory with Qt libraries (Qt5Core.dll, Qt5Gui.dll, ... for a Release build and Qt5Cored.dll, Qt5Guid.dll, ... for a Debug build) must be part of the PATH environment variable also.