Difference between revisions of "Build the Viewer on Windows"
Coyot Linden (talk | contribs) |
|||
(20 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Multi-lang}} | ||
{{CompileNav}} | |||
{{TOC}} | |||
==Step 1. Install Requirements== | |||
Required software: | |||
* [https://cmake.org/download/ CMake] | |||
* [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]] | |||
===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 <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://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 <code>autobuild configure</code>: | |||
cd viewer | |||
autobuild configure -c RelWithDebInfoOS | |||
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. | |||
<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. | |||
Please be patient: the <code>autobuild configure</code> 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 <code>configure</code> options, type: | |||
For help on < | |||
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 < | 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 < | CMake source files in <code>indra/cmake</code>, as well as the | ||
individual < | 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 | autobuild build --no-configure -c <CONFIGURATION> | ||
the resulting viewer executable will be at: | the resulting viewer executable will be at: | ||
build- | build-vcXXX-64/newview/<CONFIGURATION>/secondlife-bin.exe | ||
( | 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 in Visual Studio=== | |||
= | Configure your build to run in attended mode: | ||
Open the | autobuild configure -c <CONFIGURATION> -- -DUNATTENDED:BOOL=FALSE | ||
* Open the generated Visual Studio solution file <b><tt>build-vcXXX-64/SecondLife.sln</tt></b> | |||
* Select | * 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 | * Right-click on <b>secondlife-bin</b> in the Solution Explorer and select <b>Build</b> | ||
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== | ||
* | * A Visual Studio helper like [http://www.wholetomato.com/ WholeTomato Visual Assist for VS2022] or [http://workspacewhiz.com/ Workspace Whiz] | ||
* A decent merge tool such as Araxis, Beyond Compare, VSCode | |||
* [http://cygwin.com/install.html Cygwin] may be required for some tooling | |||
* [http://www.scratchpaper.com/ NSIS (Unicode version)] - (Optional) Required if creating a viewer installer for distribution | |||
* | * [http://www.pyinstaller.org PyInstaller] is required to create local modifications of the Viewer Management Process startup shim | ||
* | |||
* | |||
[[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:
- CMake
- Git
- Visual Studio 2022 - Select "Desktop development with C++" workload
- Python 3.7+ - Be sure to "Add Python to PATH"
- Autobuild
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
- A Visual Studio helper like WholeTomato Visual Assist for VS2022 or Workspace Whiz
- A decent merge tool such as Araxis, Beyond Compare, VSCode
- Cygwin may be required for some tooling
- NSIS (Unicode version) - (Optional) Required if creating a viewer installer for distribution
- PyInstaller is required to create local modifications of the Viewer Management Process startup shim