Table of Contents

TerraLib Developer's Guide - Build Instructions

Make sure you have all the third-party library dependencies listed in the section Dependencies before trying to build TerraLib/TerraView.

After cloning the TerraLib repository, choose the right branch or tag to work on.

The build/cmake folder (under the source tree) contains a CMake project for building TerraLib.

TerraLib 5.5 build has been tested on:

You should use at least CMake version 3.18.1 for building TerraLib. Older versions than this may not work properly.

Follow the build steps below according to your platform.

Building on Microsoft Windows with Microsoft Visual C++ 2017

1. Microsoft Visual Studio 2017 C++ users can download and unpack the suitable third-party libraries compiled for building 64-bit version of TerraLib with Qt5.12.3 support. Choose the right version specified by x.y.z at terralib-x.y.z-3rdparty-msvc-2017-win64:

Alternatively, download the most updated third-party library used by developers working at DEVELOP branch here.

To work in RELEASE-5.Y branches go to the 5.Y corresponding directory to access the right third party used.

2. Uncompress the third-party package into a folder:

c:\terralib5\3rdparty

3. We will assume that the codebase (all the source tree ) is located at:

c:\terralib5\codebase

4. Open the CMake GUI:

c:\terralib5\codebase\build\cmake
c:\terralib5\build
DependenciesPATH
third-party c:\terralib5\3rdparty
Qt c:\<Qt5 path>\lib\cmake (or something similar)2)
Terralib4 c:\terralib5\3rdparty\lib\cmake\terralib-4.2.2
swig c:\terralib5\3rdparty\swig
Python c:\Python366
EntryVariableValue
CPACK CPACK_BINARY_NSYS ON 3)
TERRALIB TERRALIB_BUILD_AS_BUNDLE ON
TERRALIB TERRALIB_BUILD_AS_DEV ON
TERRALIB TERRALIB_TRACK_3RDPARTY_DEPENDENCIES ON
TERRALIB TERRALIB_QHELP_ENABLED ON
TERRALIB TERRALIB_QTRANSLATION_ENABLED ON
TERRALIB TERRALIB_MOD_VM_ENABLED ON 4)
TERRALIB TERRALIB_DOXYGEN_ENABLED OFF5)
TERRALIB TERRALIB_BUILD_EXAMPLES_ENABLED OFF
TERRALIB TERRALIB_BUILD_UNITTEST_ENABLED OFF
Boost Boost_PYTHON_LIBRARY_RELEASE c:\terralib5\3rdparty\lib/boost_python3-mt.lib
Boost Boost_PYTHON_LIBRARY_DEBUG c:\terralib5\3rdparty\lib/boost_python3-mt-gd.lib
Qscintilla Qscintilla_LIBRARY_RELEASE c:\terralib5\3rdparty\lib/qscintilla2.lib

5. Inside Visual Studio choose “Release” as “Solution config” and select “x64” as platform. Right click over the project ALL_BUILD and build. Before running, set it as StartUp Project and set the local environment of terraview project 7).

6. If TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ ON or TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ ON: to run and debug one of the terralib_example_* or terralib_unitest_*, set it as StartUp Project and make sure the data ( data.zip) used by these examples/unittest are uncompressed at the default directory specified by TERRALIB_DATA_DIR :

 TERRALIB_DATA_DIR   C:\terralib\build-win64\data
 

Adding Plugin TerraPrint as part of TerraView/TerraLib

Building Plugin TerraPrint with Visual C++ 2017

TerraPrint is a plugin originally developed externally and its source code is maintained in a separated directory structure. As it depends on TerraLib, firstly it is necessary to built TerraPrint according with the instructions below:

$ mkdir C:/TPrint
$cd TPrint
$ GIT_SSL_NO_VERIFY=true git clone -b release-1.4 https://gitlab.dpi.inpe.br/terralib/terraprint.git .
$ git pull
   C:/TPrint/build/cmake
   C:/TPrint_build
DependenciesPATH
third-party c:\terralib5\3rdparty
Terralib4 c:\terralib5\3rdparty\lib\cmake\terralib-4.2.2
Qt C:\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5; (or something similar)9)
Qt C:\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5LinguistTools
EntryVariableValue
CPACK CPACK_BINARY_NSYS ON 10)
TERRALIB TERRALIB_BUILD_AS_BUNDLE OFF
TERRALIB TERRALIB_BUILD_EXAMPLES_ENABLED OFF
TERRALIB TERRALIB_BUILD_LAYOUT_TEST_ENABLED OFF
TERRALIB TERRALIB_MOD_LAYOUT_ENABLED ON
TERRALIB TERRALIB_MOD_QT_PLUGINS_ENABLED ON
TERRALIB TERRALIB_TRACK_3RDPARTY_DEPENDENCIES ON
TERRALIB_DIR_VAR_NAME<remove it because you will use your build version specified in terralib_DIR>

Check under Ungrouged Entries which terralib is set 11): and set the one you just built before:

terralib_DIRc:\terralib5\build building dir used by terralib/terraview
terralib_layout_DIR C:/TPrint_build informe where is Directory containing a CMake configuration file for TerraPrint

Building on Linux Ubuntu 18.04 with GNU G++

1. Open a Command Prompt (Shell).

2. We will assume that the codebase (all the source tree) is located at:

/home/user/mydevel/terralib/codebase

3. Create a folder out of the TerraLib source tree to generate the build system, for example:

$> cd /home/user/mydevel/terralib
$> mkdir build-release
$> cd build-release

Note: for the sake of simplicity create this directory in the same level as the source tree (as shown above).

