Hello,
There are three ways to compile a remote module, if it follows the template (which is not the case here):
- Compile it inside an build tree : copy the remote module in otb sources in
otb/Module/Remote
and build OTB with the Cmake option ModuleMyRemoteModule=ON
and build otb.
- Compile it as an external module against an OTB build tree. Build OTB sources, and then build the remote module as a cmake project and give the path of the build tree with the
CMakePrefixPath
option.
- Build against an install tree (from example the binary packages), same as above, but you need to set the Cmake option
OTB_BUILD_MODULE_AS_STANDALONE
to ON.
In the last case, to build a remote module named MyRemoteModule
you would do :
#get the source
git clone MyRemoteModule.git
mkdir build && cd build
# Cmake configuration step
cmake ..\MyRemoteModule -DCMake_Build_Type="Release" -DCMake_Prefix_Path="Path\To\OTBBinaries" -DCMake_Install_Prefix="D:\OTB\install" -G"NMake Makefiles"
# Build and install steps
nmake install
TemporalGapFilling
is a remote module, but it is packaged with OTB binaries, this is why you can find it in the binaries.
otb-bv depends on TemporalGapFilling and Phenology. As I stated in my previous message, OTBPhenology cannot be built outside of a build tree (solution 1 above). You could try to modify CMake files to make it work. However I think the easiest way to compile otb-bv is to recompile otb. I just tried and managed to build it with MSVC 2019, with a few modifications to the sources (the module is not maintained anymore). Here are the steps I used (you need to have tools like git, Cmake, MSVC installed) :
# First step : go to a otb binary installation dir and uninstall otb. This will leave an xdk that you can use to compile otb. I think this is the easiest way to obtain all otb dependencies on Windows.
cd Path\To\OTBBinaryDIR
tools\uninstall_otb.bat
# Set %WORKING_DIR% where you want to download and build otb
cd %WORKING_DIR%
# Clone otb sources into %WORKING_DIR%\otb.
git clone https://gitlab.orfeo-toolbox.org/remote_modules/remote-module-template.git
mkdir build
mkdir install
cd build
# CMake command, here I used NMake, but you can use other build system. OTB is tested on WIndows with the Ninja build system.
# This will build the default module and TemporalGapFilling, Phenology and BioVars (otb-bv).
#If you want to build other module (other applications, or python wrapper, gui ...) you can use cmake gui to tune the configuration
cmake ../otb -G"NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%WORKING_DIR%\install -DCMAKE_PREFIX_PATH=Path\To\OTBBinaries -DCMAKE_CXX_FLAGS:STRING="/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc" -DModule_OTBTemporalGapFilling=ON -DModule_OTBPhenology=ON -DModule_OTBBioVars=ON -DOTB_USE_GSL=ON -DCMAKE_BUILD_TYPE=Release -DOTB_USE_OPENCV=ON
The CMake command will download the remote modules in otb\Modules\Remote.
Here i had to make a few patches to the sources :
- In Phenology sources, otb\Module\Remote\OTBPhenology\app\otbSigmoFitting.cxx : remove
SetDocName(...)
l53 http://tully.ups-tlse.fr/jordi/phenotb/blob/master/app/otbSigmoFitting.cxx#L53
This method has been removed in OTB 7.0.0
- In otb-bv sources, in otb\Module\Remote\OTBBioVars\include\otbMultiLinearRegressionModel.h l146, replace by :
TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType* quality = nullptr, ProbaSampleType* proba = nullptr) const override
The function signature has changed in the base class
http://tully.ups-tlse.fr/jordi/otb-bv/blob/master/include/otbMultiLinearRegressionModel.h#L146
I had to make two additionnal fixes, but you might not need them, depending on your configuration (MSVC version principally) :
- OTBTemporalGapFilling : the remote module could not find GSL libraries, adding OTBGSL to the module depency fixed it for me. In otb\Module\Remote\OTBTemporalGapFilling\otb-module.cmak you need to add OTBGSL to the dependencies, the file should be :
set(DOCUMENTATION "Time series gapfilling.")
# OTB_module() defines the module dependencies in GapFilling
# GapFilling depends on OTBCommon and OTBApplicationEngine
# The testing module in GapFilling depends on OTBTestKernel
# and OTBCommandLine
# define the dependencies of the include module and the tests
otb_module(OTBTemporalGapFilling
DEPENDS
OTBITK
OTBCommon
OTBApplicationEngine
OTBBoost
OTBGSL
TEST_DEPENDS
OTBTestKernel
OTBCommandLine
DESCRIPTION
"${DOCUMENTATION}"
)
- I think this will only happen if you use MSVC 2019, in otb\Modules\ThirdParty\OssimPlugins\src\ossim\AlosPalsar\AlosPlasarData.h line 30 you should add the include :
#include <iostream>
You might no need it depending on your configuration. This is a bug that will be fixed, it has been noticed on linux on recent compilers (gcc 10)
Once you patched the files you can run :
nmake install
And the module should compile (hopefully)
Cédric