CMake

From Second Life Wiki
Revision as of 17:13, 21 November 2008 by Rob Linden (talk | contribs) (→‎Linux: fmt)
Jump to navigation Jump to search

This page describes how to build the Second Life viewer with CMake. CMake is a system for generating per-platform build files. On Linux, it will generate Makefiles and KDevelop project files. On OS X, it will generate Makefiles and Xcode project files. On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.

Performing a build with CMake

Set up your environment

The instructions below assume you already have the source code and have set up your build environment. If you haven't done that yet, please see Get source and compile. Per platform instructions are available in these topics:

Configuring your tree

Before you first run a build, you'll need to configure things.

There's a develop.py script that will do this for you. Simply run it from the command line and it will create a reasonably sane default configuration. Note: You need to cd into the intra subdirectory for it to work.

  • if you're using VisualStudio 2005, use "python develop.py -G VC80". See Discussion for more info.
  • if you're using VisualStudio 2008, use "python develop.py -G VC90".
NOTE: The above commands will configure a "non-standalone" version of the source code tree. This means that the required third party library packages (as built by Linden Lab) will be downloaded during the CMake process.
TODO : "How to configure a standalone source code tree." (probably as a link to a new page, as this is a significantly involved task and will break up the flow of this document)


In the CMake world, we keep source and object files separate. The develop.py script will create and populate a build directory for you.

On Linux, this will be named viewer-linux-i686.

On OS X, it will be build-darwin-universal.

On Windows, it will be 'build-vc71' (VS 2003) , 'build-vc80' (VS 2005) or 'build-vc90' (VS 2008).

What to expect

Running develop.py does not actually start a build. It just generates the makefiles, project files, or whatever that you'll need. After you're done, you'll have a top-level makefile or project file in your build directory. Run make or load it into your IDE, and away you go!

In principle, your build should run to completion. If you run into any problems, please report them. Better yet, if you can fix them and supply patches, we'd be thrilled! Please follow the usual contribution agreement guidelines.

Where's the built viewer?

The location of the newly built viewer depends on your platform.

Windows

On Windows, the built viewer ought to run from VS2005.

Mac OS X

On OS X, your viewer build will be here by default:

build-darwin-universal/newview/RelWithDebInfo/Second Life.app

If you change the kind of build you use, the intermediate directory will also change, e.g. from RelWithDebInfo to Release.

Linux

On Linux, your build will be here:

viewer-linux-ARCH-BUILD/newview/packaged

...where "ARCH" is something like "i686" or "x86_64" (depending on your platform), and "BUILD" depends on which debug level you chose.

Prebuilt libraries vs. standalone builds

While many users will want to use the prebuilt libraries that we provide, we're also interested in making life as easy as possible for packagers who want to use their platform's native libraries.

If you run ccmake, you should see a STANDALONE option that determines whether the build will use your system's libraries or our prepackaged ones. Flipping this to ON should be all you need to do to perform a packager-friendly build.

For standalone builds, we'd really like to beef up the checks for system libraries so that for example cmake will fail if a required library (such as OpenJPEG) isn't installed. We welcome all patches that help out with this.

What to do if it doesn't work for you

Please also see the (user contributed) instructions at User:Michelle2_Zenovka/cmake