User:Daggerstab/Building Stellarium on Windows with Qt Creator

From Stellarium Wiki
< User:Daggerstab
Revision as of 21:53, 9 November 2011 by Daggerstab (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
DRAFT

Contents

Install the Qt SDK

Stellarium is based on the Qt framework, so you need to install it. Before, the Qt libraries and Qt Creator were distributed separately, but then Nokia integrated all Qt components in a SDK. So you can download a small installer, and select and download only the components you are going to use.

  • Qt downloads page: http://qt.nokia.com/downloads
  • The "online installer" for Windows is only 15 MB and allows you to pick which components to download and install
  • You need Qt Creator and the Qt Desktop libraries (open source, with MinGW), so in the component selection screen:
    • Under "Development Tools":
      • Under "Desktop Qt", make sure that the latest version of Qt is checked (as of November 2011, that is 4.7.4). Under the version number, select only "Desktop Qt 4.7.4 - MinGW"
      • Make sure "Qt Designer" is selected
      • You probably don't need anything else under "Development Tools", so feel free to uncheck the rest.
    • Under "Miscellaneous", make sure that "MinGW 4.4" is checked. You don't need the source code. You may need the Qt Examples only if you are a programmer and you want to contribute to Stellarium - they will be useful to understand Qt.
    • You need "Documentation" only if you are a programmer who wishes to contribute to Stellarium.
    • You don't need "APIs" and "Experimental".

Even if you miss anything at this point, you can install it later with the "Maintain Qt SDK" application (it can be found in the Start menu after the installation is complete).

Remember where you install the Qt SDK, because you'll need it later.

Install some GnuWin libraries

Stellarium needs gettext, libiconv and zlib. You can get them form the GnuWin project:

For all of them, download the "Complete package, except sources" executable installer. Run the installers and let them install the libraries to the directory they want. It should be something like C:\Program Files\GnuWin32

Setting environmental variables

You need to add a few paths to your PATH environmental variable. On Windows, you can modify it with a configuration window: right click on your "My computer" and select "Properties". It's somewhere there. :)

TIP: The environmental variables window allows you to modify and define env-variables for the current user and for the system. There should be already a "Path" variable defined for the system, but not for the user. Instead of modifying the system PATH, it is more convenient to define a user PATH (just click on the "New..." button and fill in the boxes).

If you have let the Qt SDK install itself in its default location, the path to the Qt libraries should be something like C:\QtSDK\Desktop\Qt\4.7.4\mingw You need to add three subdirectories to the PATH variable:

C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin
C:\QtSDK\Desktop\Qt\4.7.4\mingw\lib
C:\QtSDK\Desktop\Qt\4.7.4\mingw\include

You also need to add the GnuWin libraries:

C:\Program Files\GnuWin32\bin
C:\Program Files\GnuWin32\lib
C:\Program Files\GnuWin32\include

All elements of the list should be separated with a semicolon (;). So the end result should look something like this: C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin;C:\QtSDK\Desktop\Qt\4.7.4\mingw\lib;C:\QtSDK\Desktop\Qt\4.7.4\mingw\include;C:\Program Files\GnuWin32\bin;C:\Program Files\GnuWin32\lib;C:\Program Files\GnuWin32\include

Warning: Don't just blindly copy the paths. Make sure that these directories exist and that the Qt version number is the same as yours.

Install CMake

CMake download page: http://www.cmake.org/cmake/resources/software.html

And interesting bug: As of 9 November 2011, if you use CMake 2.8.*, on Windows 7, Qt Creator won't show you Stellarium's source file tree in the "Projects" panel. Download and use CMake 2.6.4 (from the same website). If you have any idea why this is happening, contact us in the Stellarium developers mailing list or the Feedback forums.

During the installation, make sure to tell the installer that CMake should be added to the system PATH (for all users). This will save you editing it manually. :)

Get Stellarium's code

See the Bazaar checkout instructions

Opening Stellarium with Qt Creator

Open Qt Creator.

Open "File" -> "Open File or Project..." (or just press Ctrl+O).

Find the folder where you have put Stellarium's files. Open the topmost CMakeLists.txt file - the one that is at the same level as the README file and the /src and /data directories.

A "CMake Wizard" window will open. It is small and inconvenient to use. You can resize it to a larger size.

  • In the "Build Location" step, there will be a default path already in the location field. Ignore it. Instead:
    • Select your base Stellarium location, the same directory where the CMakeLists.txt file was. For example, D:\stellarium\trunk
    • Then, add \builds\msys. The whole path should look like something like this:D:\stellarium\trunk\builds\msys
    • The point is that this will allow you to run Stellarium directly from inside Qt Creator without having to copy files or to create an installer and install Stellarium.
TO BE CONTINUED
Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox