Request for Changes-59: Build support for msvc 2015 with OTB xdk

From OTBWiki
Revision as of 10:53, 15 September 2016 by Gpasero (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



This RFC add support for MSVC 2015 with shared library builds. For long time, shared build on otb is not possible due to ITK having no support for this type on windows msvc. It requires cmake version 3.3 or higher which comes with a feature to make shared library (dlls ) without having to add __declspec macro in every classes.


Initially for support for shared build with mingw, we were using ITK_ABI_EXPORT to export a classes and method when making dll. As a part of modularized build in OTB, cmake will generates <MODULE_NAME>Export.h file for every module which is explicitly marked ENABLE_SHARED. this export header defined <MODULE_NAME>_EXPORT macro that is set to __declspec(export) or __declspec(import) depending on if we are using the dll or creating dll. Refer to MSDN docs to __declspec and dllimport

Implementation details

Most of the fix for dll export macro which can be seen in the PR.

New OTB classes created must use <MODULE_NAME>_EXPORT macro and not use ITK_EXPORT or ITK_ABI_EXPORT

A new target called OTB_DEPENDS was added. This will build all otb dependencies based on cmake configuration.

Classes and files

SuperBuild has to be patched to add geos-3.5.0 (cmake build was not working on msvc), ossim build has been patched to work with msvc 2015 FindOpenCV.cmake was added to easily find opencv on windows and other platforms



It needs some fix for failing test on OTBWavelet module:

otbImageFileWriter for extracting bbox value was wrong. I had fixed this with lexical_cast wrapper from otbStringUtils:


Additional notes

OTB_USE_LIBKML is off due issues with shared build. (need to use a different upstream)