This document explains how to compile the development version of Stellarium on WinXP.
Building with MinGW32
Installation of the win32 development tools
From http://www.mingw.org/download.shtml download and install MinGW-4.1.1.exe, MSYS-1.0.10.exe and msysDTK-1.0.1.exe
Installation of the libraries
See the list of build dependencies. I first tried to install them by hand without success (but it should be possible). Instead I found a much more convenient way of doing it : from http://www.bloodshed.net/download.html download and install the IDE "DevC++". Then from within the program use the integrated package manager to automatically install the 4 libraries mentioned before. Finally copy all the files (".h", ".a" and don't forget the 2 scripts "sdl-config" and "libpng-config") related to those libraries from your DevC++ include/, libs/ and bin/ directory to the minGW include/ ,libs/ and bin/ directories.
TIP: I personally had quite some troubles before the sdl-config and libpng-config script were properly found by the install script. If I remember well I had to rename the sdl-config script which had a slightly different name in the win32 package.
From version 0.8.0, Stellarium uses C++ wstring which are unfortunately not yet supported by the libstdc++ shipped with MinGW32. It is however possible to compile using the STLPort library. Download version 5.0.2 on sourceforge (http://sourceforge.net/project/showfiles.php?group_id=146814) and follow the instructions for compiling the libstlport.5.0.dll.a and libstlport.5.0.dll libraries.
- Step 1) Open an MSYS console, from a tar archive, untar the sourcecode archive
tar -xzf stellarium-0.8.0.tgz cd stellarium-0.8.0
or if you start from a fresh CVS tree :
- Step 2) Now because we need to use STLport libstdc++ headers and library instead of the ones shipped with Mingw32, we must tell the compiler where to find the right ones and also to give it the right flags to perform a correct compilation. This can be done by setting the following environment variables (replace "/home/gerard/" with the path where you installed STLport) :
export CFLAGS="-Wall -O3 -s -fexceptions -fident -mthreads -D_STLP_NO_CUSTOM_IO -D_STLP_USE_DYNAMIC_LIB -I/export/home/ptr/workshop/extern/boost -I/home/gerard/STLport/stlport -L/home/gerard/STLport/lib" export CPPFLAGS="-Wall -O3 -s -Wsign-promo -fexceptions -fident -mthreads -D_STLP_NO_CUSTOM_IO -D_STLP_USE_DYNAMIC_LIB -I/export/home/ptr/workshop/extern/boost -I/home/gerard/STLport/stlport -L/home/gerard/STLport/lib -I/include/freetype2" export LDFLAGS="-Wall -O3 -s -Wsign-promo -fexceptions -fident -mthreads -L/home/gerard/STLport/lib -lstlport.5.0" export LIBS=" -lstlport.5.0"
- Step 3) You can then run the normal configure script
then if everything goes well :
- Step 4) If compilation succeed, try to run stellarium as a local version :
Building with Microsoft Visual Studio 8.0
After couple of weeks work I finally got the stellarium compiled and run using MS VisualStudio 8.0. MS C/C++ compiler is quite strict with the declarations of the variables and there is some differences with the functions that MS has/has not, but finally I got it work. A huge patch is posted to Fabien, waiting it to be approved ...
Use SVN to get the source code
Yes. Just use svn to get the source ...
- boost : from http://www.boost.org/
- libintl: from http://gnuwin32.sourceforge.net/
- zlib: http://www.zlib.net
- SDL: http://www.libsdl.org/
- libpng: http://www.libpng.org/pub/png/libpng.html
- freetype: http://freetype.sourceforge.net/index2.html
- libjpeg: http://freshmeat.net/projects/libjpeg/
Download the libraries and the development files (include the needed header-files), install packages and go on ...
Getting the source code : use 'SVN
Visual Studio settings
Adding paths for include files and libary files To add newly added libraries to default search path for compilation and debugging : start Visual Studio and go to Tools->Options Add external Directories to "Microsoft Visual Studio" from Tools->Options, select "Project and Solutions" anf from there "VC++ Directories".
Select "Include files" from "Show directories for:" and add directories :
C:\Zlib\include C:\SDL\include C:\freetype\include C:\libjpeg\include C:\libpng\include C:\Boost\include C:\GnuWin32\include
Next add Library locations of libraries, Select "Library Files" from "Show directories for:" and add directories:
C:\Zlib\lib C:\SDL\lib C:\freetype\lib C:\libjpeg\lib C:\libpng\lib C:\Boost\lib C:\GnuWin32\lib
1) To create solution for stellarium
* Select "New...->Project" from "File"-menu * From "Visual C++" type select general and from there select "Empty Project" * Enter name form project "Stellarium" * Enter name for Solution "Stellarium" * If You want to change the location of project just do it ;} * Click "OK"
Now there should be a solution called "stellarium" and under it project called "stellarium". Next step is to set the project properties
2) Project Properties
Select "Project->Properties" * Select "All Configurations" from "Configuration:", browse and set in "Configuration Properties" and set
General : Output Directory as C:\Stellarium Configuration Type as Appllication (.exe) C/C++ General Additional Include Directories: ...\stellarium\src\planetsephems; ...\stellarium\src\stelutils; ...\stellarium\src\msdirent; ..\stellarium\src; Preprocessor Preprocessor Definitions: _USE_MATH_DEFINES; _CRT_SECURE_NO_DEPRECATE; _ATL_SECURE_NO_DEPRECATE; main=SDL_main; POSIX; WIN32; WIN32_LEAN_AND_MEAN Linker Input Additipnal Dependices msvcrt.lib Ws2_32.lib freetype221.lib libpng13.lib SDL.lib libjpeg.lib libintl.lib SDLmain.lib zdll.lib Opengl32.lib Glu32.lib Ignore Specific Libraries as LIBCMT.lib System SubSystem as Console (/SUBSYSTEM:CONSOLE)
* Select "Release" from "Configuration:", browse and set in "Configuration Properties" and set C/C++ General Optimization as Optimization: Maximize Speed (/O2)
* Select "Debug" from "Configuration:", browse and set in "Configuration Properties" and set C/C++ General Debug Information Format as Program Database for Edit & Continue (/ZI) Optimization Optimization as Disabled (/Od) Preprocessor _USE_MATH_DEFINES; _CRT_SECURE_NO_DEPRECATE; _ATL_SECURE_NO_DEPRECATE; main=SDL_main; POSIX; WIN32; WIN32_LEAN_AND_MEAN DEBUG Output Files Program Database File Name as $(TargetDir)\vc80.pdb Linker Input Ignore Specific Libraries as LIBCMT.lib Debugging Generate Debug Info as Yes(/DEBUG)
2) Add files to "stellarium" project Add existing files to project:
"Header Files" : Add existing files, select all header files from ...\Stellarium\src "Source Files" : Add existing files, select all header files from ...\Stellarium\src
Now we have solution and project for stellarium, next thing is to add projects for "iniparser", "msdirent", "plantetsephms" and "stelutils". The creation of these projects is similar to "stellarium" project except the :
"Project type"s areStatic Library (.lib)
"C/C++->Preprocessor->Preprocessor Defines"s are _CRT_SECURE_NO_DEPRECATE;_USE_MATH_DEFINES
also the "stelutils"-project should have
"Additional Include Directories" as ...\stellarium\src\stelutils\iniparser ...\stellarium\src\planetsephems; ...\stellarium\src\stelutils; ...\stellarium\src\msdirent; ...\stellarium\src
To create dependencies right-click on "Stellarium" solution and select "Properties" 1) check that the "Single startup project" in "Common Properties->Startup Project" is checkd and the project selected is "Stellarium". 2) on "Project Dependencies" Stellarium is depended all other projects and other projects are independed
Yes, that's all folks! Just try to build the solution first on "Debug"-mode
Before actually run the application You must copy the libraries *.dll's into the target directory of build e.g. C:\Stellarium or have the *.dll's in Your path (I prefere the first: copy the dll's)
Also the directory structure of config/data/texture and so on must be present in the target directory e.g. C:\Stellarium
That's all !
Now! Just have fun and don't hesitate to contact me if You have problems and/or suggestions
Lippo (lippo dot huhtala at saunalahti dot fi)