Build Environment for Verdione and OpenFrameworks

We are happy to announce that the new CMake build framework for our version of the OpenFrameworks library and all the Verdione applications is available in the Verdione svn repository.

Please see http://cmake.org/ for CMake reference and documentation.

Basic structure

Every subdirectory contains a CMakeLists.txt file that directs the build. For Verdione the directory structure is as the following:

  • of-playground
    • build (compiled targets and temporary build files)
    • CMake.modules (modules and macros for Cmake)
    • contrib (third party libraries not available in ubuntu repositories)
    • libof (OpenFrameworks source)
    • of_addons
      • ... (addons for OpenFrameworks)
    • of_apps
      • addonsExamples (example program sources – for addons)
      • examples (example program sources – for OpenFrameworks)
    • verdione_apps (put your Verdione applications here)
      • interview (free-viewpoint video conferencing)
      • portal (free-viewpoint video installation)
      • ... (your applications)

How to build

Build is initialized by calling cmake with the top level directory as argument. This will start the processing of CMakeLists.txt in that directory, and cmake will live an appropriate makefile for make. CMake can produce output for other buildtools than make, but this is not tested. Always initialize build from the build directory to make an out-of-source build.

>> cd build/
>> cmake ..
>> make

All compiled targets will be located in its corresponding directory in the build/ directory tree.

The top level CMakeLists.txt

This file define global settings for the entire build, and recursively call CMakeLists.txt files in the subdirectories. The settings defined here may be overwritten in a subdirectory.

Currently included user settings are:
SET(BUILD_SHARED_LIBS ON) # Set to OFF for static library, ON for shared lib
SET(CMAKE_VERBOSE_MAKEFILE ON) # Make a verbose Makefile to see all commands
SET(CMAKE_SHARED_LINKER_FLAGS "" ) # Any additional Flags needed for the Linker

How to add your own Verdione application

  1. Add a subdirectory for your source code to the verdione_apps directory
  2. Add your subdirectory to the CMakeLists.txt in verdione_apps:

    add_subdirectory(<your_sub_dir>)

  3. Write your own CMakeLists.txt for you subdirectory. Your CMakeLists.txt must include at least four commands:

    include_directories( … ) #The (non system standard) directories containing includes you need for your project

    link_directories( … ) #The (non system standard) directories containing libraries you need for your project

    add_executable(<your_target_name> <source1> <source2> …) #Add all source file to build your executable

    target_link_libraries(<your_target_name> openFrameWorks <otherexternallibs> …) #All the libraries you need to link to

    If you use any addon, you have to declare a dependency to this addon either via
    REQUIRES(HAVE_OFX_<ADDON_NAME>)

    which defines a strong dependency (the application cannot be built if the addon or any dependency of that addon is unavailable) or
    USES(OFX_<ADDON_NAME>)

    which defines a weak dependency (the application is built, but you have to take care your code includes config.h and uses conditional compilation, i.e. #ifdef HAVE_OFX_<ADDON_NAME>).

    Variables for includes flags and directories in CMakeLists.txt are defined for the OpenFrameworks core library and all addons as:
    OF_CORE_INCLUDES
    OF_CORE_LDFLAGS
    OF_CORE_CFLAGS
    OF_CORE_LIBDIRS
    OFX_<ADDON_NAME>_INCLUDES
    OFX_<ADDON_NAME>_LDFLAGS
    OFX_<ADDON_NAME>_CFLAGS
    OFX_<ADDON_NAME>_LIBDIRS

    The target names defined by the CMake build may be used to link your application, ie "openFrameWorks" for the core frameworks libraries