Compile with MSVC2012 and Qt5 (ANGLE)

From Stellarium Wiki
Revision as of 08:17, 23 February 2014 by Alexwolf (Talk | contribs)
Jump to: navigation, search

This is the instruction for building Windows 32/64-bit version of Stellarium using Microsoft Visual Studio 2012 and Qt5 (VC 2012) with ANGLE.

Contents

Installation of development tools & libraries

For building Stellarium from source code you need some required tools and libraries.

Microsoft Visual Studio 2012

You need download and install Microsoft Visual Studio Express 2012 (or "better" - e.g. Professional) from Microsoft website.

DirectX SDK

For enable translation OpenGL ES 2.0 functions to DirectX (ANGLE usage) you need download and install DirectX Software Development Kit from Microsoft website.

Bazaar

For getting the source code of Stellarium you need installed DVCS Bazaar from this url. We recommend using latest stable standalone release of Bazaar. If you want GUI clients for management of source code then you can Bazaar Explorer, QBzr and optionally TortoiseBZR.

Note: You should add path to Bazaar to PATH variable if you want use command line for getting source code of Stellarium.

Qt5

Stellarium wants Qt version 5 since revision 6224 for building. You can get latest version of Qt from website of Qt Project. We recommended use Qt 5.2.1, which you can get here - Qt 5.2.1 (VC 2012) with ANGLE for 32-bit Windows or here - Qt 5.2.1 (VC 2012) with ANGLE for 64-bit Windows.

Note: for following steps we will use path C:\Qt as directory with installed Qt5 framework.

CMake

Stellarium uses CMake for configuration of the project and we recommended use CMake 2.8.11 or better.

zlib

Stellarium wants zlib for manipulation of the archives, e.g. landscapes packages. Latest binary package of zlib for Windows you can get on zlib website. We recommended use zlib 1.2.5 or better.

You can find and download binary package of zlib for MSVC 2012 or download source code and build it yourself. In any case for 64-bit Windows you can't find binary package, but you can get source code of zlib from zlib-win64 website (with patches for win64) and solution for Visual Studio, and build it (please read instructions from package!). After building you need put files into C:\zlib directory.

Of course you can use our precompiled packages[1]:

If you want use precompiled package, then you should download archive and unpack it. Unpacked directory will named as zlib-winXX-Y, where XX - architecture (32 or 64) and Y is mode (release or debug). You should rename zlib-winXX-Y into C:\zlib directory.

Configuring the build environment

After installing all required libraries and tools you should configure the build environment.

  • Add C:\zlib to PATH variable - you should add string C:\zlib\lib;C:\zlib\include to PATH variable[2].
  • Add C:\Qt to PATH variable - you should add string C:\Qt5\5.2.1\msvc2012\;C:\Qt5\5.2.1\msvc2012\bin;C:\Qt5\5.2.1\msvc2012\lib;C:\Qt5\5.2.1\msvc2012\include for 32-bit or C:\Qt5\5.2.1\msvc2012_64\;C:\Qt5\5.2.1\msvc2012_64\bin;C:\Qt5\5.2.1\msvc2012_64\lib;C:\Qt5\5.2.1\msvc2012_64\include for 64-bit to PATH variable.

Note: After changes the PATH variable you should reboot the computer for apply those changes.

Getting source code

Release versions

You can download the source code for the release versions from the sourceforge download area. Save the file to the C:/Stellarium-Source directory as example. The file name should be stellarium-0.13.0.tar.gz or similar.

You will need a decompression program installed in Windows, for example 7-Zip.

De-compress the tar file like this:

tar zxvf stellarium-0.13.0.tar.gz

The root of the source tree will be will be C:/Stellarium-Source/stellarium for simplicity.

Development versions from the Bazaar repository

See also Bzr checkout

You can try the latest development code by downloading from the bzr repository using the TortoiseBZR client bzr shell. This program integrates with the Windows file browser. See the TortoiseBZR website for details. Check out the source by entering the folder where you have the stellarium source code and from the Windows menu bar:

The root of the source tree typically will be C:\Stellarium-Source\stellarium.

You will first need to get the source code.

