Time for action—building with a UNIX makefile

With a desktop system like KDE and Gnome, a UNIX developer may execute the cmake-gui application and work the way described above. The only difference is that the generator should be set to Unix Makefiles, and a makefile hierarchy will be generated instead of Visual Studio solutions.

  1. After closing the CMake GUI, start a terminal (make sure you are logged in as root unless CMAKE_INSTALL_PREFIX has been set to a path in the user's home directory), and then type:
     # make
     # make install
    
  2. Built files will be exported to the specified place, usually /usr/local or the path defined by CMAKE_INSTALL_PREFIX.

What just happened?

You will find that cmake-gui is able to work on most windowing systems, if you have downloaded a ready-made binary package for your platform. Or you can use the curses-based ccmake. This is a text-mode GUI with the same interface as cmake-gui. You can set options with it visually, switch binary choices from TRUE to FALSE via the Enter key, and then when you are done, press c for configure and g for generate. However, on a console, the whole process should start from the cmake command-line. Take a Linux console—for example, assuming source in /home/OpenSceneGraph and the binary directory in /home/build_OpenSceneGraph, you may have to build OSG source code in the following way:

# cd /home/build_OpenSceneGraph
# cmake -DCMAKE_BUILD_TYPE=Release ,,/OpenSceneGraph
# make
# make install

More options could be added as command-line arguments here.

Have a go hero—checking mis-compiled parts

So far you have finished the compilation of OSG from the source code. Before starting to use this for future development, spend a little more time to compare the outcomes of using a quick installer and compiling from the source code. Look into the two installation directories and try to find if there is any difference among files and subfolders.

  • The bin subfolder contains all of the utilities and shared libraries of the core OSG, as well as an osgPlugins-x.x.x subdirectory made up of dozens of file I/O plugins. Here, x.x.x refers to the OSG distribution version. Note that, shared libraries and plugins will go into the lib subfolder on UNIX.
  • The include subfolder contains the C++ headers that declare the exported OSG classes, functions, and identifiers that are usable in user applications.
  • The lib subfolder contains all of the static-link libraries that will be used as dependencies in user applications, and import libraries when using DLLs on Windows.
  • The share subfolder contains an OpenSceneGraph/bin subdirectory full of example executables, all of which could be run to test various features.

Note that the osgPlugins-x.x.x subdirectory may be placed in the lib folder in UNIX systems.