Iray Programmer's Manual

How to compile a program

This topic describes how to compile the example programs shipped with Iray. For a complete list of example programs see Example programs.

Overview

The neuray library release contains a set of example programs. It is recommended that you compile them and take them as a starting point for your own development.

The release contains a Makefile to build the examples on Linux and MacOS X platforms as well as solution files for Visual Studio 2012 to build the examples on a Microsoft Windows platform.

You can integrate the neuray library easily in other build environments. You can even compile the examples by hand following the steps below. Let the environment variable $NEURAY_ROOT refer to the installation root of the neuray library.

Procedure

To compile an example program:

  1. Copy the examples shipped with the release, make them writable, and switch to that directory:

     cp -r $NEURAY_ROOT/examples .
     chmod -R u+w examples
     cd examples
    
  2. Compile the program with the appropriate include path switch that points the compiler to the location of the neuray include files. A g++ compiler call could look like this:

     g++ -I$NEURAY_ROOT/include -c example_start_shutdown.cpp -o example_start_shutdown.o -pthread
    
  3. Link the program with the library that provides dlopen(). A g++ linker call could look like this:
     g++ -o example_start_shutdown example_start_shutdown.o -ldl -pthread
    
  4. Make the shared library, also known as a DLL, known to your runtime system so that it is found when starting the example program. You can do this by placing the shared library in an appropriate location, and/or setting environment variables such as PATH (on Windows), LD_LIBRARY_PATH (on Linux), or DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH (on MacOS X).

    Note: This step is platform and installation dependent.