Compile with VS2013 and Qt5

From Stellarium Wiki
Jump to: navigation, search

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

Contents

Installation of development tools & libraries

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

Microsoft Visual Studio 2013

You need download and install VS Express 2013 for Desktop (or "better" - e.g. Professional) from Microsoft website.

Bazaar

To get the source code of Stellarium you need to install 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 needs Qt5 for building. You can get latest version of Qt from website of Qt Project. We recommended use Qt 5.5.1, now in the archives section which you can get here - Qt 5.5.1 (VS 2013) for 32-bit Windows or here - Qt 5.5.1 (VS 2013) for 64-bit Windows.

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

CMake

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

Configuring the build environment

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

  • Add C:\Qt5 to PATH variable - you should add string C:\Qt5\5.5\msvc2013\;C:\Qt5\5.5\msvc2013\bin;C:\Qt5\5.5\msvc2013\lib;C:\Qt5\5.5\msvc2013\include for 32-bit or C:\Qt5\5.5\msvc2013_64\;C:\Qt5\5.5\msvc2013_64\bin;C:\Qt5\5.5\msvc2013_64\lib;C:\Qt5\5.5\msvc2013_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:/Devel directory as example. The file name should be stellarium-0.14.2.tar.gz or similar.

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

The root of the source tree will be C:/Devel/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:\Devel\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:\Devel, 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:\Devel\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 within VS2013

  1. Open an Explorer and change directory into the root of the source tree, e.g.
    C:\Devel\stellarium
  2. Make a build directory and change into it:
    C:\Devel\stellarium\builds\msvc2013
  3. Run CMake[1] (you can use following configuring build options):
    windows-msvc2013-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:
      1. Add CMAKE_INSTALL_PREFIX and set C:\stellarium
      2. Add STELLARIUM_RELEASE_BUILD and set 0[2]
      3. Add STELLARIUM_VERSION and set 0.14.73.0[3]
      4. Add ENABLE_MEDIA and set 1
    5. Generate CMakeLists.txt file
  4. Open Microsoft Visual Studio Express 2013 for Desktop and compile project
    windows-msvc2013-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 \Qt5\5.5\msvc2013\bin (or \Qt5\5.5\msvc2013_64\bin for 64-bit libraries) folder: Qt5Core.dll, Qt5Concurrent.dll, Qt5Declarative.dll, Qt5Gui.dll, Qt5Network.dll, Qt5OpenGL.dll, Qt5Widgets.dll, Qt5Sql.dll, Qt5SerialPort.dll, Qt5PrintSupport.dll, Qt5XmlPatterns.dll, icudt54.dll, icuin54.dll, icuuc54.dll, libEGL.dll, libGLESv2.dll, and d3dcompiler_46.dll;
  • From the \Qt5\5.5\msvc2013\plugins\platforms (or \Qt5\5.5\msvc2013_64\plugins\platforms for 64-bit libraries) folder to the /platforms of the source tree: qwindows.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.5 (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. If the compile fails with the error "can't find a particular file". Check the CMakeCache.txt file in the ...\builds\msvc2013 folder and make sure the variable/path/file is directed to the correct source.
  2. You need set value to 0 (false) to build development snapshot and set specific version number.
  3. We use format XX.YY.ZZ.BB for development snapshots, where XX - current major stable version, YY - current minor stable version, ZZ - current patch version, BB - current build version. E.g. first snapshot for version 0.15.0 will be have a number 0.14.50.0.
Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox