Difference between revisions of "Build the Viewer on Windows"

From Second Life Wiki
Jump to navigation Jump to search
m (move some warnings closer to where they are relevant, add one about installing autobuild, minor formatting changes)
m (Remove autobuild section, as we can just link to the page)
(42 intermediate revisions by 7 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:
{{KBcaution|custom=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.
* [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.7+] - Be sure to "Add Python to PATH"
* [[Autobuild]]


You will need at the very least, these items before you begin:
===Intermediate Check===
*An installer for Windows 7 Pro 64bit
*A valid Windows Product key
*An installer for Visual Studio 2013
*A valid license for Visual Studio 2013
}}
__TOC__
==Windows==


*Install Windows 7 Pro 64bit using your own product key
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 <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.
 
==Step 2. Checkout Code==
 
===Viewer===
 
Open a terminal and checkout the viewer source code:
git clone https://bitbucket.org/lindenlab/viewer.git
 
===Build Variables===


*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.
See [[Building the Viewer with Autobuild#Select Build Variables]]


==Microsoft Visual Studio 2013 Pro==
==Step 3. Configure==
*Install VS 2013 Pro
* Note: If you don't own a copy of VS 2013 Pro, you might consider installing the the [http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx Community Version]
**Run the installer as Administrator (right click, "Run as administrator")
**Uncheck all the "Optional features to install:" - they are not required


*Download and install VS2013 Service Packs and updates
Switch to the viewer repository you just checked out and run <code>autobuild configure</code>:
**[http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_5 Update 4 ] is the most recent '''released''' version at time of writing (2015-01)
cd viewer
**Run the installer as Administrator (right click, "Run as administrator")
autobuild configure -c RelWithDebInfoOS -A 64


==DirectX SDK==
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.
*Download and install [http://www.microsoft.com/en-us/download/details.aspx?id=6812 DirectX SDK (June 2010)]
<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.
**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"


==Tortoise Hg==
Please be patient: the <code>autobuild configure</code> command silently fetches and installs required autobuild packages, and some of them are large.
{{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.''
}}


*Download and install [http://tortoisehg.bitbucket.org/download/ TortoiseHg 3.2.3] (64bit)
==Step 4. Build==
**Note: No option available to install as Administrator
**Use default options (path, components etc.)


==CMake==
When that completes, you can either build within Visual Studio or from the command line
*Download and install [http://www.cmake.org/download/ CMake 3.1.0] (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==
===Autobuild Options===
*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/bison
***Devel/flex
***Devel/patch
**Use default options for everything else


==Python==
For help on <code>configure</code> options, type:
*Download and install [https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi Python 2.7.<font color="red">8</font> (32bit)] (Do '''not''' install version 2.7.9 - it doesn't work for our setup currently])
autobuild configure --help
**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>BUILD_ID</code> is only important for a viewer you intend to distribute. For a
{{KBnote|custom=Confirm things are installed properly so far|
local test build, it doesn't matter: it only needs to be distinct. If you
Open a Cygwin terminal and type:
omit <code>--id</code> (as is typical), autobuild will invent a <code>BUILD_ID</code> for you.
  bison --version
 
  cmake --version
For the Linden viewer build, this usage:
  flex --version
  autobuild configure [autobuild options]... -- [other options]...
  hg --version
passes [other options] to CMake. This can be used to override different CMake
  python --version
variables, e.g.:
If they all report sensible values and not "Command not found" errors, then you are in good shape}}
  autobuild configure [autobuild options]... -- -DSOME_VARIABLE:BOOL=TRUE
 
The set of applicable CMake variables is still evolving. Please consult the
CMake source files in <code>indra/cmake</code>, as well as the
individual <code>CMakeLists.txt</code> files in the <code>indra</code> 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


==Set up Autobuild and Python==
===Building in Visual Studio===
{{KBcaution|This section '''only''' works inside the Windows Command Prompt. ''If you figure out a way to make this work with Cygwin, please let us know.''
}}
*Bootstrap pip
** Download (Save As) [https://bootstrap.pypa.io/get-pip.py get-pip.py] and copy to a temp folder
** Open <font color="#660000">Windows Command Prompt</font>
** Switch to that temp folder and execute it <code>python get-pip.py</code>
** Pip will be installed
*Bootstrap easy_install
** Download (Save As) [https://bootstrap.pypa.io/ez_setup.py ez_setup.py] and copy to a temp folder
** Remain in <font color="#660000">Windows Command Prompt</font>
** Switch to that temp folder and execute it <code>python ez_setup.py</code>
** easy_install will be installed
*Install Autobuild
** Remain in <font color="#660000">Windows Command Prompt</font>
** Change to the Python Scripts folder that was just created
** Typically <code>cd \Python27\Scripts</code>
** Run <code>pip install hg+http://bitbucket.org/lindenlab/autobuild-1.0#egg=autobuild</code>
** 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'''
*Update system PATH
**Add Python Scripts folder to PATH environment variable via the Control Panel
**Typically <code>C:\Python27\Scripts</code>


==NSIS (Unicode)==
Configure your build to run in attended mode:
* You must install the Unicode version [http://www.scratchpaper.com/ here] and not the one from the NSIS page
  autobuild configure -c <CONFIGURATION> -- -DUNATTENDED:BOOL=FALSE
* Not strictly required for developers (although it's useful)
* Open the generated Visual Studio solution file '''build-vc150-64/SecondLife.sln'''
<br>
* Select Release or RelWithDebInfo from the configuration dropdown. (Debug is unmaintained. It would probably fail with perplexing errors.)
==Test build of the Second Life Viewer==
* Select your starting project, if desired
Open a Cygwin shell and create a folder to hold your work
* Right-click on "secondlife-bin" in the Solution Explorer and select "Build"
  cd /cygdrive/c
mkdir work
cd work
Check out a branch from Mercurial
: Currently this has to be [https://bitbucket.org/lindenlab/viewer-tools-update Viewer Tools Update] but eventually will apply to Viewer Release too.
hg clone https://bitbucket.org/lindenlab/viewer-tools-update
Switch to the directory you just checked out and run Autobuild Configure
cd viewer-tools-update
autobuild configure -c ''RelWithDebInfoOS|ReleaseOS''
{{KBnote|custom=TBD|we need a description here or somewhere on optional configuration switches}}
When that completes, open the VS 2013 solution file that gets created
cygstart build-vc120/SecondLife.sln
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|At some point, this recipe will include steps that facilitate command line builds - for the moment, only option is to use the VS 2013 IDE}}


==Additional Tools & Settings you might need==
==Additional Tools==
*Tools
 
** Install and set up hg hooks using [https://wiki.secondlife.com/wiki/Mercurial_Tools instructions]
* 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 to easy to accidentally check in files with Windows line endings. Strongly suggested you install this.''
* 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]
* [http://cygwin.com/install.html Cygwin] may be required for some tooling
**:These extensions to Visual Studio add many great features. Pretty much essential for serious work.
* [http://www.scratchpaper.com/ NSIS (Unicode version)] - (Optional) Required if creating a viewer installer for distribution
**Install a decent merge tool like [http://www.araxis.com/merge/index.en Araxis Merge]  
* [http://www.pyinstaller.org PyInstaller] is required to create local modifications of the Viewer Management Process startup shim
**: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]]

Revision as of 21:47, 1 March 2022

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://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