BuildWindowsCore

From Immersive Visualization Lab Wiki
Revision as of 13:12, 7 December 2014 by Jschulze (Talk | contribs)

Jump to: navigation, search

Contents

Building the CalVR-Core under Windows

The following third-party libraries are needed for the installation:

  • Cmake: versions 2.8.12.2 and 3.1.0-rc2 have been tested. Use the installer, no source build necessary.
  • OpenSceneGraph: versions 3.2.0 and 3.2.1 have been tested. For maximum flexibility OSG should be built from source, although binary distributions exist. For build instructions see below.
  • Visual Studio: version 12.0 (2013) has been tested

We recommend the following directory structure for the Windows install:

  • All CalVR files and third party libraries go into C:\local
  • Libraries go to C:\local\lib
  • Binaries go to C:\local\bin
  • Include files go to C:\local\include

A typical install tree will look like this:

C:\local\
         bin
         boost
         bullet
         calvr
         calvr_plugins
         GLUT
         include
         lib
         OpenSceneGraph
         openvrml

Building OpenSceneGraph

After downloading the OSG source code, extract the files in a folder under your main directory (normally your C:\ drive). Now run the Cmake GUI and enter the directories "Where is the source code" and "Where to build the binaries". Alternatively, you can drag-and-drop the Cmakelists.txt file from OSG's main directory onto the CMake window.

Then click the "Configure" button.

Specify the generator. We used "Visual Studio 12 2013 Win64" successfully, along with "Use default native compilers".

Now you can customize your build. Red lines indicate new variables that can be set or modified. Most of them are optional and some are already set.

Recommendations:

  • OpenVRML: need to build from source
    • Requires Boost: available as pre-compiled binary

After setting everything to your needs press 'c' for configure again and all red lines should disappear. In case there are still unknown variables, correct them or leave them as they are and press 'c' again.

Now you can generate the solution file by pressing 'g' for "generate". If that goes well, you should now see the OpenScenegraph.sln file in the OSG folder you entered in "Where to build binaries".

Double click OpenScenegraph.sln to open Visual Studio. Select your preferred build type - use Debug if you will be developing your own CalVR apps, otherwise Release. Click on Build -> Build Solution. This starts the build process, which can take up to an hour. If everything builds correctly, you are now able to right click on the "INSTALL" project and select "Build" to copy the files to their install location, as specified in the CMake file. After the build is finished you can check your installation by entering the following command in a command prompt:

osgversion

If building the "INSTALL" project throws an error, it could be that the compiler couldn't create a file under C:\Program files(x86)\... . This happens because you need to be an Administrator to create a file there. You can solve this problem by adding the directory manually.

Finally, to simplify future development, we recommend that you set the following environment variables to their respective directories:

- OSG_ROOT            C:\osg\OpenSceneGraph-3.2.0
- OSG_INCLUDE_PATH    C:\osg\OpenSceneGraph-3.2.0\include
- OSG_BIN_PATH        C:\osg\OpenSceneGraph-3.2.0\bin
- OSG_LIB_PATH        C:\osg\OpenSceneGraph-3.2.0\lib

Building CalVR's Core

To avoid errors while building CalVR add a new folder under the C:\ directory where you put the source code. Similar to the OSG build, open the Cmake GUI and drag and drop the Cmakelists-file on it to set the "Where to find source" and "Where to build the binaries" directories. Press 'c' and set the variables as needed. Press 'c' again to apply the changes and then press 'g'. Now open the generated solution file and build it. If the build is successful the "INSTALL" project can be build. After all is said and done there should be an executable called "CalVR.exe".

Before you run CalVR, make sure you set the following environment variables:

- CALVR_HOME           C:\CalVR
- CALVR_CONFIG_DIR     C:\CalVR\config
- CALVR_CONFIG_FILE    config.xml

Before starting CalVR, its XML configuration file must be edited. For more detailed information about the config file see: CalVR Config File

If you get an error about a header file that could not be found, go to Properties in the project menu. There go to "VC++ - Directories" and adjust the path for the Include directory.

errors that can occur

The most often errors that happen during build are linker errors where the compiler can't find the specified file. Most of them can be solved by adding the path where the missing file is stored, in the project properties. Another error stated that the Module machine type 'x64' conflicts with target machine type 'X86' or the other way around. If you get this error you should check the build configuration under build --> configuration.