Build the Viewer on Windows
This document is mostly complete and has been tested a number of times on bare metal systems. It is expected (and hoped) that developers will improve and refine this process over time - there are still some rough edges and things will change as new versions of software become available.
Step 1. Install Requirements
Required software:
- CMake
- Git
- Visual Studio 2017 - Select "Desktop development with C++" workload
- Python 3 - Check "Add Python to PATH"
- Autobuild - See instructions below
Autobuild
Open a terminal and install autobuild using Python's pip command:
pip install git+https://bitbucket.org/lindenlab/autobuild.git@v3
Intermediate Check
Confirm things are installed properly so far by typing the following in a terminal:
cmake --version python --version git --version autobuild --version
If everything reported sensible values and not "Command not found" errors, then you are in good shape! If the autobuild
command is not found then you may need to add your python installation's Scripts
directory to your system path.
Step 2. Checkout Code
Viewer
Open a terminal and checkout the viewer source code:
git clone https://bitbucket.org/lindenlab/viewer.git
Build Variables
See Building the Viewer with Autobuild#Select Build Variables.
Step 3. Configure
Switch to the viewer repository you just checked out and run autobuild configure
:
cd viewer autobuild configure -c RelWithDebInfoOS -A 64
The -c
argument determines which build configuration to create, generally either RelWithDebInfoOS
or ReleaseOS
. You can omit the option if you set the AUTOBUILD_CONFIGURATION
environment variable to the one you want.
-A
may be either 64
or 32
, depending on which you intend to build. You can omit that option if you set the AUTOBUILD_ADDRSIZE
environment variable accordingly.
Please be patient: the autobuild configure
command silently fetches and installs required autobuild packages, and some of them are large.
Step 4. Build
When that completes, you can either build within Visual Studio or from the command line
Autobuild Options
For help on configure
options, type:
autobuild configure --help
The BUILD_ID
is only important for a viewer you intend to distribute. For a
local test build, it doesn't matter: it only needs to be distinct. If you
omit --id
(as is typical), autobuild will invent a BUILD_ID
for you.
For the Linden viewer build, this usage:
autobuild configure [autobuild options]... -- [other options]...
passes [other options] to CMake. This can be used to override different CMake variables, e.g.:
autobuild configure [autobuild options]... -- -DSOME_VARIABLE:BOOL=TRUE
The set of applicable CMake variables is still evolving. Please consult the
CMake source files in indra/cmake
, as well as the
individual CMakeLists.txt
files in the indra
directory tree,
to learn their effects.
Command Line Builds
In bash, initialize your tools environment by running:
eval $(autobuild source_environment)
That only needs to be done once per bash session.
Build by running:
autobuild build --no-configure -c <CONFIGURATION> -A 64
the resulting viewer executable will be at:
build-vc150-64/newview/<CONFIGURATION>/secondlife-bin.exe
Building in Visual Studio
Configure your build to run in attended mode:
autobuild configure -c <CONFIGURATION> -- -DUNATTENDED:BOOL=FALSE
- Open the generated Visual Studio solution file build-vc150-64/SecondLife.sln
- Select Release or RelWithDebInfo from the configuration dropdown. (Debug is unmaintained. It would probably fail with perplexing errors.)
- Select your starting project, if desired
- Right-click on "secondlife-bin" in the Solution Explorer and select "Build"
When the build completes (hopefully without errors) run it by pressing Control-F5
Additional Tools
- A Visual Studio helper like WholeTomato Visual Assist for VS2017 or Workspace Whiz
- A decent merge tool such as Araxis, Beyond Compare, VSCode
- Cygwin may be required for some tooling
- NSIS (Unicode version) - (Optional) Required if creating a viewer installer for distribution
- PyInstaller is required to create local modifications of the Viewer Management Process startup shim