Difference between revisions of "Build the Viewer on Windows"

From Second Life Wiki
Jump to navigation Jump to search
(Clarification on Cygwin package requirement.)
(Overhauled instructions for Python 3, emphasize happy path)
Line 1: Line 1:
{{OSWikiContribBox}}
{{OSWikiContribBox}}
__NOTOC__
__NOTOC__
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.
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.


__TOC__
__TOC__


==Step 1. Install Requirements==


{{KBcaution|custom=Some Gotchas before we start|
Required software:
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.
* [https://cmake.org/download/ CMake]
}}
* [https://git-scm.com/downloads Git]
* [https://visualstudio.microsoft.com/vs/older-downloads/ Visual Studio 2017] - Select "Desktop development with C++" workload
* [https://www.python.org/downloads/ Python 3] - Check "Add Python to PATH"
* [https://bitbucket.org/lindenlab/autobuild Autobuild] - See instructions below


==Step 1. Install Software==
===Autobuild===


===Microsoft Visual Studio 2017===
Open a terminal and install autobuild using Python's pip command:
* [https://visualstudio.microsoft.com/vs/older-downloads/ Download and install Visual Studio 2017]
pip install git+https://bitbucket.org/lindenlab/autobuild.git@v3
** During installation select the '''Desktop development with C++''' workload for installation


===CMake===
===Intermediate Check===
*Download and install the [https://cmake.org/download/ 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===
Confirm things are installed properly so far by typing the following in a terminal:
*Download and install [http://cygwin.com/install.html Cygwin 64]
cmake --version
**Use default options (path, components etc.) *until* you get to the "Select Packages" screen
python --version
**Add additional packages:
git --version
***patch (Category: Devel)
autobuild --version
**Use default options for everything else


===Python===
If everything reported sensible values and not "Command not found" errors, then you are in good shape! If the <code>autobuild</code> command is not found then you may need to add your python installation's <code>Scripts</code> directory to your system path.
*Download and install the most recent version of [https://www.python.org/downloads/release/python-2718/ 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)===
==Step 2. Checkout Code==


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


* Install the Unicode version [http://www.scratchpaper.com/ here] and not the one from the NSIS page
Open a terminal and checkout the viewer source code:
git clone https://bitbucket.org/lindenlab/viewer.git


==Step 2. Intermediate check==
===Build Variables===
{{KBnote|custom=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==
See [[Building the Viewer with Autobuild#Select Build Variables]].


* Open a Windows command prompt: cygwin, cmd or powershell
==Step 3. Configure==
** <code>pip install "git+https://bitbucket.org/lindenlab/autobuild.git@v1.1.9""</code>
** Check that <code>autobuild --version</code> is accessible and reports version 1.1.9


==Step 4. Checkout viewer code==
Switch to the viewer repository you just checked out and run <code>autobuild configure</code>:
Open a Cygwin shell and create a folder to hold your work
  cd viewer
  cd /cygdrive/c
  autobuild configure -c RelWithDebInfoOS -A 64
  mkdir work
 
cd work
The <code>-c</code> argument determines which build configuration to create, generally either <code>RelWithDebInfoOS</code> or <code>ReleaseOS</code>. You can omit the option if you set the <code>AUTOBUILD_CONFIGURATION</code> environment variable to the one you want.
Check out the current viewer sources
<code>-A</code> may be either <code>64</code> or <code>32</code>, depending on which you intend to build. You can omit that option if you set the <code>AUTOBUILD_ADDRSIZE</code> environment variable accordingly.
git clone https://bitbucket.org/lindenlab/viewer.git


==Step 5. Setup viewer build variables==
Please be patient: the <code>autobuild configure</code> command silently fetches and installs required autobuild packages, and some of them are large.
Get viewer-build-variables; see [[Building the Viewer with Autobuild#Select Build Variables]].


==Step 6. Configure build==
==Step 4. 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.
<code>-A</code> 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 <tt>autobuild configure</tt> command silently fetches and installs required autobuild packages, and some of them are large.
When that completes, you can either build within Visual Studio or from the command line


==Step 7. Build==
===Autobuild Options===


When that completes, you can either build within Visual Studio or from the command line
For help on <code>configure</code> options, type:
===autobuild configure options===
For help on <tt>configure</tt> options, type:
  autobuild configure --help
  autobuild configure --help


The BUILD_ID is only important for a viewer you intend to distribute. For a
The <code>BUILD_ID</code> 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
local test build, it doesn't matter: it only needs to be distinct. If you
omit <tt>--id</tt> (as is typical), autobuild will invent a BUILD_ID for you.
omit <code>--id</code> (as is typical), autobuild will invent a <code>BUILD_ID</code> for you.


For the Linden viewer build, this usage:
For the Linden viewer build, this usage:
Line 96: Line 72:


The set of applicable CMake variables is still evolving. Please consult the
The set of applicable CMake variables is still evolving. Please consult the
CMake source files in <tt>indra/cmake</tt>, as well as the
CMake source files in <code>indra/cmake</code>, as well as the
individual <tt>CMakeLists.txt</tt> files in the <tt>indra</tt> directory tree,
individual <code>CMakeLists.txt</code> files in the <code>indra</code> directory tree,
to learn their effects.
to learn their effects.


===Command Line Builds===
===Command Line Builds===
In bash, initialize your tools environment by running:
In bash, initialize your tools environment by running:
  eval $(autobuild source_environment)
  eval $(autobuild source_environment)
Line 106: Line 83:


Build by running:
Build by running:
  autobuild build --no-configure  -c ''configuration'' -A 64
  autobuild build --no-configure  -c <CONFIGURATION> -A 64
the resulting viewer executable will be at:
the resulting viewer executable will be at:
  build-vc150-64/newview/''configuration''/secondlife-bin.exe
  build-vc150-64/newview/<CONFIGURATION>/secondlife-bin.exe
 
===Building in Visual Studio===


===Building within Visual Studio===
Configure your build to run in attended mode:
Open the VS 2017 solution file
autobuild configure -c <CONFIGURATION> -- -DUNATTENDED:BOOL=FALSE
cygstart build-vc150-64/SecondLife.sln
* Open the generated Visual Studio solution file '''build-vc150-64/SecondLife.sln'''
* Select Release or RelWithDebInfo from the pulldown. (Debug is unmaintained. It would probably fail with perplexing errors.)
* Select Release or RelWithDebInfo from the configuration dropdown. (Debug is unmaintained. It would probably fail with perplexing errors.)
* Select your starting project, if desired
* Select your starting project, if desired
* Right-click on "secondlife-bin" in the Solution Explorer and select "Build"
* 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
When the build completes (hopefully without errors) run it by pressing Control-F5


{{KBnote|custom=Debugging from Visual Studio|
==Additional Tools==
If you wish to debug from VS you will need to run the initial autobuild configure step with the CMake option <nowiki>-DUNATTENDED:BOOL=FALSE</nowiki>}}


==Additional Tools & Settings you might need==
* A Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2017] or [http://workspacewhiz.com/ Workspace Whiz]
*Tools
* A decent merge tool such as Araxis, Beyond Compare, VSCode
**Install a Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2017] or [http://workspacewhiz.com/ Workspace Whiz]
* [http://cygwin.com/install.html Cygwin] may be for some tooling
**Install a decent merge tool such as Araxis, Beyond Compare, VSCode
* [http://www.scratchpaper.com/ NSIS (Unicode version)] - (Optional) Required if creating a viewer installer for distribution
** Install [http://www.pyinstaller.org PyInstaller] developer version using pip.
* [http://www.pyinstaller.org PyInstaller] is required to create local modifications of the Viewer Management Process startup shim
**: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


[[Category:Open Source]]
[[Category:Open Source]]
[[Category:Compiling viewer]]
[[Category:Compiling viewer]]

Revision as of 21:20, 1 March 2022

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:

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