Difference between revisions of "Microsoft Windows Builds"
Jenn Linden (talk | contribs) |
|||
Line 5: | Line 5: | ||
{{KBnote|Following this recipe will probably take 6 to 12 hours of wall-clock time, and 2 to 6 hours of your time, if you're starting from a fresh Windows XP/Vista/7 system.}} | {{KBnote|Following this recipe will probably take 6 to 12 hours of wall-clock time, and 2 to 6 hours of your time, if you're starting from a fresh Windows XP/Vista/7 system.}} | ||
{{KBcaution|If you want alter the build instructions please try to have a discussion with at least one person on [irc://irc.freenode.net/opensl #opensl on Freenode]. There are language and stylistic conventions we try to follow and we want to make sure any change to these instructions is tested in a number of build environments before being published here.}} | |||
== Establish your programming environment == | == Establish your programming environment == | ||
Line 12: | Line 14: | ||
=== Install and update Visual Studio and SDKs === | === Install and update Visual Studio and SDKs === | ||
*Install [http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express Visual C++ 2010 Express] (Web install) or [http://go.microsoft.com/?linkid=9709969 Visual C++ 2010 Express] (ISO) | |||
*Install [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84&displaylang=en Microsoft Visual C++ 2010 Redistributable Package] | |||
*Install [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6B6C21D2-2006-4AFA-9702-529FA782D63B Windows SDK for Windows 7 and .NET Framework 4] (Web install) [Note: uncheck the Redistributable Package option to prevent installation failure] or [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35aeda01-421d-4ba5-b44b-543dc8c33a20 Windows SDK for Windows 7 and .NET Framework 4] (ISO) | |||
*Install [http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba DirectX SDK (June 2010)] | |||
*Run [http://www.update.microsoft.com/microsoftupdate/v6 Microsoft Update], and keep running it until no updates are needed. This may take 6~8 iterations on older versions of windows. | |||
** For Windows Vista and Windows 7, you need to select "Get updates from other Microsoft products" to get the updates for Visual Studio. | |||
** For Windows XP, use the provided link above. The Windows Update menu item on your computer is not the correct updater to use. | |||
** During the update cycles make sure you have picked up [http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5 Microsoft Visual Studio 2010 Service Pack 1] (Web install) or [http://go.microsoft.com/fwlink/?LinkId=210710 Microsoft Visual Studio 2010 Service Pack 1] (ISO) | |||
=== Install required development tools === | === Install required development tools === | ||
Line 26: | Line 28: | ||
{{KBnote|If the installer for a particular package does not update your PATH environment variable you will have to do this manually.}} | {{KBnote|If the installer for a particular package does not update your PATH environment variable you will have to do this manually.}} | ||
* '''CMake''' ([http://www.cmake.org/HTML/Download.html download CMake]) | |||
** This should be version 2.8.4 (or above in the 2.8.x series). | |||
**Add the <code>\bin</code> directory to your path. | |||
* '''Python''' (either [http://www.python.org/download/ Standard Python] or [http://www.activestate.com/activepython/downloads ActivePython]) | |||
** Version 2.7.1 works with the build scripts. | |||
* '''Mercurial''' (either [http://tortoisehg.bitbucket.org/ TortoiseHg] or [http://mercurial.selenic.com/ Mercurial Hg]) | |||
**Create a new file <code>%USERPROFILE%\Mercurial.ini</code> and in it put your Second Life name and optionally your email address: | |||
[ui] | |||
username = John Doe <john@example.com> | |||
* '''Cygwin''' ([http://www.cygwin.com/ download Cygwin]) | |||
** When you run the cygwin setup utility make sure you have selected to install '''unzip''' (under "Archives"), '''bison''', '''flex''', '''patchutils''' (all located under "devel"), and '''curl''' (under "Web"), which are not part of the default install. Do not install Cygwin Python or Mercurial. You won't need to use the Cygwin shell for anything. | |||
**Add the <code>cygwin\bin</code> directory to the '''very end''' of your path and make sure it stays that way. | |||
=== Install optional development tools === | === Install optional development tools === | ||
* [http://code.google.com/p/unsis/downloads/list Unicode NSIS (Nullsoft Scriptable Install System)] | |||
** This is the package installer used to build <code>Second_Life_<version-code>_LindenDeveloper_Setup.exe</code>. You only need this package if you are going to distribute the viewer you compile or if you want to install it locally. | |||
*: In the [[#Configuring_the_Viewer|Configure VS2010 step]] below you will need to add a line in the '''Executable Directories''' section: | |||
*:* 64 bit systems use <code>%ProgramFiles(x86)%\NSIS\Unicode</code> | |||
*:* 32 bit systems use <code>%ProgramFiles%\NSIS\Unicode</code> | |||
* [http://notepadplusplus.org/ Notepad++] | |||
** You need to use an editor that conforms to the [[Coding Standard]]. In particular, you must not check in files with DOS line endings except in very limited circumstances; see [[How to avoid DOS line endings in Windows tools]]. | |||
* [[Mercurial_Tools]] (strongly recommended) | |||
** When you are following these instructions you will be updating the <code>%USERPROFILE%\Mercurial.ini</code> file you created when you installed Mercurial. | |||
=== Install Autobuild === | === Install Autobuild === | ||
* Follow the directions at [[Autobuild#Getting_Autobuild|Getting Autobuild]] to install Autobuild | * Follow the directions at [[Autobuild#Getting_Autobuild|Getting Autobuild]] to install Autobuild. | ||
* Add an environment variable, so that autobuild doesn't default to using (or trying) older compiler versions: | * Add an environment variable, so that autobuild doesn't default to using (or trying) older compiler versions: | ||
** Right-click "My Computer" and select '''Properties'''. | ** Right-click "My Computer" and select '''Properties''' or press the windows logo key and the pause key at the same time. | ||
** | ** For XP, when the Properties dialog opens, click the '''Advanced''' tab followed by the '''Environmental Variables''' button. This will open a new window with a list of System and User variables. For Vista and later, when the System Properties window opens, click the '''Advanced system settings''' on the left column, then click '''Environment Variables...''' | ||
** In the User section, click '''New'''. Set '''Variable Name''' to AUTOBUILD_VSVER and set '''Variable Value''' to 100. | ** In the User section, click '''New'''. Set '''Variable Name''' to AUTOBUILD_VSVER and set '''Variable Value''' to 100. | ||
** Click the OK/Close buttons to close all the windows. | ** Click the OK/Close buttons to close all the windows. | ||
Line 57: | Line 65: | ||
While you may choose to use autobuild for all your compiling you still need to establish certain settings internal to VC2010. | While you may choose to use autobuild for all your compiling you still need to establish certain settings internal to VC2010. | ||
*Start the IDE | *Start the IDE. | ||
*Navigate to '''Tools''' > '''Options''' > '''Projects and Solutions''' > '''Build and Run''' and set '''maximum number of parallel projects builds''' to <code>1</code>. | *Navigate to '''Tools''' > '''Options''' > '''Projects and Solutions''' > '''Build and Run''' and set '''maximum number of parallel projects builds''' to <code>1</code>. | ||
*(VC Express only) Enable Tools > Settings > Expert Settings to get the Build (and other) menus. If you already have a '''Build''' menu you do not need to perform this step. | |||
* (VC Express only) Enable | |||
{{KBnote|The following steps require an open visual studio project. It does not matter which project you use, as you will only change some global settings used by all projects when they are opened. The open project itself won't be changed.}} | {{KBnote|The following steps require an open visual studio project. It does not matter which project you use, as you will only change some global settings used by all projects when they are opened. The open project itself won't be changed.}} | ||
You need to set a number of paths. | You will need to set a number of paths. | ||
* Open any existing project you may have or make a New Project. | * Open any existing project you may have or make a New Project. | ||
* Navigate to '''View''' ( > '''Other Windows''' ) > '''Property Manager'''. You will see Property Manager as a pane on the left side. | |||
At the bottom on the Solution Explorer you will see three tabs. | At the bottom on the Solution Explorer you will see three tabs. | ||
*Click the one on the right labeled '''Property Manager'''. (The name may be somewhat truncated.) | *Click the one on the right labeled '''Property Manager'''. (The name may be somewhat truncated.) | ||
Line 81: | Line 91: | ||
*Right click on '''Microsoft.Cpp.Win32.user'''. | *Right click on '''Microsoft.Cpp.Win32.user'''. | ||
*Pick ''' | *Pick '''General''' | ||
Set '''Enable Managed Incremental Build''' to <code>Yes</code>. | |||
*Pick '''VC++ Directories'''. | |||
This is where the build environment is pulled together into a functional VC2010 build system and also where much hand wringing, hair pulling, and fist pounding frustration takes place. | This is where the build environment is pulled together into a functional VC2010 build system and also where much hand wringing, hair pulling, and fist pounding frustration takes place. | ||
Line 119: | Line 132: | ||
To get a copy of the source code tree: | To get a copy of the source code tree: | ||
* Open up a DOS Command window | * Open up a DOS Command window | ||
* CD to where you want to install viewer- | * CD to where you want to install viewer-release. Do not have any spaces in this path. | ||
* Do: | * Do: | ||
hg clone <nowiki>http://hg.secondlife.com/viewer- | hg clone <nowiki>http://hg.secondlife.com/viewer-release</nowiki> | ||
Let's say some time has gone by since you have performed the previous steps and now you want to develop a change or work on a jira. You will update your clean local repository with all the changes committed to viewer- | Let's say some time has gone by since you have performed the previous steps and now you want to develop a change or work on a jira. You will update your clean local repository with all the changes committed to viewer-release since you last synchronized your files: | ||
* CD into <code>viewer- | * CD into <code>viewer-release</code> | ||
* Do: | * Do: | ||
hg pull -u | hg pull -u | ||
* Move up one level from <code>viewer- | * Move up one level from <code>viewer-release</code> | ||
* Do: | * Do: | ||
hg clone viewer- | hg clone viewer-release VWR-nnnnn | ||
Note: <code>nnnnn</code> is the jira number. You can also clone to a name of your choosing if you are making changes not associated with the LL jira system. | Note: <code>nnnnn</code> is the jira number. You can also clone to a name of your choosing if you are making changes not associated with the LL jira system. | ||
Line 136: | Line 149: | ||
Most third party libraries needed to build the viewer will be automatically downloaded for you and installed into the build directory within your source tree during the [[#Configuring_the_Viewer|configuration step]] below. Some few need to be manually set up, though, when using an open source developer configuration (<code>Release'''OS'''</code>, <code>RelWithDebInfo'''OS'''</code> or <code>Debug'''OS'''</code>) | Most third party libraries needed to build the viewer will be automatically downloaded for you and installed into the build directory within your source tree during the [[#Configuring_the_Viewer|configuration step]] below. Some few need to be manually set up, though, when using an open source developer configuration (<code>Release'''OS'''</code>, <code>RelWithDebInfo'''OS'''</code> or <code>Debug'''OS'''</code>) | ||
=== Fmod | === Fmod === | ||
{{KBcaution|If you are just starting out building the viewer or if you do not care for sound skip these FMOD steps. You will save some time and it is less confusing to make a non-FMOD build.}} | |||
CD to where you want to install the 3p-fmod repository and do: | CD to where you want to install the 3p-fmod repository and do: | ||
Line 147: | Line 162: | ||
autobuild package | autobuild package | ||
Update autobuild with the filename and hash just displayed. CD to the directory where you cloned viewer- | Update autobuild with the filename and hash just displayed. CD to the directory where you cloned viewer-release and do: | ||
copy autobuild.xml my_autobuild.xml | copy autobuild.xml my_autobuild.xml | ||
Line 160: | Line 175: | ||
{{KBnote|Having to copy <code>autobuild.xml</code> and modify the copy from within a cloned repository is a lot of work for every repository you make, but this is the only way to guarantee you pick up upstream changes to <code>autobuild.xml</code> and do not send up a modified <code>autobuild.xml</code> when you do an hg push.}} | {{KBnote|Having to copy <code>autobuild.xml</code> and modify the copy from within a cloned repository is a lot of work for every repository you make, but this is the only way to guarantee you pick up upstream changes to <code>autobuild.xml</code> and do not send up a modified <code>autobuild.xml</code> when you do an hg push.}} | ||
=== | == Configuring the Viewer Build == | ||
Fmod is the audio library the viewer uses. If you are compiling with Fmod you will need to do: | |||
set AUTOBUILD_CONFIG_FILE=my_autobuild.xml | set AUTOBUILD_CONFIG_FILE=my_autobuild.xml | ||
At the command line in the source tree's root directory | The environment variable <nowiki>AUTOBUILD_INSTALLABLE_CACHE</nowiki> controls the placement of library files downloaded as part of the configure process. If you do not want the library files downloaded as part of the configure process going into your Windows <nowiki>%TEMP%</nowiki> directory define the environment variable to point to some other location you have established: | ||
set AUTOBUILD_INSTALLABLE_CACHE=E:\SSfiles\Libraries | |||
At the command line in the source tree's root directory, presumably in your cloned repository (e.g. <nowiki>C:\linden\VWR-12345\</nowiki>) | |||
If you did not configure for FMOD: | |||
autobuild configure -c [CONFIGURATION] | autobuild configure -c [CONFIGURATION] | ||
If you did configure for FMOD: | |||
autobuild configure --config-file my_autobuild.xml -c [CONFIGURATION] -- -DFMOD:BOOL=TRUE | |||
where <code>[CONFIGURATION]</code> is one of those listed at [[Building the Viewer with Autobuild#Build a desired configuration]] (<code>ReleaseOS</code>, <code>RelWithDebInfoOS</code>, <code>DebugOS</code>) | where <code>[CONFIGURATION]</code> is one of those listed at [[Building the Viewer with Autobuild#Build a desired configuration]] (<code>ReleaseOS</code>, <code>RelWithDebInfoOS</code>, <code>DebugOS</code>) | ||
=== Configuration Switches === | === Configuration Switches === | ||
There are a number of switches you can use to modify the configuration process. The name of each switch is followed by its type and then by the value you want to set. | There are a number of switches you can use to modify the configuration process. The name of each switch is followed by its type and then by the value you want to set. | ||
* '''FMOD''' (bool) controls if the Fmod package is incorporated into the viewer. You must have performed the Fmod installation steps in [[Viewer_2_Microsoft_Windows_Builds# | * '''FMOD''' (bool) controls if the Fmod package is incorporated into the viewer. You must have performed the Fmod installation steps in [[Viewer_2_Microsoft_Windows_Builds#Fmod]] for this to work. | ||
* '''LL_TESTS''' (bool) controls if the tests are compiled and run. There are quite a lot of them so excluding them is recommended unless you have some reason to need one or more of them. | * '''LL_TESTS''' (bool) controls if the tests are compiled and run. There are quite a lot of them so excluding them is recommended unless you have some reason to need one or more of them. | ||
* '''PACKAGE''' (bool) controls if the package step is run. You must have installed NSIS described in [[Viewer_2_Microsoft_Windows_Builds#Install_optional_development_tools]] for this to work. | * '''PACKAGE''' (bool) controls if the package step is run. You must have installed NSIS described in [[Viewer_2_Microsoft_Windows_Builds#Install_optional_development_tools]] for this to work. | ||
Line 181: | Line 205: | ||
{{KBnote|'''OFF''' and '''NO''' are the same as '''FALSE'''; anything else is considered to be '''TRUE'''.}} | {{KBnote|'''OFF''' and '''NO''' are the same as '''FALSE'''; anything else is considered to be '''TRUE'''.}} | ||
Example: | Example without FMOD: | ||
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE | autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE | ||
Example with FMOD: | |||
autobuild configure --config-file my_autobuild.xml -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE | |||
== Compiling the Viewer == | == Compiling the Viewer == | ||
{{KBnote|Do not be alarmed if you see groups of messages with '''warning LNK4099: PDB''' in them.}} | |||
=== Compiling the viewer with autobuild === | === Compiling the viewer with autobuild === | ||
You can compile the viewer with either autobuild (the encouraged/supported method) or with the VS IDE. | You can compile the viewer with either autobuild (the encouraged/supported method) or with the VS IDE. | ||
Line 190: | Line 220: | ||
When compiling with autobuild you will have the best chance of success if you work from within a preconfigured Command Prompt window. Depending on how your computer has been set up there are two possible ways to open this window and you need to find which works in your particular case: | When compiling with autobuild you will have the best chance of success if you work from within a preconfigured Command Prompt window. Depending on how your computer has been set up there are two possible ways to open this window and you need to find which works in your particular case: | ||
*Method 1 | *Method 1 | ||
**From '''All Programs''' Navigate into the '''Microsoft Visual Studio 2010''' program menu | |||
**Click on '''Microsoft Visual Studio Command Prompt (2010)''' | |||
*Method 2 | |||
**From '''All Programs''' Navigate into the '''Microsoft Windows SDK V7.1''' program menu | **From '''All Programs''' Navigate into the '''Microsoft Windows SDK V7.1''' program menu | ||
**Click on '''Windows SDK 7.1 Command Prompt''' | **Click on '''Windows SDK 7.1 Command Prompt''' | ||
{{KBcaution|If you are building with Fmod and have followed the previous Fmod setup instructions AND you are now using a new command window you will need to redo the <code>set AUTOBUILD_CONFIG_FILE{{=}}my_autobuild.xml</code>.}} | {{KBcaution|If you are building with Fmod and have followed the previous Fmod setup instructions AND you are now using a new command window you will need to redo the <code>set AUTOBUILD_CONFIG_FILE{{=}}my_autobuild.xml</code>.}} | ||
*Run: | *Run: | ||
Without FMOD: | |||
autobuild build -c [CONFIGURATION] --no-configure | autobuild build -c [CONFIGURATION] --no-configure | ||
With FMOD: | |||
autobuild build --config-file my_autobuild.xml -c [CONFIGURATION] --no-configure | |||
There are some useful switches to know about, so your commands may look like this: | There are some useful switches to know about, so your commands may look like this: | ||
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE | |||
Example without FMOD: | |||
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE | |||
autobuild build -c ReleaseOS --no-configure | autobuild build -c ReleaseOS --no-configure | ||
Example with FMOD: | |||
autobuild configure --config-file my_autobuild.xml -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE | |||
autobuild build --config-file my_autobuild.xml -c ReleaseOS --no-configure | |||
{{KBnote|It is possible to use autobuild to do both the configure step (only needed once) and the build step with one command. I find it is clearer and saves a bit of time if these steps are done separately.}} | {{KBnote|It is possible to use autobuild to do both the configure step (only needed once) and the build step with one command. I find it is clearer and saves a bit of time if these steps are done separately.}} | ||
=== Compiling the viewer with the IDE === | === Compiling the viewer with the IDE === | ||
Line 241: | Line 281: | ||
** Click '''Set as StartUp Project''' | ** Click '''Set as StartUp Project''' | ||
** Pick '''Properties''' > '''Configuration Properties''' > '''Debugging''' | ** Pick '''Properties''' > '''Configuration Properties''' > '''Debugging''' | ||
*** Set '''Command''' to <code>Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe</code> | *** Set '''Command''' to <code>Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe</code> (adjust <code>Release</code> to the type of build you are doing, e.g. <code>RelWithDebInfo</code>) | ||
*** Set '''Working Directory''' to <code>..\..\indra\newview</code> | *** Set '''Working Directory''' to <code>..\..\indra\newview</code> | ||
Line 262: | Line 302: | ||
*: Can be solved by some small edits to header files to make sure the two don't bash on each other. | *: Can be solved by some small edits to header files to make sure the two don't bash on each other. | ||
==== Eliminate | ==== Eliminate deprecated switches, messages, and use memory more efficiently ==== | ||
The VS2010 compiler uses a lot of memory while compiling the viewer. If you run out of memory you will start to page heavily and your compile time will become much longer. The /Zm1000 switch affects compiler memory usage. | The VS2010 compiler uses a lot of memory while compiling the viewer. If you run out of memory you will start to page heavily and your compile time will become much longer. The /Zm1000 switch affects compiler memory usage. |
Revision as of 18:37, 30 June 2012
Philosophy: to keep it brief, this page should only include steps we KNOW ARE NEEDED, not random hints. Extra details or open issues can go on the talk page.
Note: Following this recipe will probably take 6 to 12 hours of wall-clock time, and 2 to 6 hours of your time, if you're starting from a fresh Windows XP/Vista/7 system. |
Important: If you want alter the build instructions please try to have a discussion with at least one person on #opensl on Freenode. There are language and stylistic conventions we try to follow and we want to make sure any change to these instructions is tested in a number of build environments before being published here. |
Establish your programming environment
This is needed for compiling any viewer based on the LL open source code and only needs to be done once.
Install and update Visual Studio and SDKs
- Install Visual C++ 2010 Express (Web install) or Visual C++ 2010 Express (ISO)
- Install Microsoft Visual C++ 2010 Redistributable Package
- Install Windows SDK for Windows 7 and .NET Framework 4 (Web install) [Note: uncheck the Redistributable Package option to prevent installation failure] or Windows SDK for Windows 7 and .NET Framework 4 (ISO)
- Install DirectX SDK (June 2010)
- Run Microsoft Update, and keep running it until no updates are needed. This may take 6~8 iterations on older versions of windows.
- For Windows Vista and Windows 7, you need to select "Get updates from other Microsoft products" to get the updates for Visual Studio.
- For Windows XP, use the provided link above. The Windows Update menu item on your computer is not the correct updater to use.
- During the update cycles make sure you have picked up Microsoft Visual Studio 2010 Service Pack 1 (Web install) or Microsoft Visual Studio 2010 Service Pack 1 (ISO)
Install required development tools
Note: The order of the following installations should not matter. |
Note: If the installer for a particular package does not update your PATH environment variable you will have to do this manually. |
- CMake (download CMake)
- This should be version 2.8.4 (or above in the 2.8.x series).
- Add the
\bin
directory to your path.
- Python (either Standard Python or ActivePython)
- Version 2.7.1 works with the build scripts.
- Mercurial (either TortoiseHg or Mercurial Hg)
- Create a new file
%USERPROFILE%\Mercurial.ini
and in it put your Second Life name and optionally your email address:
- Create a new file
[ui] username = John Doe <john@example.com>
- Cygwin (download Cygwin)
- When you run the cygwin setup utility make sure you have selected to install unzip (under "Archives"), bison, flex, patchutils (all located under "devel"), and curl (under "Web"), which are not part of the default install. Do not install Cygwin Python or Mercurial. You won't need to use the Cygwin shell for anything.
- Add the
cygwin\bin
directory to the very end of your path and make sure it stays that way.
Install optional development tools
- Unicode NSIS (Nullsoft Scriptable Install System)
- This is the package installer used to build
Second_Life_<version-code>_LindenDeveloper_Setup.exe
. You only need this package if you are going to distribute the viewer you compile or if you want to install it locally.
- In the Configure VS2010 step below you will need to add a line in the Executable Directories section:
- 64 bit systems use
%ProgramFiles(x86)%\NSIS\Unicode
- 32 bit systems use
%ProgramFiles%\NSIS\Unicode
- 64 bit systems use
- This is the package installer used to build
- Notepad++
- You need to use an editor that conforms to the Coding Standard. In particular, you must not check in files with DOS line endings except in very limited circumstances; see How to avoid DOS line endings in Windows tools.
- Mercurial_Tools (strongly recommended)
- When you are following these instructions you will be updating the
%USERPROFILE%\Mercurial.ini
file you created when you installed Mercurial.
- When you are following these instructions you will be updating the
Install Autobuild
- Follow the directions at Getting Autobuild to install Autobuild.
- Add an environment variable, so that autobuild doesn't default to using (or trying) older compiler versions:
- Right-click "My Computer" and select Properties or press the windows logo key and the pause key at the same time.
- For XP, when the Properties dialog opens, click the Advanced tab followed by the Environmental Variables button. This will open a new window with a list of System and User variables. For Vista and later, when the System Properties window opens, click the Advanced system settings on the left column, then click Environment Variables...
- In the User section, click New. Set Variable Name to AUTOBUILD_VSVER and set Variable Value to 100.
- Click the OK/Close buttons to close all the windows.
Configure VC2010
While you may choose to use autobuild for all your compiling you still need to establish certain settings internal to VC2010.
- Start the IDE.
- Navigate to Tools > Options > Projects and Solutions > Build and Run and set maximum number of parallel projects builds to
1
. - (VC Express only) Enable Tools > Settings > Expert Settings to get the Build (and other) menus. If you already have a Build menu you do not need to perform this step.
Note: The following steps require an open visual studio project. It does not matter which project you use, as you will only change some global settings used by all projects when they are opened. The open project itself won't be changed. |
You will need to set a number of paths.
- Open any existing project you may have or make a New Project.
- Navigate to View ( > Other Windows ) > Property Manager. You will see Property Manager as a pane on the left side.
At the bottom on the Solution Explorer you will see three tabs.
- Click the one on the right labeled Property Manager. (The name may be somewhat truncated.)
- On the left side click to expand any project and then click again to expand the Release folder.
- Right click on Microsoft.Cpp.Win32.user.
- Pick General
Set Enable Managed Incremental Build to Yes
.
- Pick VC++ Directories.
This is where the build environment is pulled together into a functional VC2010 build system and also where much hand wringing, hair pulling, and fist pounding frustration takes place.
- Set Executable Directories to:
$(ExecutablePath) $(DXSDK_DIR) $(WindowsSdkDir)\Bin C:\cygwin\bin $(SystemRoot)
32 bit Executable Directories example image
- Set Include Directories to:
$(WindowsSdkDir)\Include $(WindowsSdkDir)\Include\gl $(DXSDK_DIR)\Include
32 bit Include Directories example image
- Set Library Directories to:
$(WindowsSdkDir)\Lib $(DXSDK_DIR)
32 bit Library Directories example image
Set up your source code tree
Plan your directory structure ahead of time. If you are going to be producing changes or patches you will be cloning a copy of an unaltered source code tree for every change or patch you make, so you might want to have all this work stored in it's own directory.
To get a copy of the source code tree:
- Open up a DOS Command window
- CD to where you want to install viewer-release. Do not have any spaces in this path.
- Do:
hg clone http://hg.secondlife.com/viewer-release
Let's say some time has gone by since you have performed the previous steps and now you want to develop a change or work on a jira. You will update your clean local repository with all the changes committed to viewer-release since you last synchronized your files:
- CD into
viewer-release
- Do:
hg pull -u
- Move up one level from
viewer-release
- Do:
hg clone viewer-release VWR-nnnnn
Note: nnnnn
is the jira number. You can also clone to a name of your choosing if you are making changes not associated with the LL jira system.
Prepare third party libraries
Most third party libraries needed to build the viewer will be automatically downloaded for you and installed into the build directory within your source tree during the configuration step below. Some few need to be manually set up, though, when using an open source developer configuration (ReleaseOS
, RelWithDebInfoOS
or DebugOS
)
Fmod
Important: If you are just starting out building the viewer or if you do not care for sound skip these FMOD steps. You will save some time and it is less confusing to make a non-FMOD build. |
CD to where you want to install the 3p-fmod repository and do:
hg clone https://bitbucket.org/lindenlab/3p-fmod
CD into the 3p-fmod
directory you created and build it:
autobuild build --all
Package the results:
autobuild package
Update autobuild with the filename and hash just displayed. CD to the directory where you cloned viewer-release and do:
copy autobuild.xml my_autobuild.xml set AUTOBUILD_CONFIG_FILE=my_autobuild.xml autobuild installables edit fmod platform=windows hash=<hash> url=file:///<fmod-filespec>
Example:
copy autobuild.xml my_autobuild.xml autobuild installables edit fmod platform=windows hash=0f196f00e7dff49f22252efb68525658 url=file:///C:/3p-fmod/fmod-3.75-windows-20110531.tar.bz2
Note: Having to copy autobuild.xml and modify the copy from within a cloned repository is a lot of work for every repository you make, but this is the only way to guarantee you pick up upstream changes to autobuild.xml and do not send up a modified autobuild.xml when you do an hg push. |
Configuring the Viewer Build
Fmod is the audio library the viewer uses. If you are compiling with Fmod you will need to do:
set AUTOBUILD_CONFIG_FILE=my_autobuild.xml
The environment variable AUTOBUILD_INSTALLABLE_CACHE controls the placement of library files downloaded as part of the configure process. If you do not want the library files downloaded as part of the configure process going into your Windows %TEMP% directory define the environment variable to point to some other location you have established:
set AUTOBUILD_INSTALLABLE_CACHE=E:\SSfiles\Libraries
At the command line in the source tree's root directory, presumably in your cloned repository (e.g. C:\linden\VWR-12345\)
If you did not configure for FMOD:
autobuild configure -c [CONFIGURATION]
If you did configure for FMOD:
autobuild configure --config-file my_autobuild.xml -c [CONFIGURATION] -- -DFMOD:BOOL=TRUE
where [CONFIGURATION]
is one of those listed at Building the Viewer with Autobuild#Build a desired configuration (ReleaseOS
, RelWithDebInfoOS
, DebugOS
)
Configuration Switches
There are a number of switches you can use to modify the configuration process. The name of each switch is followed by its type and then by the value you want to set.
- FMOD (bool) controls if the Fmod package is incorporated into the viewer. You must have performed the Fmod installation steps in Viewer_2_Microsoft_Windows_Builds#Fmod for this to work.
- LL_TESTS (bool) controls if the tests are compiled and run. There are quite a lot of them so excluding them is recommended unless you have some reason to need one or more of them.
- PACKAGE (bool) controls if the package step is run. You must have installed NSIS described in Viewer_2_Microsoft_Windows_Builds#Install_optional_development_tools for this to work.
Note: OFF and NO are the same as FALSE; anything else is considered to be TRUE. |
Example without FMOD:
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE
Example with FMOD:
autobuild configure --config-file my_autobuild.xml -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE
Compiling the Viewer
Note: Do not be alarmed if you see groups of messages with warning LNK4099: PDB in them. |
Compiling the viewer with autobuild
You can compile the viewer with either autobuild (the encouraged/supported method) or with the VS IDE.
When compiling with autobuild you will have the best chance of success if you work from within a preconfigured Command Prompt window. Depending on how your computer has been set up there are two possible ways to open this window and you need to find which works in your particular case:
- Method 1
- From All Programs Navigate into the Microsoft Visual Studio 2010 program menu
- Click on Microsoft Visual Studio Command Prompt (2010)
- Method 2
- From All Programs Navigate into the Microsoft Windows SDK V7.1 program menu
- Click on Windows SDK 7.1 Command Prompt
Important: If you are building with Fmod and have followed the previous Fmod setup instructions AND you are now using a new command window you will need to redo the set AUTOBUILD_CONFIG_FILE=my_autobuild.xml . |
- Run:
Without FMOD:
autobuild build -c [CONFIGURATION] --no-configure
With FMOD:
autobuild build --config-file my_autobuild.xml -c [CONFIGURATION] --no-configure
There are some useful switches to know about, so your commands may look like this:
Example without FMOD:
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE autobuild build -c ReleaseOS --no-configure
Example with FMOD:
autobuild configure --config-file my_autobuild.xml -c ReleaseOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE autobuild build --config-file my_autobuild.xml -c ReleaseOS --no-configure
Note: It is possible to use autobuild to do both the configure step (only needed once) and the build step with one command. I find it is clearer and saves a bit of time if these steps are done separately. |
Compiling the viewer with the IDE
The autobuild configure step created the \build-vc100
directory at the root of the source tree. In here is the SecondLife.sln
solution file.
Start the IDE and open this solution.
You might want to change the build type in the drop-down located in the toolbar from Debug to Release or RelWithDebInfo.
Changing build type example image
You need to adjust the Platform Toolset setting.
- Select all the projects in the Solution Explorer list on the left of the screen.
- Click on the first project and scroll to the bottom of this list and Shift ⇧-click on the last project.
- Right click on the selected list
- Navigate to Properties > Configuration Properties > General > Platform Toolset
- Change this value to
Windows7.1SDK
- Push F7 to start the compiler.
Running your newly built viewer
Running from a desktop shortcut
- Make a desktop shortcut for
Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe
- Right-click the shortcut
- Select Properties
- Set Start in: to
Drive:\your-path\indra\newview
Running from within the IDE
- In the Solution Explorer pane right click on secondlife-bin
- Click Set as StartUp Project
- Pick Properties > Configuration Properties > Debugging
- Set Command to
Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe
(adjustRelease
to the type of build you are doing, e.g.RelWithDebInfo
) - Set Working Directory to
..\..\indra\newview
- Set Command to
Handling Problems
If you encounter errors or run into problems following the instructions above, please first check whether someone else already had the same issue. A solution might be known already. See the issue list below, check the talk page (and report useful experiences there) and search our issue tracker. Even when no description of your problem has been written down yet, someone might know about it, so get in touch with the community to get help.
Getting help
- Subscribe to OpenSource-Dev Mailing List (subscribe) and post your question there.
- For faster response, join the general open source viewer discussion and development IRC channel #opensl on freenode. Hopefully a helpful person is online when you ask your question.
Common Issues/Bugs/Glitches And Solutions
Not being able to find objidl.h in the Microsoft Windows SDK, when compiling llwindow
https://lists.secondlife.com/pipermail/opensource-dev/2011-April/006562.html
- Can be caused by path problems or some installation conflicts with the DirectX SDK.
stdint.h typedef conflicts between Quicktime and VS2010
https://lists.secondlife.com/pipermail/opensource-dev/2011-April/006565.html
- Can be solved by some small edits to header files to make sure the two don't bash on each other.
Eliminate deprecated switches, messages, and use memory more efficiently
The VS2010 compiler uses a lot of memory while compiling the viewer. If you run out of memory you will start to page heavily and your compile time will become much longer. The /Zm1000 switch affects compiler memory usage.
You may see this message while compiling:
use 'EHsc' instead of 'GX'
Here is how to free up some memory the compiler allocates and to eliminate these messages:
- Edit
\CMake 2.8\share\cmake-2.8\Modules\Platform\Windows-cl.cmake
- Replace line 156 with:
IF(MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR") ELSEIF(NOT MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") ENDIF(MSVC10)
- Replace line 172 with:
IF(MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR") ELSEIF(NOT MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") ENDIF(MSVC10)
- Replace line 184 with:
IF(MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR") ELSEIF(NOT MSVC10) SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") ENDIF(MSVC10)
References
Tip of the hat to Nicky_Perian for User:Nicky_Perian/Visual_Studio_10_Autobuild