Difference between revisions of "Build the Viewer on Windows"

From Second Life Wiki
Jump to navigation Jump to search
(Update CMake, Python installations. Add numbered steps to allow "I'm stuck on Step...")
(No difference)

Revision as of 15:01, 27 January 2021

This "Minimum Requirements recipe" listed below works for both local machines and VMs such as VMWare Fusion.

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.



KBcaution.png Some Gotchas before we start

The external package versions and bit-widths listed below have been carefully selected and tested. If you decide to install a different version of a given package (even a minor update), you are on your own.

This recipe, by design, only covers development using the Cygwin shell - some commands will have to be modified if you want to use the Windows Command Prompt instead.

Step 1. Install Software

Microsoft Visual Studio 2017

CMake

  • Download and install the latest version of CMake
    • At the "Install options" screen, select "Add CMake to the system PATH for all users"
    • For everything else, use the default options (path, etc.)

Cygwin

  • Download and install Cygwin 64
    • Use default options (path, components etc.) *until* you get to the "Select Packages" screen
    • Add additional packages:
      • Devel/patch
    • Use default options for everything else

Python

  • Download and install the most recent version of Python 2.7
    • Use default options (path, components etc.) *until* you get to the "Customize Python" screen
    • Change "Add python.exe to Path" to "Will be installed on local hard drive"

NSIS (Optional)

NSIS is not required unless you need to build an actual viewer installer for distribution, or change the NSIS installer package logic itself.

  • Install the Unicode version here and not the one from the NSIS page

Step 2. Intermediate check

KBnote.png Confirm things are installed properly so far

Open a Cygwin terminal and type:

cmake --version
hg --version
python --version
If they all report sensible values and not "Command not found" errors, then you are in good shape

Step 3. Install Autobuild

Step 4. Checkout viewer code

Open a Cygwin shell and create a folder to hold your work

cd /cygdrive/c
mkdir work
cd work

Check out the current viewer sources

git clone https://bitbucket.org/lindenlab/viewer.git

Step 5. Setup viewer build variables

Get viewer-build-variables; see Building the Viewer with Autobuild#Select Build Variables.

Step 6. Configure build

Switch to the viewer repository you just checked out and run autobuild configure

cd viewer
autobuild configure -c configuration -A 64

where configuration is either "RelWithDebInfoOS" or "ReleaseOS". You can omit that 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 7. Build

When that completes, you can either build within Visual Studio or from the command line

autobuild configure 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 within Visual Studio

Open the VS 2017 solution file

cygstart build-vc150-64/SecondLife.sln
  • Select Release or RelWithDebInfo from the pulldown. (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"
wait...

When the build completes (hopefully without errors) run it by pressing Control-F5

KBnote.png Debugging from Visual Studio If you wish to debug from VS you will need to run the initial autobuild configure step with the CMake option -DUNATTENDED:BOOL=FALSE

Additional Tools & Settings you might need

  • Tools
    • Install a Visual Studio helper like WholeTomato Visual Assist for VS2017 or Workspace Whiz
    • Install a decent merge tool such as Araxis, Beyond Compare, VSCode
    • Install PyInstaller developer version using pip.
      This is only required to create local Windows builds of modifications to the Viewer Management Process startup shim.
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop