This chapter is concerned with the creation of new modules. The following sections give precise instructions about :
There is a template of OTB remote module which help you start developing you’re remote module: External Module Template
Each module is made of different components, which are described in the following sections.
This file is mandatory. It follows the CMake syntax, and has two purposes:
These purposes are fulfilled by a single CMake Macro call:
Note: You can use the keyword TEST_DEPENDS to declare module dependencies that only applies to the tests.
The CMakeLists.txt file is mandatory. It contains only a few things. First, it declares a new CMake project with the name of the module.
Second, if the module contain a library (see src folder section below), it initializes the TheModuleName_LIBRARIES CMake variable (if your module only contains headers or template code, skip this line):
You can build your remote modules inside the OTB source tree by copying your source inside the directory Module/Remote or against an existing OTB build tree (note that it does not work with an install version of OTB).
The configuration below will handle both cases and take care of all the CMake plumbing of the module:
The overall file should look like this:
The include folder will contain all your headers (*.h files) and template method boy files (*.txx or *.hxx). It does not require any additional file (in particular, no CMakeLists.txt file is required).
The src folder contains the internal implementation of your module :
If your modules is made of template only code, you do not need a src folder at all.
If present, the src folder requires a CMakeLists.txt file.
The first part of the CMakeLists.txt file is classical, as it builds the library and links it:
Notes:
The last line of CMake code takes care of installation instructions:
The overall CMakeLists.txt file should look like:
The app folder contains the code of applications shipped with your module. If your module has no application, you do not need the app folder.
Notes: If your module contains application (and an app folder), do not forget to add the ApplicationEngine in the dependencies listed in the otb-module.cmake file.
In addition to the applications source code, the app folder should contain a CMakeLists.txt file as follows.
For each application, a single call otb_create_application is required:
This folder contains tests of the module. If your module has no test in it (which is not recommended, you do not need it).
The test folder should contain the source files of tests, as well as a CMakeLists.txt file. This file will contain the following.
First, indicate that this folder contains tests.
Then, build the test driver:
Finally, you can add your tests:
If your module contains one or more application in the app folder, you should also write tests for them, in the test folder. Running an application test is easily done with the helper macro otb_test_application:
ToDo: Add instructions for test naming and input/baseline data inclusion.
You overall CMakeLists.txt file should look like:
Your remote module can be build inside the OTB source tree or outside as a external CMake project with an existing build of OTB. Please note in that case that you’ll have to set OTB_DIR CMake option to the directory which contain existing OTB build (Note that this cannot be used for building against an OTB install tree).
Optionally, you can build your new remote module inside the OTB source tree by simply copy the folder containing the module component to Modules/Remote, then run CMake configuration. you should see a new CMake option named MODULE_TheModuleName. Simply turn this option to ON, and finish CMake configuration. Your module will be built with the rest of the OTB project.
To make your remote module available to others when building OTB, you should provide a CMake file named TheModuleName.remote.cmake file for inclusion in the Modules/Remote folder in OTB source tree.
This file should contain the following:
This file should be provided along with your remote module inclusion proposal email to the otb-developers list. Please refer to the contributors guidelines for more information (next section).