wiki:VisualStudio

Using VisualStudio for AVANGO development

For general build and installation information see Installation.

Some random notes

  • scons -h lists all available options (e.g. setting the OpenSceneGraph path)

Building on Windows

  • install Python (tested with python versions <= 2.6)
  • install boost
  • install OpenSceneGraph
  • install scons
  • install Windows SDK
  • install Windows Visual 2008 Feature Pack (for C++ TR1 support)

Building with Visual Studio 2008 (VC9)

  • Since scons does not support vc9 at the moment you need to set up a small workaround:
    • add the path to your compiler and linker (usually resides within */VC/Bin) to your environment path
    • before an compile is issued be sure to invoke vcvars32.bat once on the command line
    • add into your localdefs.py in the top directory of your checkout:
  • BINARY_PATH = os.environ.get('PATH') (import python 'os' module!)
  • add path to your python interpreter too, if not already in system path
  • add to INCLUDE_PATH : (note that you separate paths by a ';' and double slash each sub directory (e.g.: VCincludefoo) )
    • boost include path
    • VC include path (usually */VC/include)
    • Platform SDK include
  • add to LIBRARY_PATH :
    • boost lib path
    • python lib path
    • VC lib
    • Windows SDK lib

Here is an example of a localdefs.py file for the compilation of AVANGO with MSVC 2008. You can simply cut&paste it and adjust the locations of your dependency libs:

import os
### CHANGE THIS ACCORDING TO YOUR INSTALLATION ###
#specify the locations of the dependencies
BOOST_DIR="C:\\apps\\boost_1_37_0_install"
BOOST_INCLUDE_DIR=BOOST_DIR+'\\include\\boost-1_37'
BOOST_LIB_DIR=BOOST_DIR+'\\lib'

PYTHON_DIR='C:\\Python25'
PYTHON_LIB_DIR=PYTHON_DIR +'\\libs'

OSG_DIR = 'C:\\apps\\openscenegraph\\OpenSceneGraph-2.8.2_install'
OSG_INCLUDE_DIR = OSG_DIR+'\\include'
OSG_LIB_DIR = OSG_DIR+'\\lib'
OSG_BIN_DIR = OSG_DIR+'\\bin'

MSVC_INCLUDE_DIR = 'C:\\Programme\\Microsoft Visual Studio 9.0\\VC\\include'
MSVC_LIB_DIR = 'C:\\Programme\\Microsoft Visual Studio 9.0\\VC\\lib'

WINDOWS_INCLUDE_DIR = 'C:\\Programme\\Microsoft SDKs\\Windows\\v7.0\\Include'
WINDOWS_LIB_DIR = 'C:\\Programme\\Microsoft SDKs\\Windows\\v7.0\\LIB'

#specify where avango should put the build files and where it should put the install files
BUILD = 'C:\\apps\\avango\\avango_trunk_build'
PREFIX = 'C:\\apps\\avango\\avango_trunk_install'
###################################################

#add the PATH environment variable so that it is known by avango.build (scons)
BINARY_PATH = os.environ.get('PATH')

#set the include and library path used for the compilation and linking
INCLUDE_PATH = OSG_INCLUDE_DIR + ';' + BOOST_INCLUDE_DIR + ';' + MSVC_INCLUDE_DIR + ';' + WINDOWS_INCLUDE_DIR
LIBRARY_PATH = OSG_BIN_DIR + ';' + OSG_LIB_DIR + ';' + BOOST_LIB_DIR + ';'+ PYTHON_LIB_DIR + ';' + MSVC_LIB_DIR + ';' + WINDOWS_LIB_DIR

#compile with OpenSceneGraph support
OPENSCENEGRAPH = True
OPENSCENEGRAPH_DEBUG = False
#compile with avango_connect support (this allows you to make distributed field connections of simples field types, like vectors or matrices)
CONNECT_SUPPORT = True
#compile in Debug mode
DEBUG = False

