This is an old revision of the document!
Warning: Declaration of syntax_plugin_iframe::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/html/terralib5/wiki/lib/plugins/iframe/syntax.php on line 18
Warning: Declaration of syntax_plugin_iframe::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/html/terralib5/wiki/lib/plugins/iframe/syntax.php on line 18
Warning: Declaration of syntax_plugin_externallink::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/html/terralib5/wiki/lib/plugins/externallink/syntax.php on line 107
Warning: Declaration of syntax_plugin_externallink::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/html/terralib5/wiki/lib/plugins/externallink/syntax.php on line 107
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.
Until now, TerraLib build has been tested on:
- Linux Ubuntu 14.04 and 16.04
- Mac OS X Yosemite, El Capitan and Sierra
- Microsoft Windows 7 and Windows 10
You should use at least CMake version 2.8.12 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++ 2013
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.4.1 support. Choose the right version specified by x.y.z
at terralib-x.y.z-3rdparty-msvc-2013-win64:
- Note that the same terralib5-3rdparty are used to build 5.2.2 and 5.2.3
- Note that the same terralib5-3rdparty are used to build more than one version 5.1.2,5.1.3,5.1.4 and 5.1.5
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:
- Set the “Where is the source code” edit text to:
c:\terralib5\codebase\build\cmake
- Set the “Where to build the binaries” edit text to:
c:\terralib5\build
- Mark the “Grouped” and “Advanced” check box.
- Click in “Add entry”:
- Add new variable named CMAKE_PREFIX_PATH, select type as PATH and fill value with the dependencies path:
c:\terralib5\3rdparty
.
- At the same CMAKE_PREFIX_PATH variable, add the following locations separeted by “;”:
- Qt5 path:
c:\<Qt5 path>\lib\cmake
(or something similar)1). - Terralib4 path:
c:\terralib5\3rdparty\lib\cmake\terralib-4.2.2
- Swig path:
c:\terralib5\3rdparty\swig
- Click in “Configure” button.
- Select option “Visual Studio 12 2013 Win64”
- If the output folder does not exist, CMake GUI will prompt you for creating it: just confirm the creation.
- if no problem occurs, set the following variables:
- CPACK ⇒ See the CPACK entries and keep ON just the NSIS package generator (used in release). All other kind of packages must be disabled.
- TERRALIB_BUILD_AS_BUNDLE ⇒ ON
- TERRALIB_BUILD_AS_DEV ⇒ ON
- TERRALIB_TRACK_3RDPARTY_DEPENDENCIES ⇒ ON
- TERRALIB_QHELP_ENABLED ⇒ ON
- Some projects may be disabled through the following variables:
- TERRALIB_DOXYGEN_ENABLED ⇒ OFF ⇒ 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 tests.
- TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ OFF
- TERRALIB_BUILD_EXAMPLES_ENABLED ⇒ OFF
- Press
Configure
andGenerate
again.
- Click in “Generate”: this will generate a solution file for Visual Studio 2013 under the folder
c:\terralib5\build
2).
5. Open the solution file located at:
c:\terralib5\build\terralib.sln
6. Build ALL_BUILD 3), and before running, set the local environment of terraview project 4).
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
Building on Linux Ubuntu 14.04 and 16.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 showned 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
5. Building (with 4 process in parallel):
$ make -j 4
6. Installing:
$ make install
7. Uninstalling:
$ make uninstall
Notes:
- Some Linux flavours with different versions of GNU gcc and Boost will need more parameters such as:
-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"
- Boost can also be indicated by
BOOST_INCLUDEDIR
(note: without an '_' separatingINCLUDE
andDIR
):
-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"
- For building with Qt5 you can provide the
Qt5_DIR
variable as:
-DQt5_DIR:PATH="/usr/local/lib/cmake/Qt5"
- For generating a debug version set
CMAKE_BUILD_TYPE
as:
-DCMAKE_BUILD_TYPE:STRING="Debug"
- If you are using default Ubuntu Desktop, you may have problems with menus. In this case, you may need to set the
QT_QPA_PLATFORMTHEME
environment variable before running Qt applications such as TerraView:
export QT_QPA_PLATFORMTHEME=""
Building on Mac OS X El Capitan and 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.4.1/5.4/clang_64/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:
- You have to specify valid paths for CMAKE_PREFIX_PATH. If you have a Qt version installed as a framework in your home directory, you have to tell CMake where to locate its CMake support. For instance, if you have Qt version 5.4.1 installed, you have to add to CMAKE_PREFIX_PATH the following directory:
/Users/user/Qt5.4.1/5.4/clang_64/lib/cmake
- You can also generate an Xcode project by using the “Xcode generator” option:
-G "Xcode"
- There are some useful variables that can be set inside Xcode in order to run an application. The following environment variable can be set:
DYLD_FALLBACK_LIBRARY_PATH DYLD_FALLBACK_FRAMEWORK_PATH
PATH=c:\terralib5\3rdparty\lib;c:\<Qt5 path>\bin