Integrate Your Own Code with OMPL's Build System

When developing your own code that relies on OMPL, you have several options:

  1. Install OMPL and use your own build system: First, if you are installing OMPL “by hand” (i.e., not through your package manager), run the following commands in your OMPL build directory:

    cmake -DCMAKE_INSTALL_PREFIX=/some/path
    make install
    

    See Build Options for details on how to enable/disable different OMPL-specific features. Below are the specifics for different build systems:

    • CMake: For ease of use with CMake, we have included a CMake module. This normally gets installed in the CMake module path, so if you use CMake in your own project, you can simply use this command in your CMakeLists.txt: find_package(ompl). This will define the following variables:
      • OMPL_FOUND - TRUE
      • OMPL_INCLUDE_DIRS - The OMPL include directory
      • OMPL_LIBRARIES - The OMPL library
      • OMPLAPP_LIBRARIES - The OMPL.app libraries (if installed)
      • OMPL_VERSION - The OMPL version in the form <major>.<minor>.<patchlevel>
      • OMPL_MAJOR_VERSION - Major version
      • OMPL_MINOR_VERSION - Minor version
      • OMPL_PATCH_VERSION - Patch version
    • Makefiles: If you use Makefiles, add “-I/usr/local/include” (or, e.g., “-I${HOME}/ompl/src”) to your compile flags, and “-L/usr/local/lib -lompl” (or, e.g., “-L${HOME}/ompl/build/Release/lib -lompl”) to your link flags. The compile and link flags can also be obtained using “pkg-config --cflags ompl” and “pkg-config --libs ompl”, respectively.
    • Autotools: Use the pkg-config autoconf macro PKG_CHECK_MODULES([OMPL],[ompl >= 0.10]). This is will define OMPL_LIBS and OMPL_CFLAGS if OMPL was found.
    • Eclipse CDT: Below is a brief set of instructions for getting OMPL to work with Eclipse CDT. These instructions have been verified to work with Eclipse Indigo with CDT.
      1. Click File -> New -> New Project.
      2. Choose C++ Project; click Next.
      3. Give your project a name; choose Executable -> Empty Project for type; click Next.
      4. Click Advanced Settings to open the Properties window for your project.
      5. Go to C/C++ Build -> Settings in the left pane.
      6. Under the Tool Settings tab, choose Cross G++ Compiler -> Includes. To the "Include paths" section, add the location of the OMPL source tree. For example, on a Linux system with default installation path, you should use "/usr/local/include". Click Apply.
      7. Again under the Tool Settings tab, choose Cross G++ Linker -> Libraries. To the "Libraries" section, add "ompl" (and, if needed, any Boost libraries, "ompl_app_base" and "ompl_app") . To the "Library search path" section, add the location of the OMPL library files. For example, on a Linux system with default installation path, you should use "/usr/local/lib". Click Apply.
      8. Click OK to leave the Properties window. Click Finish.
    • IDE's such as MS Visual Studio and Xcode: consult your IDE's manual.
  2. Add your own code in OMPL's directory structure: This option is recommend if you extend functionality of OMPL that you wish to contribute back to the OMPL project (see Third-Party Contributions for details). OMPL uses CMake for its build system. CMake can generate Makefiles and project files for many IDE's. If you create C++ code under ompl/src/ompl/[folder], you need to re-run CMake. CMake will detect your code if [folder] is one of the directories already included by OMPL. If you want your code to be in a different location, you should update ompl/src/ompl/CMakeLists.txt accordingly. See the Python documentation for specific instructions on how to create python bindings for your own code.