Building with Visual Studio 2005

  • You do not need to not have the hassle with scons not finding the MSVC 2005 compiler. However, you may run into problems, that the tr1 unordered_set header may not be found. If this is the case, you can use the tr1 functionality provided by the boost library. In this case, the header search path has to be setup properly. This  documentation gives more information. As a simple example, assume that Boost is installed under C:\apps\boost-1.36. The following line should then be appended to your localdefs.py:
    INCLUDE_PATH = 'C:\apps\boost-1.36\tr1\tr1'
    

Keep in mind that scons will take complete control over the compilation even with the generated project files. So do not make custom changes to the project files thus wasting time. On a fresh checkout there will be just an empty solution file. If you just want to generate the project files you can do this by invoking:

 scons vcprojects

Installing and running on Windows

In case you have all needed programs (like python, scons, the msvc compiler) in your global PATH environment variable, you can type

  scons install

on the windows command line to compile avango. In case you do not want to pollute your PATH variable, you can write a simple .bat script that adds the needed paths to the global PATH variable. E.g.:

::in case you are not using the MSVC cmd line, you can use the following command to setup the needed variables for the msvc compiler
::vcvars32.bat

::set the path to your python installation
SET PYTHON_DIR=C:\\Python25
SET PYTHON_SCRIPTS=%PYTHON_DIR%\\Scripts
::set the path to the msvc compiler (only needed when your are using Visual Studio 2008. Hey isn't scons nice ;-) )
SET MSVC_COMPILER_DIR=C:\\Programme\\Microsoft Visual Studio 9.0\\VC\\bin

::add the paths to your global PATH environment variable
SET PATH=%PATH%;%PYTHON_DIR%;%PYTHON_SCRIPTS%;%MSVC_COMPILER_DIR%

::compile avango
scons install

::keep the cmd open the check for potential problems or errors
pause

The following .bat file is an example how to setup a shell with a proper avango environment:

::::::::::::::::::::::::::::::::::::::::::::::
:: SET THESE VALUES ACCORDING TO YOUR SYSETM::
SET PYTHON_DIR=python2.5
SET RUNTIME_PYTHON_DIR=PYTHON25

SET AVANGO_DIR=C:\apps\avango\avango_trunk_install
SET AVANGO_LIB_DIR=%AVANGO_DIR%\lib
SET AVANGO_PYTHON_LIB_DIR=%AVANGO_LIB_DIR%\%PYTHON_DIR% 

SET BOOST_DIR=C:\apps\boost_1_37_0_install
SET BOOST_LIB_DIR=%BOOST_DIR%\lib

SET OSG_DIR=C:\apps\openscenegraph\OpenSceneGraph-2.8.2_install
SET OSG_LIB_DIR=%OSG_DIR%\bin
SET OSG_3PARTY_DIR=C:\apps\openscenegraph\3rdParty_Win32Binaries_vc90sp1\3rdParty\bin

SET PATH_UTILS=C:\%RUNTIME_PYTHON_DIR%\Scripts;C:\%RUNTIME_PYTHON_DIR%
SET SCONS_MSVC_PATHS=C:\apps\scripts
SET PYTHON_PATH_UTILS=C:\%RUNTIME_PYTHON_DIR%\Lib\site-packages
::::::::::::::::::::::::::::::::::::::::::::::

SET PATH=%PATH%;%PATH_UTILS%;%AVANGO_LIB_DIR%;%BOOST_LIB_DIR%;%OSG_LIB_DIR%;%OSG_3PARTY_DIR%
SET PYTHONPATH=%PYTHONPATH%;%PYTHON_PATH_UTILS%;%AVANGO_PYTHON_LIB_DIR%;%SCONS_MSVC_PATHS%

Again, adjust the paths to the dependency libs according to your system. After executing this .bat file, you can run the avango examples, or simple type python to get a python shell and start playing around with the avango.python binding. Note that not all examples will run under Windows, since the avango-daemon module is currently not Windows compatible, which is needed by some example scripts.