For example you use TortoiseBZR and want get the source code of the Stellarium. Run Explorer and open directory C:\Stellarium-Source, choose directory stellarium and make right click mouse. In opened window select "Bazaar create working copy/branch". Set source as "lp:stellarium", destination directory will be C:\Stellarium-Source\stellarium. Press OK for getting source code.

This will download the trunk into .bzr (nearly 1GB at the moment), a hidden folder in the stellarium folder, so it may take some time. When this completes the trunk source code will be written into your stellarium folder.

When the source code is loaded into your stellarium folder you can add any updates from the Windows pull down menu. Note: in Windows 7 the menu will appear if you right click the mouse in a vacant area of the stellarium folder.

Building

  1. Open an Explorer and change directory into the root of the source tree, e.g.
    C:\Stellarium-Sources\stellarium
  2. Make a build directory and change into it:
    C:\Stellarium-Sources\stellarium\builds\msvc
  3. Run CMake[3] (you can use following configuring build options):
    windows-cmake-gui.jpg
    Steps on the screenshot above:
    1. Choose directory with source code of Stellarium
    2. Choose directory for building of Stellarium
    3. Configure project (e.g. you should choose version of compiler)
    4. Add special configure options (e.g. you can add CMAKE_INSTALL_PREFIX and set C:\stellarium here)
    5. Generate CMakeLists.txt file
  4. Open Microsoft Visual Studio 2012 Express and compile project
    windows-msvc2012-express.jpg
    Steps on the screenshot above:
    1. Open Stellarium project (FILE -> Open Project... -> Stellarium)
    2. Set the building mode (e.g. Release)
    3. Choose stellarium in the Solution Explorer and make right click on it
    4. Run Build for stellarium
    5. If building is O.K. - run Build for the INSTALL solution

This will place all the compiled files in C:\stellarium. From where they will be found when you run the installer program stellarium.iss after you install the Inno Setup Compiler.

Doing a test run

If the build was successful, you can run the program without installing it, just to test everything is OK. First you need to find all the DLLs which Stellarium uses, and copy them to the root of the source tree:

  • From the \Qt\5.2.1\msvc2012\bin (or \Qt\5.2.1\msvc2012_64\bin for 64-bit libraries) folder: Qt5Core.dll, Qt5Concurrent.dll, Qt5Declarative.dll, Qt5Gui.dll, Qt5Network.dll, Qt5OpenGL.dll, Qt5Widgets.dll, Qt5Sql.dll, Qt5XmlPatterns.dll, icudt51.dll, icuin51.dll, icuuc51.dll, libEGL.dll, libGLESv2.dll, and d3dcompiler_46.dll;
  • From the \zlib folder: zlib1.dll[4]
  • From the \Qt\5.2.1\msvc2012\plugins\platforms (or \Qt\5.2.1\msvc2012_64\plugins\platforms for 64-bit libraries) folder to the /platforms of the source tree: qwindows.dll
  • From the \Qt\5.2.1\msvc2012\imports\Qt\labs\shaders (or \Qt\5.2.1\msvc2012_64\imports\Qt\labs\shaders for 64-bit libraries) folder to the /Qt/labs/shaders of the source tree: qmldir, plugins.qmltypes, and qmlshadersplugin.dll

If you need a language other than English copy the stellarium\translations folder from C:\stellarium\share (or \program files\stellarium\share if you don't set CMAKE_INSTALL_PREFIX variable) to the stellarium source tree root folder.

Finally run Build for INSTALL solution in Visual Studio.

This will place all the necessary files in your program files folder stellarium where the installer expects to find them.

Making the installer

We use the Inno Setup Compiler to create the installer. These details are for builds source later than 6052

From http://www.jrsoftware.org download version 5.5.3 (unicode) or better, run it to install.

If you have followed the above procedure the current bzr build will generate the necessary stellarium.iss file. Double click on it, then from the menu bar "build-compile". It will build the stellarium installer package and place it in a folder of the stellarium source tree root folder "installers"

Run the program generated and Stellarium will be installed in program files\stellarium or wherever you select and place an icon on the desktop.

Notes

  1. Those packages was compiled to static library.
  2. See instructions for adding data to PATH here
  3. If the compile fails with the error "can't find a particular file". Check the CMakeCache.txt file in the ...\builds\msys folder and make sure the variable/path/file is directed to the correct source.
  4. Required only for dynamic library.
Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox