User:Dzonatas Sol/Compiling The Viewer

From Second Life Wiki
Jump to: navigation, search

Overview

SCons and CMake together can make a very powerful builder and development environment utilities. They both have unique features that we need. This document focuses mainly on SCons to just get the viewer built.

Ideally, we need the builder to be very portable and to give the exact same results on every build. The SConstruct file as it has existed has been mainly for a Linux specific build. There are additional files, found in OSLCC, that can be used to make this work on Win32 environments.

There are two main ways to build the viewer, and that is with or without the pre-built libraries. The SCons script can compile the libraries, but that is not recommended for those that only want to compile and test the viewer. If you start to distribute your built viewer or use custom libraries, you will want to compile the libraries to ensure compliance with ABIs and licenses.

Prerequisites

Microsoft Windows

If you don't already have these, then install:

NOTE: You may want to put OpenGL, FMOD, and Quicktime in a separate tree and copy them over as described here.

The Cygwin installer is different from most installers in that it allows you to install many tools in addition to the base installation. You select the packages you want by clicking on the funny double arrow icons for the packages you want. Ordinarily, you only need the binaries, not the source. You can install more packages at a later time or update the packages you have by running the setup.exe program again, so keep it around. It is best to use the same download site every time.

In order for Cygwin and Python to be accessed without having to specify their full paths, add them to the "Path" environment variable. Go to

Control Panel -> System -> Advanced -> Environment Variables

and add ;c:\cygwin\bin;c:\Python25 to the System variable "Path"

Get the source

Create your preferred workspace and use subversion to retrieve the source:

 > md workspace
 > cd workspace
 > svn co http://oslcc.svn.sourceforge.net/svnroot/oslcc/sandbox/branches/llscons/1.18.6 linden

The SCons control files

  • indra\SConstruct - this files replaces the SConstruct file that comes with the Linden distributions
  • indra\llscons\msvc.sconscript - this defines the compile and link flags and defines the path for libraries and header files
  • indra\llscons\win32.sconscript - this defines the build paths
  • indra\llscons\win32\libs.files.lst - a list of libraries to use
  • indra\llscons\win32\newview.sconscript - build instructions for the viewer

If you want to build a version that is not in the oslcc repository, you can get these five files, put them in the appropriate places in your build tree, and edit them as necessary.

Install the pre-built libraries

This step will be automated, but this is an example of how to install them.

Install the libraries into the workspace:

 > cd workspace
 > wget http://secondlife.com/developers/opensource/downloads/2007/12/slviewer-win32-libs-RC-1.18.6.0.zip
 > unzip slviewer-win32-libs-RC-1.18.6.0.zip

If you do not have 'wget' or 'unzip', you can use your web browser to download the libs from Source downloads and then use windows directory explorer to open the zip files. Once opened, copy and paste the linden folder into your workspace. (Reply 'yes' if it asks you to overwrite files.)

If you haven't already, make sure FMOD, OpenGL headers, and Quicktime are install at this time.

Compile

By default, the scripts assume you have the pre-built libraries installed in your workspace.

To compile, just run scons:

> cd workspace\linden\indra
> scons

If there are no errors reported from that step, you will have a full build of the viewer.

Libraries

  • TODO: update to compile with all library sources