Difference between revisions of "Viewer 2 Microsoft Windows Builds"

From Second Life Wiki
Jump to navigation Jump to search
(Configure & compile)
m (Redirected page to Visual Studio 2013 Viewer Builds)
 
(334 intermediate revisions by 18 users not shown)
Line 1: Line 1:
{{multi-lang}}
#REDIRECT [[Visual Studio 2013 Viewer Builds]]
{{CompileNav}}
 
{{KBwarning|custom=Work in progress|'''These instructions are not yet complete or  debugged''' as of March 22, 2011.}}
 
When finished, we hope this page will constitute a complete recipe for compiling viewer 2 from source on a Windows machine. 
 
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.
 
{{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.}}
 
== Establish your programming environment ==
This is needed for compiling any viewer based on the LL open source code, but only needs to be done once.
#Obtain Visual Studio 2010 (Express is OK)
#:[http://www.microsoft.com/express/download/ Click here to download Visual C++ Express - current version is VS2010]
#Install Microsoft Platform & DirectX SDKs
#:Download and install [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35aeda01-421d-4ba5-b44b-543dc8c33a20 Windows SDK for Windows 7 and .NET Framework 4 (ISO)] or [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)], and
#:[http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba Download and 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.
#Install other development tools
#*[http://code.google.com/p/unsis/downloads/list Unicode NSIS (Nullsoft Scriptable Install System)]
#*:This is the package installer used to build Setup.exe.
#*[http://www.cmake.org/files/v2.8/ CMake]
#*:This should be version 2.8.4 (or above in the 2.8.x series). Ensure that any older versions aren't in your PATH environment variables.
#*[http://www.cygwin.com/ Cygwin]
#*:When you run the cygwin setup utility make sure you have selected to install unzip (under "Archive"), patchutils, flex, bison (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; just have the binaries accessible to the regular command line via your PATH.
#*Python (either [http://www.python.org/download/ Python.org Standard Python] or [http://www.activestate.com/activepython/downloads ActivePython])
#*:Note: build scripts support Python 2.6, not 2.7 yet.
#*Mercurial (either [http://tortoisehg.bitbucket.org/ TortoiseHg] or [http://mercurial.selenic.com/release/windows/Mercurial-1.7.5.exe Mercurial Hg])
#*''(optional)'' [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]].
 
{{KBnote|If the installer for a particular package does not update your PATH environment setting you will have to do this manually.}}
 
{{KBcaution|The native Cygwin python and hg do not work very well and should be avoided.}}
If necessary, use the following shell scripts to update your Cygwin installation to use the Windows native versions of these apps:
*Override cygwin's python:
  if [ -f /usr/bin/python.exe ]; then
    mv /usr/bin/python.exe /usr/bin/cygwin-python.exe
  fi
  cp /cygdrive/c/Python26/python.exe /usr/bin/python.exe
*Override cygwin's mercurial:
  if [ -f /usr/bin/hg.exe ]; then
    mv /usr/bin/hg.exe /usr/bin/cygwin-hg.exe
  fi
  cp /cygdrive/c/Program\ Files/Mercurial/hg.exe /usr/bin/hg.exe
* Rename cygwin's link to allow VS2010 linker to run:
  if [ -f /usr/bin/link.exe ]; then
    mv /usr/bin/link.exe /usr/bin/cygwin-link.exe
  fi
* Needed modifications to CMake to correct improper flag usage (until this is corrected by the makers of CMake). These changes will also help keep CMake backwards compatible for those who are still working on older code base viewers (non-VS2010 build). (Added by [[User:WolfPup Lowenhar|WolfPup Lowenhar]] 17:56, 26 May 2011 (PDT))
  Edit Windows-cl.cmake and change the following:
  (this is file is located in 32-bit > C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\Platform
                              64bit> C:\Program Files(x86)\CMake 2.8\share\cmake-2.8\Modules\Platform )
  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 /GX /GR")
  ELSEIF(NOT MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
  ENDIF(MSVC10)
 
  replce line 184 with :
 
  IF(MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /GX /GR")
  ELSEIF(NOT MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
  ENDIF(MSVC10)
 
== 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
* Make a directory to contain it (it is strongly suggested to name it <code>viewer-development</code>)
* Go into that directory
* Do <code>hg init</code>
* Do <code>hg pull <nowiki>http://hg.secondlife.com/viewer-development</nowiki></code>
 
* Example:  ((specific snapshot example TBD))
 
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
* Go into <code>viewer-development</code> (or whatever you named the master source tree copy)
* Do <code>hg pull</code>
* Do <code>hg update</code>
* Move up one level from <code>viewer-development</code>
* Do <code>hg clone viewer-development VWR-nnnnn</code> (where <code>nnnnn</code> is the jira number, or clone to a name of your choosing if there is not jira number)
 
== Set up Autobuild ==
You have two choices to set up your autobuild environment
* Modify your path statement to include the autobuild bin directory
 
* Install [[Autobuild]] into Python, by running '''one''' of the following at the command line:
** <code>[http://pypi.python.org/pypi/setuptools easy_install] autobuild</code> (note the underscore)
** <code>[http://pypi.python.org/pypi/pip pip] install autobuild</code>
 
===Instructions for setting up Fmod needed here===
 
===  Configuring and compiling the viewer ===
At the command line in the source tree's root directory (e.g. <code>C:\linden\viewer-development\</code>), run:
autobuild configure -c [CONFIGURATION]
...where <code>[CONFIGURATION]</code> is one of those listed at [[Building the Viewer with Autobuild#Build a desired configuration]] (<code>DebugOS</code>, <code>RelWithDebInfoOS</code>, <code>ReleaseOS</code>, etc.)
 
autobuild build -c [CONFIGURATION] --no-configure
 
There are some useful switches to know about, so your commands may look like this
<code>
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=OFF -DPACKAGE:BOOL=OFF
autobuild build -c ReleaseOS --no-configure
<code>
 
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.
 
=== Alternative way to compile using the IDE ===
The autobuild configure step will create the ''build-vc100'' directory at the root of the source tree which contains the ''SecondLife.sln'' solution file.  The solution is fully configured and ready to be built inside the IDE.  Open it and compile.
 
== Iteratively fix things until the compile succeeds ==
If you encounter errors during building or configuration, check [[{{TALKPAGENAME}}|the talk page]] and report useful experiences there.
 
== Common Issues/Bugs/Glitches And Solutions ==
 
*Getting help:
** Subscribe to [[OpenSource-Dev|OpenSource-Dev Mailing List]] ([https://lists.secondlife.com/cgi-bin/mailman/listinfo/opensource-dev subscribe]) and post your question there.
** For faster response, find a free IRC client program and join [irc://irc.freenode.org/opensl #opensl on freenode], the general open source viewer discussion and development channel.  Hopefully a helpful person is online when you ask your question.
 
*Eliminate annoying popup:
**If you are compiling with the IDE and keep getting a popup along the lines of "click here to improve your experience" follow the registry edit instructions just before "Was this information helpful?" at this link http://support.microsoft.com/kb/981741
 
== References ==
 
* Tip of the hat to Nicky_Perian for [[User:Nicky_Perian/Visual_Studio_10_Autobuild]]
 
[[Category:Compiling viewer]]

Latest revision as of 11:26, 23 April 2015