Difference between revisions of "Visual Studio Viewer Builds"

From Second Life Wiki
Jump to: navigation, search
(Remove DirectX installation requirement as it is not needed since viewer#master commit 6148a644)
(Visual Studio 2017 instructions)
 
Line 1: Line 1:
 
{{OSWikiContribBox}}
 
{{OSWikiContribBox}}
 
__NOTOC__
 
__NOTOC__
=Visual Studio 2013 - Second Life Developer set up=
 
 
This "Minimum Requirements recipe" listed below works for both local machines and VMs such as VMWare Fusion.
 
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.
+
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.
  
{{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].}}
 
  
{{KBwarning|
+
__TOC__
These instructions have been updated to build the 64bit builds now used for viewer-release; to build older versions (why would you?), use the '''history''' tab above to view the instructions from 15 Jun 2017.
+
  
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.
 
}}
 
  
 
{{KBcaution|custom=Some Gotchas before we start|
 
{{KBcaution|custom=Some Gotchas before we start|
Line 20: Line 15:
  
 
You will need at the very least, these items before you begin:
 
You will need at the very least, these items before you begin:
*An installer for Windows 10 Pro 64bit
+
* A licensed installation of Windows 10
*A valid Windows Product key
+
* Visual Studio 2017
*An installer for Visual Studio 2013
+
*A valid license for Visual Studio 2013
+
 
}}
 
}}
__TOC__
+
 
 
==Windows==
 
==Windows==
  
*Install Windows 10 Pro 64bit using your own product key
+
*Install 64-bit Windows 10 using your own product key
  
 
*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.
 
*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.
  
==Microsoft Visual Studio 2013 Pro==
+
==Microsoft Visual Studio 2017==
*Install VS 2013 Pro
+
* [https://visualstudio.microsoft.com/vs/older-downloads/ Install Visual Studio 2017]
* 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")
 
**Run the installer as Administrator (right click, "Run as administrator")
 
**Uncheck all the "Optional features to install:" - they are not required
 
**Uncheck all the "Optional features to install:" - they are not required
  
 
==CMake==
 
==CMake==
*Download and install at least [https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.msi CMake 3.8.0] (32bit is only option)
+
*Download and install at least [https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.msi CMake 3.8.0]
 
**Run the installer as Administrator (right click, "Run as administrator")
 
**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"
 
**At the "Install options" screen, select "Add CMake to the system PATH for all users"
Line 45: Line 37:
  
 
==Cygwin==
 
==Cygwin==
*Download and install [http://cygwin.com/install.html Cygwin 64] (64bit)
+
*Download and install [http://cygwin.com/install.html Cygwin 64]
 
**Run the installer as Administrator (right click, "Run as administrator")
 
**Run the installer as Administrator (right click, "Run as administrator")
 
**Use default options (path, components etc.) *until* you get to the "Select Packages" screen
 
**Use default options (path, components etc.) *until* you get to the "Select Packages" screen
Line 67: Line 59:
 
If they all report sensible values and not "Command not found" errors, then you are in good shape}}
 
If they all report sensible values and not "Command not found" errors, then you are in good shape}}
  
==Set up Autobuild and Python==
+
==Set up Autobuild==
 +
 
 
*Install Autobuild
 
*Install Autobuild
** Open a command prompt, either cygwin or Windows Command Prompt
+
** Open a Windows command prompt: cygwin, cmd or powershell
** Windows: <code>pip install hg+http://bitbucket.org/lindenlab/autobuild-1.1#egg=autobuild</code>
+
** <code>pip install "git+https://bitbucket.org/lindenlab/autobuild.git@v1.1.9""</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
 
*Check
 
** <code>autobuild --version</code>
 
** <code>autobuild --version</code>
** should report 1.1.5 or later
+
** should report version 1.1.9
  
 
==NSIS (Unicode)==
 
==NSIS (Unicode)==
Line 88: Line 78:
 
  mkdir work
 
  mkdir work
 
  cd work
 
  cd work
Check out the current viewer sources from Mercurial
+
Check out the current viewer sources
  hg clone https://bitbucket.org/lindenlab/viewer-release
+
  git clone https://bitbucket.org/lindenlab/viewer.git
  
 
Get viewer-build-variables; see [[Building the Viewer with Autobuild#Select Build Variables]].
 
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
 
Switch to the directory you just checked out and run Autobuild Configure
  cd viewer-release
+
  cd viewer
 
  autobuild configure -c ''configuration'' -A 64
 
  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.
 
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.
Line 129: Line 119:
 
  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-vc120-64/newview/''configuration''/secondlife-bin.exe
+
  build-vc150-64/newview/''configuration''/secondlife-bin.exe
(or of course build-vc120-32 if you choose to build a 32-bit viewer)
+
  
 
===Building within Visual Studio===
 
===Building within Visual Studio===
Open the VS 2013 solution file
+
Open the VS 2017 solution file
  cygstart build-vc120-64/SecondLife.sln # or build-vc120-32 of course
+
  cygstart 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 pulldown. (Debug is unmaintained. It would probably fail with perplexing errors.)
 
* Select your starting project, if desired
 
* Select your starting project, if desired
Line 145: Line 134:
  
 
==Additional Tools & Settings you might need==
 
==Additional Tools & Settings you might need==
{{KBcaution|
 
The combination of Cygwin and Tortoise Hg means it is not possible to check out or check into a repository that requires you to enter login credentials. Currently, to do this, you must switch to a Windows Command Prompt. ''Again, if you know how to fix this or have a suggestion for a better package to use, please let us know.''
 
}}
 
 
 
*Tools
 
*Tools
** Install and set up hg hooks using [https://wiki.secondlife.com/wiki/Mercurial_Tools instructions]
+
**Install a Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2017] or [http://workspacewhiz.com/ Workspace Whiz]
**:''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.''
+
**Install a decent merge tool such as Araxis, Beyond Compare, VSCode
**Install a Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2013] or [http://workspacewhiz.com/ Workspace Whiz]
+
**: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)
+
** Tortoise Hg
+
**:Download and install [http://tortoisehg.bitbucket.org/download/ TortoiseHg 3.2.3] (64bit)
+
**:Note: No option available to install as Administrator
+
**:Use default options (path, components etc.)
+
 
** Install [http://www.pyinstaller.org PyInstaller] developer version using pip.  
 
** Install [http://www.pyinstaller.org PyInstaller] developer version using pip.  
 
**:This is only required to create local Windows builds of modifications to 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
 
  pip install https://github.com/pyinstaller/pyinstaller/tarball/develop
 
  
 
[[Category:Open Source]]
 
[[Category:Open Source]]
 
[[Category:Compiling viewer]]
 
[[Category:Compiling viewer]]

Latest revision as of 08:46, 30 August 2020

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.

You will need at the very least, these items before you begin:

  • A licensed installation of Windows 10
  • Visual Studio 2017

Windows

  • Install 64-bit Windows 10 using your own product key
  • 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.

Microsoft Visual Studio 2017

  • Install Visual Studio 2017
    • Run the installer as Administrator (right click, "Run as administrator")
    • Uncheck all the "Optional features to install:" - they are not required

CMake

  • Download and install at least CMake 3.8.0
    • 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

  • Download and install Cygwin 64
    • 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

  • Download and install the most recent version of Python 2.7 (32bit)
    • It is important to use 32-bit Python. The VMP requires it.
    • 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

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

Set up Autobuild

NSIS (Unicode)

  • You must install the Unicode version 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


Test build of the Second Life Viewer

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

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

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.

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