Compile with MSVC2012 and Qt5 (ANGLE)
This is the instruction for building Windows 32/64-bit version of Stellarium using Microsoft Visual Studio 2012 and Qt5 (VC 2012) with ANGLE.
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.
For enable translation OpenGL ES 2.0 functions to DirectX (ANGLE usage) you need download and install DirectX Software Development Kit from Microsoft website.
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.
Stellarium needs Qt version 5.1.0 or better since revision 6224 for building. You can get latest version of Qt from website of Qt Project. We recommended use Qt 5.2.1, now in the archives section 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:\Qt5 as directory with installed Qt5 framework.
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:
- zlib 1.2.7 (win32, release)
- zlib 1.2.7 (win32, debug)
- zlib 1.2.7 (win64, release)
- zlib 1.2.7 (win64, debug)
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.
- Add C:\Qt5 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
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.
- Open an Explorer and change directory into the root of the source tree, e.g.
- Make a build directory and change into it:
- Run CMake (you can use following configuring build options):
- Steps on the screenshot above:
- Choose directory with source code of Stellarium
- Choose directory for building of Stellarium
- Configure project (e.g. you should choose version of compiler)
- Add special configure options (e.g. you can add CMAKE_INSTALL_PREFIX and set C:\stellarium here)
- Generate CMakeLists.txt file
- Open Microsoft Visual Studio 2012 Express and compile project
- Steps on the screenshot above:
- Open Stellarium project (FILE -> Open Project... -> Stellarium)
- Set the building mode (e.g. Release)
- Choose stellarium in the Solution Explorer and make right click on it
- Run Build for stellarium
- 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.2.1\msvc2012\bin (or \Qt5\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
- From the \Qt5\5.2.1\msvc2012\plugins\platforms (or \Qt5\5.2.1\msvc2012_64\plugins\platforms for 64-bit libraries) folder to the /platforms of the source tree: qwindows.dll
- From the \Qt5\5.2.1\msvc2012\imports\Qt\labs\shaders (or \Qt5\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.
- ↑ This dependency was included in Stellarium's source code since revision 6853 and it's not required a separate library now.
- ↑ Those packages was compiled to static library.
- ↑ See instructions for adding data to PATH here. Not required since revision 6853.
- ↑ 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.
- ↑ You can set Windows XP compatible mode here also, e.g. CMAKE_GENERATOR_TOOLSET=v120_xp for Visual Studio 2013
- ↑ Required only for dynamic library before revision 6853.