Celestia/Development/Win32 platform

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Celestia development options using Windows-32 software packages:

Subversion (svn)[edit | edit source]

Celestia's source code is available on a Subversion (SVN) repository hosted on SourceForge.

Several Subversion clients are available for Windows. A very popular one is TortoiseSVN, a Windows shell extension that lets you use SVN commands right from Windows Explorer. A command line version is available with Cygwin.

To get the latest Celestia source using the command line client, cd to the desired directory and then issue the command

svn co https://celestia.svn.sourceforge.net/svnroot/celestia/trunk

With Tortoise SVN, select 'Checkout' from the Windows Explorer popup menu, and then enter this URL:

https://celestia.svn.sourceforge.net/svnroot/celestia/trunk

Microsoft C++ & SDK tools for Windows XP and Windows 7[edit | edit source]

In order to build software for Windows, you need both an SDK (Software Development Kit) and a compiler. The SDK provides libraries and include files needed for building for a particular version of Windows. The compiler converts text files into binary programs, linking them to the SDK libraries. Microsoft provides free versions of their SDKs and compilers, although with limited features, in order to encourage development of software for use with their operating systems. They also sell enhanced versions for use by commercial software development organizations.

VS2010[edit | edit source]

Currently, there is no Visual Studio 2010 solution checked into the subversion repository. If you have VS2010, you will have several unsupported steps to perform, in addition to the steps outlined for previous versions of Visual Studio.

  • First, VS2010 will convert the previous version's project files into VS2010 format. These converted versions will have mismatching $(TargetFile) and linker output file definitions. These will have to be manually reconciled. One choice is to set the General project property "Target Name" to "$(ProjectName)" and the linker property "Output File" to "$(OutDir)$(TargetName)$(TargetExt)". This will allow you to build, but it will not run.
  • Second, and most significantly, the static libraries zlib and libpng in the repository are compiled to work only with the redistributable runtime dlls for VS2008, namely msvcm90.dll, msvcp90.dll and msvcr90.dll. These runtimes are incompatible with VS2010, so you will have to obtain zlib and libpng (and the debug versions) that will run with 2010. The easiest way to do this may be to grab the sources from sourceforge, build them yourself, put the new libs in windows\lib\x86, and change the entries in the linker's "Additional Dependencies" property.
  • Finally, you must ensure that the celestia.exe and the dlls in windows\dll are copied into $(ProjectDir), and that the Debugging "Command" property is set to "$(ProjectDir)\$(TargetFileName)" and the "Working Directory" property is set to $(ProjectDir).

There may be other steps to perform, depending upon the versions of zlib and libpng that you obtain.

VS2008[edit | edit source]

In December 2007, Microsoft released Visual C++ 2008 Express Edition. As of Celestia version 1.6.0, this is the only version of the compiler recommended for building Celestia. Note that Visual C++ 2008 will not run on Windows 98. For this reason only, you may want to use Visual Studio 2005. If you have Windows 2000, XP, Vista or 7, compiling is much easier with Visual C++ 2008.

  • If you do not already have Microsoft Visual C++ 2008, you may download it for free from here:
http://msdn.microsoft.com/en-us/express/future/bb421473

When installing VS C++ 2008 SP1 using the Web installation , it automatically downloads and installs all of the correct SDK libraries, too. This happens under both Windows XP, 32bit, and Windows 7, 64bit. The SDK does not need to be downloaded or installed separately.

  • If you also need the Windows SDK, it is a free download from Microsoft:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en

Step by step instructions for Visual C++ 2008 Express Edition[edit | edit source]

These instructions work for both Windows XP and Windows 7.

This process assumes that you've followed the steps above, checked out the source from SVN, and installed the Visual C++ compiler and Windows SDK.

  1. Copy iconv.dll, intl.dll and lua5.1.dll from trunk\celestia\windows\dll\x86 into trunk\celestia
    • Celestia is a 32bit x86 application. There are no x64 libraries.
  2. Open celestia.sln in Microsoft Visual C++.Net 2008 and allow the updater to work.
    • In other words, select (double-click on) celestia.sln in the directory trunk\celestia
  3. Set the build type to "Release". (The project provided from svn has it set to "Debug")
    • Specifically, in the line of icons across the top of the VisualStudio window, where it initially says "Debug", open its dropdown menu and select "Release"
  4. Build!
    • Open the menu "Build" and select "Rebuild Solution"

VS2005[edit | edit source]

Recommended only for users of Windows 98/ME, where the Visual C++ 2008 is not supported. If you are running XP, Vista or 7, you should use the much easier process described in the previous section.

  • Windows Platform SDK: Web Install
http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en
  • Windows Platform SDK: disk image
http://www.microsoft.com/downloads/details.aspx?FamilyID=e15438ac-60be-41bd-aa14-7f1e0f19ca0d&DisplayLang=en
  • Visual Studio 2005 Express C++: Web install
http://www.microsoft.com/express/2005/download/default.aspx
  • Visual Studio 2005 Express C++: disk image
http://msdn2.microsoft.com/en-us/express/aa718401.aspx

Celestia libraries for VS2005[edit | edit source]

The libraries in the Celestia repository were built with VS2008, and will not work on Windows 98/ME:

Celestia Libraries for Visual Studio 2005 Express:

http://www.shatters.net/~claurel/celestia/winbuild/
  • As of October, 2007, use
    • cspice.lib
    • winbuild-2.zip
    • winlibs-2.zip
Several source code files have been added to Celestia's svn repository since winbuild-2.zip was created. Insert these lines into the OBJS section of celestia/src/celengine/engine.mak if you're using makerelease.bat to build from the current subversion repository:
       $(INTDIR)\axisarrow.obj \
       $(INTDIR)\customrotation.obj \
       $(INTDIR)\frametree.obj \
       $(INTDIR)\precession.obj \
       $(INTDIR)\scriptrotation.obj \ 
       $(INTDIR)\timeline.obj \
       $(INTDIR)\timelinephase.obj \
The SPICE include files are included in winlibs-2.zip.
No binary DLLs (Dynamically Loaded Libraries) are included in these Zip files, so you'll have to get them from one of the precompiled Celestia installation kits. As of January 26, 2008, use the DLLs which are included in Celestia v1.5.0. The official release of Celestia v1.5.0 is available on SourceForge.


The version of Celestia that's included in the Windows Celestia distribution kits is compiled using the script makerelease.bat. The older VS2003 versions of the build scripts are still what are in the cvs archive on SourceForge. The makefiles and .bat scripts which have been updated for VS2005/VS2008 are included in winbuild-2.zip [Remark: There is no makerelease.bat in winbuild-2.zip], which is in the VS2005 winbuild directory shown above.

Don't forget that you'll have to configure the PATH, LIB and INCLUDE environment variables according to your particular development environment so that the build scripts will find the Visual Studio and Celestia programs, include files and libraries.

Here's one example .BAT script for defining the search lists. It probably won't work for you: you probably have put the files in different directories. Change it appropriately.

Set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include;%INCLUDE%
Set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include\mfc;%INCLUDE%
Set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\include;%INCLUDE%
Set INCLUDE=C:\cvs\Celestia\celestia\inc;%INCLUDE%

Set PATH=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;%PATH%
Set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;%PATH%
Set PATH=C:\Program Files\Microsoft Visual Studio 8\VC\bin;%PATH%

Set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
Set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\lib;%LIB%
Set LIB=C:\cvs\Celestia\celestia\lib;%LIB%