Writing OTB modules with XDK with CMake

From OTBWiki
Jump to: navigation, search

Introduction

Steps listed below is based on some assumption on tools installed on your windows system

1. You have VS2015 installed in C:\Program Files .... (see below)

2. cmake.exe is in your system PATH

3. project sources are in cd c:\otb_projects\MyProject

4. OTB 6.0.0 xdk for windows 64 is extracted to C:\otbdevOTB-6.0.0-xdk-win64.

5. The above "OTB-6.0.0-xdk-win64" contains bin, lib, share directories

Steps

open cmd.exe

cd c:\otb_projects\MyProject

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %COMPILER_ARCH%

set CMAKE_PREFIX_PATH=C:\otbdev\OTB-6.0.0-xdk-win64

set PATH=%CMAKE_PREFIX_PATH%\bin

md build && cd build

cmake .. -G"Visual Studio 14 2015 Win64"

cmake --build . --config Release (must be Release. There is no Debug xdk available)

Results

.\Release\MyProject.exe

OTB Hello World !