My favorites | Sign in
Google
o3d
                
HowToBuild  
How to get the source and build.

Prerequisites

All platforms

Windows

Additional (free) downloads

Mac OS X

Linux

Checking out the code

The gclient config step only needs to be run once to set up your working directory. It creates a .gclient file in your working directory that identifies the corresponding structure to pull from the repository. The gclient sync step creates several subdirectories. To update your tree in the future, you only need to run gclient sync from anywhere within your working directory.

Building

Just like Chrome, O3D Uses GYP to generate build files for each of the platforms. On Windows, this produces .sln and .vcproj files, on Mac OS X it produces .xcodeproj bundles, and on Linux it produces SConscript files.

Building on any supported platform

If you just want to build regardless of platform you can use gypbuild to do the building for you. From the $O3D_ROOT/o3d folder type ./gypbuild on any platform. For more info about gypbuild try 'gypbuild --help'.

Otherwise for specific platforms see below.

Building on Windows

On Windows, GYP produces the solution files that are to be loaded into Microsoft Visual Studio. The "main" solution file is called "o3d.sln", and will appear in the $O3D_ROOT\o3d\build directory. Load this file into Visual Studio, and build it as you would any other Visual Studio file. The output will appear in the $O3D_ROOT\o3d\build\Debug or $O3D_ROOT\o3d\build\Release directory, depending on the build you do.

Building different renderers

O3D has two different renderers on Windows, a D3D-based renderer, and an OpenGL-based renderer. The D3D renderer is the default, but if you want to build the OpenGL renderer, set the variable "GYP_DEFINES" to "renderer=gl" and run the command gclient runhooks --force to regenerate the solution/vcproj files. Unfortunately switching between renderers requires a rebuild, as they use the same output directories currently.

Building on Mac

On Mac OS X, GYP produces the XCode build files that are to be loaded into XCode. The "main" build file is located in $O3D_ROOT/o3d/build/o3d.xcodeproj. Load this file into XCode, and build it as you would any other XCode file. The output will appear in the $O3D_ROOT/xcodebuild/Debug or $O3D_ROOT/xcodebuild/Release directory, depending on the build you do.

Building on Linux

On Linux, GYP produces SConscript and .scons files. The main SConscript is in $O3D_ROOT/o3d/build/o3d_main.scons. To build this file, use 'hammer' from the software construction toolkit (installed as part of the depot_tools). Change directories into the $O3D_ROOT/o3d/build directory, and type hammer -f o3d_main.scons Note: to build the 64-bit plugin, you need to tell gyp that you are building it, by setting the GYP_DEFINES environment variable to target_arch=x64 before you run gclient sync (or run gclient runhooks --force).

At the moment, Linux requires special instructions to run, see below.

hammer -s -j3 -f o3d_main.scons  # build quietly running 3 compiles at a time
hammer --verbose -f o3d_main.scons # display full command lines (useful for debugging compile and links errors)
hammer -C $O3D_ROOT/o3d/build -f o3d_main.scons  # build from where you are

You can also use make instead to build, using similar instructions to Chromium's:

# Update and rebuild makefiles if needed
export GYP_GENERATORS="make"
gclient sync
# Build everything.
make -C $O3D_ROOT O3D_All
# Only build the plugin.
make -C $O3D_ROOT npo3dautoplugin

Note: the output of the make build goes to $O3D_ROOT/out instead of $O3D_ROOT/sconsbuild.

Running/Debugging on Linux

Warning: the Linux version of O3D is still experimental. When trying it is suggested to create a separate profile for Firefox (using firefox -ProfileManager to create it, and firefox -P profile -no-remote to use it).

On Ubuntu and other Debian-derived systems, scons will build a .deb installer package into the artifacts directory (provided dpkg-buildpackage is installed, which you can find in the dpkg-dev package). To install, simply execute sudo gdebi-gtk <file> with the appropriate .deb file (...i386.deb for 32-bit systems, or ...amd64.deb for 64-bit systems).

For non-Debian-derived systems, you currently must install O3D manually. scons builds the plug-in—a shared library named libnpo3dautoplugin.so—into the artifacts directory. This needs to be findable by Firefox, and you have several options for that:

Additionally, that plug-in dynamically links with other shared libraries that Firefox needs to find: libGLEW.so.1.5, libCg.so and libCgGL.so. scons copies them into the artifacts directory. By default, Firefox will find not find them though, which will prevent the O3D plug-in from loading. You have several options again:

After you have installed, run Firefox and try our samples (in googleclient/o3d/samples). To debug, firefox -g starts Firefox in gdb.

Running tests

Unit tests

You can run unit tests and other tests using scons.

scons unit_tests  # runs unit tests

Selenium

The Selenium tests form a suite of automated browser integration tests. Several pages are loaded into the browser and actions performed on them to ensure that they function as expected.

The customized selenium script for O3D takes screenshots of the display buffer and uses perceptualdiff to compare them with reference screenshots. Note: Screenshots are only taken and diffed in the test-* builds. (eg. Use MODE=test-dbg-d3d to build the test build of the dbg-d3d)

To run selenium tests, execute:

scons selenium MODE=test-dbg-d3d

(Replace test-dbg-d3d with whichever build you want to test.)

There are several other flags pertaining to selenium that you can use: (eg.)

scons selenium MODE=test-dbg-d3d SELENIUM_VERBOSE=0 SELENIUM_BROWSERS=*firefox    # Test the test-dbg-d3d build on firefox with no verbose output

SELENIUM_VERBOSE = {0, 1} Controls if verbose output is displayed for debugging purposes.

SELENIUM_BROWSERS = Comma-delimited string of browsers to test in selenium.

Currently supported browsers for testing in selenium:

You can choose individual tests like this

scons selenium SELENIUM_TEST_PREFIX=TestSampleRotateModel

Which will effectively test only TestSampleRotateModel. The argument is a prefix so TestSampleW will run any test that starts with TestSampleW.