Difference between revisions of "Build the Viewer on Windows"

From Second Life Wiki
Jump to navigation Jump to search
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{OSWikiContribBox}}
{{Multi-lang}}
__NOTOC__
{{CompileNav}}
=Visual Studio 2013 - Second Life Developer set up=
{{TOC}}
This "Minimum Requirements recipe" listed below works for both local machines and VMs such as VMWare Fusion.


This document is mostly complete (see <font color="#ff3333">Todo</font> sections below 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==


{{KBnote|custom=For Lindens Only|See [https://wiki.lindenlab.com/wiki/User:Callum/VS2013_Developer_Setup this page on the internal wiki for specifics of internal use].}}
Required software:


{{KBwarning|
* [https://cmake.org/download/ CMake]
These instructions ''will not work'' with viewer-release because they are being updated to build the 64bit (Alex Ivy) repository; for instructions that will work on other repositories, use the '''history''' tab above to view the instructions from 15 Jun 2017.
* [https://git-scm.com/downloads Git]
* [https://visualstudio.microsoft.com/vs/older-downloads/ Visual Studio 2022] - Select "Desktop development with C++" workload
* [https://www.python.org/downloads/ Python 3.7+] - Be sure to "Add Python to PATH"
* [[Autobuild]]


Be aware that upgrading the tools on your system to those described here will mean that you will not be able to build older versions of the viewer.
===Intermediate Check===
}}


{{KBcaution|custom=Some Gotchas before we start|
Confirm things are installed properly so far by typing the following in a terminal:
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.
cmake --version
 
python --version
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.
git --version
autobuild --version


You will need at the very least, these items before you begin:
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.
*An installer for Windows 10 Pro 64bit
*A valid Windows Product key
*An installer for Visual Studio 2013
*A valid license for Visual Studio 2013
}}
__TOC__
==Windows==


*Install Windows 10 Pro 64bit using your own product key
==Step 2. Checkout Code==


*Keep running Windows Update (Start Menu -> All Programs -> Windows Update) until clicking on "Check for Updates" there tells you everything is up to date. Depending on the age of the install media you started with, this could take a really long time and many, many iterations.
===Viewer===


==Microsoft Visual Studio 2013 Pro==
Open a terminal and checkout the viewer source code:
*Install VS 2013 Pro
git clone https://github.com/secondlife/viewer.git
* Note: If you don't own a copy of VS 2013 Pro, you might consider installing the [https://go.microsoft.com/fwlink/?LinkId=517284 Community version]
**Run the installer as Administrator (right click, "Run as administrator")
**Uncheck all the "Optional features to install:" - they are not required


==DirectX SDK==
===Build Variables===
*Download and install [http://www.microsoft.com/en-us/download/details.aspx?id=6812 DirectX SDK (June 2010)]
**Run the installer as Administrator (right click, "Run as administrator")
**At the Installation Options screen, set everything except the DirectX Headers and Libs to "This feature will not be installed"


==CMake==
See [[Building the Viewer with Autobuild#Select Build Variables]]
*Download and install at least [http://www.cmake.org/download/ CMake 3.4.3] (32bit is only option)
**Run the installer as Administrator (right click, "Run as administrator")
**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==
==Step 3. Configure==
*Download and install [http://cygwin.com/install.html Cygwin 64] (64bit)
**Run the installer as Administrator (right click, "Run as administrator")
**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==
Switch to the viewer repository you just checked out and run <code>autobuild configure</code>:
*Download and install the most recent version of [https://www.python.org/downloads/windows/ Python 2.7 (32bit)]
cd viewer
**'''It is important to use 32-bit Python. The VMP requires it.'''
autobuild configure -c RelWithDebInfoOS
**Note: No option available to install as Administrator
**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"


==Intermediate check==
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.
{{KBnote|custom=Confirm things are installed properly so far|
<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.
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}}


==Set up Autobuild and Python==
Please be patient: the <code>autobuild configure</code> command silently fetches and installs required autobuild packages, and some of them are large.
*Install Autobuild
** Open a command prompt, either cygwin or Windows Command Prompt
** Windows: <code>pip install hg+http://bitbucket.org/lindenlab/autobuild-1.1#egg=autobuild</code>
** cygwin: <code>pip install "hg+http://bitbucket.org/lindenlab/autobuild-1.1#egg=autobuild"</code>
*** (The quotes are important for cygwin, otherwise it thinks the # is a comment delimiter)
** Autobuild will be installed.  '''Earlier versions of autobuild could be made to work by just putting the source files into your path correctly; this is no longer true - autobuild ''must'' be installed as described here'''
*Check
** <code>autobuild --version</code>
** should report 1.1.5 or later


==NSIS (Unicode)==
==Step 4. Build==
* You must install the Unicode version [http://www.scratchpaper.com/ here] and not the one from the NSIS page
* Not required unless you need to build an actual viewer installer for distribution, or change the NSIS installer package logic itself
<br>


==Test build of the Second Life Viewer==
When that completes, you can either build within Visual Studio or from the command line
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 from Mercurial
hg clone <s>https://bitbucket.org/lindenlab/viewer-release</s>
hg clone https://bitbucket.org/lindenlab/viewer64  <= until Alex Ivy gets promoted to viewer-release
 
Get viewer-build-variables; see [[Building the Viewer with Autobuild#Select Build Variables]].


Switch to the directory you just checked out and run Autobuild Configure
===Autobuild Options===
cd <s>viewer-release</s>
cd viewer64  <= with Alex Ivy
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.
For help on <code>configure</code> options, type:
 
When that completes, you can either build within Visual Studio or from the command line
===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), <b><tt>autobuild</tt></b> will invent a <code>BUILD_ID</code> for you.


For the Linden viewer build, this usage:
For the Linden viewer build, this usage:
  autobuild configure [autobuild options]... -- [other options]...
  autobuild configure [autobuild options]... -- [other options]...
passes [other options] to CMake. This can be used to override different CMake
passes <code>[other options]</code> to CMake. This can be used to override different CMake
variables, e.g.:
variables, e.g.:
  autobuild configure [autobuild options]... -- -DSOME_VARIABLE:BOOL=TRUE
  autobuild configure [autobuild options]... -- -DSOME_VARIABLE:BOOL=TRUE


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 134: Line 76:


Build by running:
Build by running:
  autobuild build --no-configure  -c ''configuration'' -A 64
  autobuild build --no-configure  -c <CONFIGURATION>
the resulting viewer executable will be at:
the resulting viewer executable will be at:
  build-vc120-64/newview/''configuration''/secondlife-bin.exe
  build-vcXXX-64/newview/<CONFIGURATION>/secondlife-bin.exe
(or of course build-vc120-32 if you choose to build a 32-bit viewer)
Where <code>XXX</code> is the value of the <code>AUTOBUILD_VSVER</code> environment variable. It defaults to <code>150</code> (e.g. Visual Studio 2017 = version 15.0) when the variable is not set since that has been the lowest supported version but should probably be updated to <code>175</code> when using Visual Studio 2022 (version 17.5).


===Building within Visual Studio===
===Building in Visual Studio===
Open the VS 2013 solution file
 
cygstart build-vc120-64/SecondLife.sln # or build-vc120-32 of course
Configure your build to run in attended mode:
* Select Release or RelWithDebInfo from the pulldown. (Debug is unmaintained. It would probably fail with perplexing errors.)
autobuild configure -c <CONFIGURATION> -- -DUNATTENDED:BOOL=FALSE
* Open the generated Visual Studio solution file <b><tt>build-vcXXX-64/SecondLife.sln</tt></b>
* Select <b>ReleaseOS</b> or <b>RelWithDebInfoOS</b> from the configuration dropdown. (<b>Debug</b> 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 <b>secondlife-bin</b> in the Solution Explorer and select <b>Build</b>
: ''wait...''
When the build completes (hopefully without errors) run it by pressing <b>Control-F5<b>
When the build completes (hopefully without errors) run it by pressing Control-F5
 
==Additional Tools==


==Additional Tools & Settings you might need==
* A Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2022] or [http://workspacewhiz.com/ Workspace Whiz]
*Tools
* A decent merge tool such as Araxis, Beyond Compare, VSCode
** Install and set up hg hooks using [https://wiki.secondlife.com/wiki/Mercurial_Tools instructions]
* [http://cygwin.com/install.html Cygwin] may be required for some tooling
**:''This arguably should be in the "minimum Requirements" section as it's way too easy to accidentally check in files with Windows line endings. Strongly suggest you install this.''
* [http://www.scratchpaper.com/ NSIS (Unicode version)] - (Optional) Required if creating a viewer installer for distribution
**Install a Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2013] or [http://workspacewhiz.com/ Workspace Whiz]
* [http://www.pyinstaller.org PyInstaller] is required to create local modifications of the Viewer Management Process startup shim
**:These extensions to Visual Studio add many great features. Pretty much essential for serious work.
**Install a decent merge tool like [http://www.araxis.com/merge/index.en Araxis Merge]  
**:Many free alternatives out there but Araxis is the best (and most expensive)


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

Latest revision as of 11:36, 6 April 2023

Step 1. Install Requirements

Required software:

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://github.com/secondlife/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

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>

the resulting viewer executable will be at:

build-vcXXX-64/newview/<CONFIGURATION>/secondlife-bin.exe

Where XXX is the value of the AUTOBUILD_VSVER environment variable. It defaults to 150 (e.g. Visual Studio 2017 = version 15.0) when the variable is not set since that has been the lowest supported version but should probably be updated to 175 when using Visual Studio 2022 (version 17.5).

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-vcXXX-64/SecondLife.sln
  • Select ReleaseOS or RelWithDebInfoOS 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