4. For Linux systems you must choose the build configuration:

$> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="/home/user/myinstall/terralib" -DCMAKE_PREFIX_PATH:PATH="/home/user/mylibs" ../codebase/build/cmake
:: or inform some paths before as bellow:
$> QT5_BASE_DIR="/home/user/Qt/" PATH=/home/user/Qt/5.12.3/gcc_64/bin/:$PATH cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="/home/user/myinstall/terralib" -DCMAKE_PREFIX_PATH:PATH="/home/user/mylibs" ../codebase/build/cmake

5. Building (with 4 process in parallel):

$> make -j 4
:: or inform some paths before as bellow:
$> QT5_BASE_DIR="/home/user/Qt/" PATH=/home/user/Qt/5.12.3/gcc_64/bin/:$PATH make

6. Installing:

$> make install

7. Uninstalling:

$> make uninstall

Notes:

-DCMAKE_INCLUDE_PATH:PATH="/usr/local;/opt/include"
-DCMAKE_LIBRARY_PATH:PATH="/usr/local;/opt/lib"
-DCMAKE_PROGRAM_PATH:PATH="/usr/local/bin;/opt/bin"
-DBOOST_ROOT:PATH="/opt/boost"
  -DBOOST_INCLUDEDIR:PATH="/usr/local/include"

* The parameter -lpthread must be informed only if your Boost was not built as a shared library:

  -DCMAKE_CXX_FLAGS:STRING="-lpthread"
  -DQt5_DIR:PATH="/usr/local/lib/cmake/Qt5"
  -DCMAKE_BUILD_TYPE:STRING="Debug"
export QT_QPA_PLATFORMTHEME=""

Building on Mac OS X Sierra

1. Open a Command Prompt (Shell).

2. We will assume that the codebase (all the source tree) is located at:

/Users/user/mydevel/terralib/codebase

3. Create a folder out of the TerraLib source tree to generate the build system, for example:

$ cd /Users/user/mydevel/terralib
$ mkdir build-release
$ cd build-release

Note: for the sake of simplicity create this directory in the same level as the source tree (as showned above).

4. For Mac OS X systems you must choose the build configuration:

$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="/Users/user/myinstall/terralib" -DCMAKE_PREFIX_PATH:PATH="/Users/user/mylibs;/Users/user/mylibs/terralib5/lib/cmake;/Users/user/Qt5.12.3/lib/cmake" ../codebase/build/cmake

Note: Please, in the cmake call above, take special attention to the key *CMAKE_PREFIX_PATH* and Qt location.

5. Building (with 4 process in parallel):

$ make -j 4

6. Installing:

$ make install

7. Uninstalling:

$ make uninstall

Notes:

/Users/user/Qt5.12.3/lib/cmake
-G "Xcode"
DYLD_FALLBACK_LIBRARY_PATH
DYLD_FALLBACK_FRAMEWORK_PATH

Building on Microsoft Windows with Microsoft Visual C++ 2013 (not supported anymore)

1. Microsoft Visual Studio 2013 C++ users can download and unpack the suitable third-party libraries compiled for building 64-bit version of TerraLib with Qt5.12.3 support. Choose the right version specified by x.y.z at terralib-x.y.z-3rdparty-msvc-2013-win64:

Alternatively, download the most updated third-party library used by developers at binary package with all the dependencies

2. Uncompress the above package into a folder:

c:\terralib5\3rdparty

3. We will assume that the codebase (all the source tree ) is located at:

c:\terralib5\codebase

4. Open the CMake GUI:

c:\terralib5\codebase\build\cmake
c:\terralib5\build

5. Open the solution file located at:

c:\terralib5\build\terralib.sln or press ''Open Project''

6. Build ALL_BUILD 17), and before running, set it as StartUp Project and set the local environment of terraview project 18).

7. If TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ ON or TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ ON: to run and debug one of the terralib_example_* or terralib_unitest_*, set it as StartUp Project and make sure the data ( data.zip) used by these examples/unittest are uncompressed at the default directory specified by TERRALIB_DATA_DIR :

 TERRALIB_DATA_DIR   C:\terralib\build-win64\data
1) as a example c:\terralib5\3rdparty;c:\terralib5\3rdparty/lib/cmake/terralib-4.2.2;C:\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5;c:\terralib5\3rdparty\lib\cmake\wtss_cxx-0.4.0;c:\Python366
2) , 9) , 15) This is the folder where the dir Qt5 containing the Qt5Config.cmake file can be find
3) , 10) package generator (used in release)-disable the others
4) it enable TERRALIB_MOD_VM_PYTHON_ENABLED,TERRALIB_MOD_VM_LUA_ENABLED
5) if you want to distribute the API documentation this should be turn to on. But keep in mind that this option may take a considerable time, so you should do this only for final releases
6) , 12) , 16) The location set in “Where to build the binaries”
7) , 18) terraview→Properties→Configuration Properties→ Debugging, set the Environment entry as PATH=c:\terralib5\3rdparty\lib;c:\<Qt5 path>\bin
8) as a example c:\terralib5\3rdparty;c:\terralib5\3rdparty/lib/cmake/terralib-4.2.2;C:\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5;C:\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5LinguistTools
11) in my case an old one were set C:/Program Files/terralib5.2.2/lib/cmake/terralib-5.2.2
13) or Open the solution file located at C:/TPrint_build\terralib_layout.sln - TerraPrint is internally defined by terralib_layout_DIR
14) Plugins|Manage Plugins…|TerraPrint
17) Inside Visual Studio, right click over the project ALL_BUILD and build