TerraLib and TerraView Wiki Page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:terralib5_build [2013/12/20 11:18]
marisa [TerraLib 5.0.0-alpha - Build and Install]
wiki:terralib5_build [2014/09/25 16:41] (current)
marisa
Line 1: Line 1:
-====== TerraLib 5.0.0-alpha - Build and Install ======+====== TerraLib 5.0 - General guide for Building ​and Install ======
  
 Useful links: Useful links:
  
-  * [[wiki:​terralib5_build#​general_information| General Informationm]] +  * [[wiki:​terralib5_build#​CMake_Command_Line_Notes| Using Cmake Command line]] 
-  * [[wiki:​terralib5_build#​Cmake| Using the Cmake-GUI]] + 
-  * [[wiki:​terralib5_build#​Command_Line| Using Cmake Commans]] +
-  * [[wiki:​terralib5_build#​ccmake| Using Ccmake]] +
-  * [[wiki:​terralib5_build#​building_the_examples| Examples]]+
 ===== Building Terralib ===== ===== Building Terralib =====
  
-This section explains how to build the TerraLib from source in some platforms. ​ +This section explains how to build the TerraLib from source ​code in some platforms. ​The most updated instructions are in BUILD-INSTRUCTIONS file located at the root of the terralib codebase directory. Here are the general instructions and might not have all variables needed for a specific release.
-==== General Information====+
  
-We will refer to your TerraLib local working directory as <​terralib_root>​ and the building directory as <​building_dir>​+==== 1. Build instructions on Linux with g++ (GNU gcc) ==== 
 +-----------------------------------------------------------
  
-The local working directory is where the source code is located and the building directory is where CMake will create the build system for your chosen platform and compiler, and also where the libraries will be compiled.+1.1. Open a Command Prompt (Shell).
  
 +1.2. We will assume that the codebase (all the source tree) is located at:
 +/​home/​user/​terralib/​codebase
  
-Under //''<​terralib_root>/​build''//​ you will see CMake files and the following sub-folders:+1.3. Create a folder out of the terralib source tree, for example:
  
-^  Folder ​ ^  Content ​  ​+  ​$ cd /home/user/terralib 
-| examples| general CMakeLists.txt scripts for all examples and subfolders to each TerraLib example with a specific CMakeLists.txt script | +  $ mkdir build-linux 
-| modules| CMake utility files, such as finds and package generators | +  $ cd build-linux
-terralib| general .cmake script for all TerraLib and subfolders to each TerraLib module with a specific CMakeLists.txt script | +
-| terralib_qt_plugins| general .cmake script for all the qt plug-ins | +
-| terraview| Files used to configure TerraView | +
-| third-party | Files used to build third-party libraries | +
-| tools| general CMakeLists.txt script for all tools and subfolders to each TerraLib tool with a specific CMakeLists.txt script | +
-| unittest| general CMakeLists.txt script for all unittests and subfolders to each TerraLib unittest with a specific CMakeLists.txt script |+
  
-Pay attention to some variables used by CMake and explained below+1.4. For Linux systems you must choose the build configuration:
  
-^Variable^Comment^Value^ +  $ cmake -G "Unix Makefiles"​ -DCMAKE_BUILD_TYPE:STRING="​Release" ​-DCMAKE_INSTALL_PREFIX:​PATH="/usr/local/terralib" ​../codebase/build/cmake
-| TE_DEPENDENCIES_DIR ​ | path where the third party libraries are located ​ | it can be defined as an environmental variable otherwise define it at CMake interface using ''​Add Entry''​ button, type ''​PATH'',​ value ''//​C:\<unpack-dir>​\terralib_3rdparty_win32//''​| +
-| TE_BIN_DIR ​ | path where the executable will be generated | it is automatically set by CMake based on ''//<​building_dir>/​bin32//''​ | +
-| QT_QMAKE_EXECUTABLE ​ | path where Qt4 qmake.exe is located | . It is only necessary if CMake can not find Qt4. In this case, define it at CMake interface using ''​Add Entry''​ button, type ''​PATH''​ and a value such as  ''​//C:/Qt/4.8.5/​bin/​qmake.exe//''​| +
-| TE_HELP_DIR ​ | path where the TerraView HELP files are located | it can be defined as an environmental variable otherwise define it at CMake interface using ''​Add Entry''​ button, type ''​PATH'',​ value ''//​C:/<​cloned-dir>​/terraview_help//''​ |+
  
 +Notes:
  
 +  a) Some Linux flavours with different versions of GNU gcc and Boost will need more parameters such as:
 +  ​
 +          -DCMAKE_PREFIX_PATH:​PATH="/​usr/​local;/​opt/​include"​
 +          -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"​
  
 +  b) Boost can also be indicated by BOOST_INCLUDEDIR (note: without an '​_'​ separating INCLUDE and DIR):
 +          -DBOOST_INCLUDEDIR:​PATH="/​usr/​local/​include"​
  
 +  c) The parameter -lpthread must be informed only if your Boost was not built as a shared library:
 +          -DCMAKE_CXX_FLAGS:​STRING="​-lpthread"​
  
-==== Cmake ====+  d) For building with Qt5 you can provide the Qt5_DIR variable as: 
 +          -DQt5_DIR:​PATH="/​usr/​local/​lib/​cmake/​Qt5"​
  
-=== Using the CMake Graphic Interface (cmake-gui) to build the compilation projects ===+  e) For generating a debug version set CMAKE_BUILD_TYPE as: 
 +          ​-DCMAKE_BUILD_TYPE:​STRING="​Debug"​
  
-To run CMake from the cmake-gui, you will:+1.5 Building:
  
-  ​* Execute the cmake-gui system, found in the CMake binary folder.+  ​$ make -j 4
  
-  * In the "Where is the source code", put the path where is the CMakeLists main fileExample<​terralib_root>/​build ​+1.6 Installing:
  
-  ​* In the "Where to build the binaries",​ put the path where you want the CMake generate the files. It can be the same path where the source code is, however, try to avoid this.+  ​$ make install
  
-  * (Optional) Set up the TE_DEPENDENCIES_DIR. Press the Add Entry button and adjust the path to the dependencies directory, for example: 
  
-{{ :​wiki:​add-entry.png?400 |}}+==== 2Building with CMake GUI ==== 
 +--------------------------
  
-  *  Click "​Configure"​ and select the generator for the project.+2.1 On Windows:
  
-  * Review the "​BUILD"​ group and check which module you want to build. +aWe will assume ​that the TerraLib source tree (git clone) is located at: 
-   +   ​C:​\terralib\codebase
-  * Review the options related to third-party libraries (e.g. "​Boost"​ or "​Gdal"​and make sure that CMake found the needed library file(sand include directoriy. If any of the dependencies ​is not found you must manually enter the path to it. Just click on the line of the dependency and type the path.+
  
-  ​* Click "​Generate"​+b) We will assume that the third party libraries, obtained from 
 +   ​http://​www.dpi.inpe.br/​terralib5-devel/​terralib5-3rdparty-win32-Qt5.zip 
 +   or 
 +   ​http://​www.dpi.inpe.br/​terralib5-devel/​terralib5-3rdparty-win64-Qt5.zip 
 +   are located at: 
 +   ​C:​\terralib\3rdparty-win32-qt5 
 +   or 
 +   ​C:​\terralib\3rdparty-win64-qt5
  
-After these steps, ​the build files will have been generated and the cmake-gui will look like this:+c) Create a folder out of the TerraLib source tree to build the binaries, for example: 
 +   ​C:​\terralib\build-win32 
 +   or 
 +   C:\terralib\build-win64
  
-{{ :wiki:cmake-gui.png?1080 |}}+d) Open CMake-GUI in order to generate a build project for Microsoft Visual C++ 2010 (32-bit or 64-bit).
  
-Now all you need to do is go to the selected building directory and run the appropriate building tool according ​to the generator you selected. (e.g. for Unix Makefiles just run "​make"​).+f) Then assure that the following variables are set to the locations defined above: 
 +   ​Where ​is the source code    => C:​\terralib\codebase\build\cmake 
 +   ​Where ​to build the binaries => C:​\terralib\build-win32 
 +                                  or 
 +                                  C:​\terralib\build-win64
  
-=== Using the CMake command line to build the compilation projects ​===+g) Then add an entry called CMAKE_PREFIX_PATH with the libraries location (separated by semicolons):​ 
 +   ​Microsoft SDK  => C:/Program Files (x86)/​Microsoft SDKs/​Windows/​v7.0A 
 +   ​TerraLib 5 Third party => C:/​terralib/​3rdparty-win32-qt5 
 +   Qt CMake => C:/​Qt/​Qt5.3.0/​5.3/​msvc2010_opengl/​lib/​cmake/​Qt5 
 + 
 +   ​Example:​ Press AddEntry button and inform the name CMAKE_PREFIX_PATH,​ type PATH and set its value as: 
 +    
 +   ​CMAKE_PREFIX_PATH => C:/Program Files (x86)/​Microsoft SDKs/​Windows/​v7.0A;​C:/​terralib/​3rdparty-win32-qt5;​C:/​Qt/​Qt5.3.0/​5.3/​msvc2010_opengl/​lib/​cmake/​Qt5 
 + 
 +h) Then press "​Configure"​ and if no problem occurs press "​Generate"​. 
 +  
 +Note: Some projects may be disabled through the following variables:​ 
 +        TERRALIB_BUILD_EXAMPLES_ENABLED => OFF 
 +        TERRALIB_BUILD_UNITTEST_ENABLED => OFF 
 + 
 +i) Open the generated terralib.sln solution at the folder C:​\terralib\build-win32. 
 +   Then build the "​ALL_BUILD"​ project to build all terralib projects, including terraview application. 
 +    
 +j) To run and debug terraview application,​ set it as StartUp Project at Microsoft Visual C++ 2010. 
 + 
 +k) To run and debug examples and/or unittests make sure the data (http://​www.dpi.inpe.br/​terralib5-devel/​data.zip) used are located at the default directory:​ 
 +   ​TERRALIB_DATA_DIR ​  ​C:​\terralib\build-win32\data 
 +    
 +l) Make sure the default directory used to save the reports generated by the unittests exist, otherwise no report will be saved: 
 +   ​TERRALIB_REPORT_DIR ​  ​C:​\terralib\build-win32\report 
 +    
 +2.2 On MacOs and Linux: 
 + 
 +a) We will assume that the TerraLib source tree (git clone) is located at: 
 +   /​home/​user/​terralib5 
 + 
 +b) We wil assume that the build tree where will be generated the binaries is located at: 
 +   /​home/​user/​build_terralib5 
 + 
 +c) We will assume that all the third-party libraries that TerraLib needs to be compiled are installed in your system, and the Qt5 version is used. 
 + 
 +d) Open CMake-GUI in order to generate a build project for MacOS or Linux: 
 + 
 +e) Then assure that the following variables are set to the locations defined above: 
 +   Where is the source code => /​home/​user/​terralib5 
 +   Where to build the binaries => /​home/​user/​build_terralib5 
 + 
 +f) Then press the Add Entry button containing the following CMake variables:​ 
 +    
 +   Name: CMAKE_PREFIX_PATH 
 +   Type: PATH 
 +   ​Value:​ /​qt5_install_dir/​lib/​cmake/​Qt5 ​         and  
 +   Name: CMAKE_BUILD_TYPE 
 +   Type: String 
 +   ​Value:​ Release(or Debug) 
 +  
 +g) Then press "​Configure"​ button. If it is the first time that you press this button, select the Generator to be used (Makefile or a selected IDE like Eclipse for Linux, or XCode for MacOS) 
 +  
 +Note: Some projects may be disabled through the following variables:​ 
 +        TERRALIB_BUILD_EXAMPLES_ENABLED => OFF 
 +        TERRALIB_BUILD_UNITTEST_ENABLED => OFF 
 + 
 +h) According to the generator selected previously, in the build tree directory(/​home/​user/​build_terralib5) will be generated a Makefile or the file corresponding to the IDE selected. 
 + 
 +i) TerraLib/​TerraView can be compiled calling make for the Makefile Generator, Eclipse (for Linux) or XCode (for MacOS). 
 +    
 +j) To run and debug terralib_example_* and/or terralib_unittest_* make it the current project and make sure the data (http://​www.dpi.inpe.br/​terralib5-devel/​data.zip) used are located at the build directory:​ 
 +   ​TERRALIB_DATA_DIR ​  /​home/​user/​build_terralib5/​data 
 +    
 +k) Make sure the default directory used to save the reports generated by the terralib_unittest_* exists, otherwise no report will be saved: 
 +   ​TERRALIB_REPORT_DIR ​  /​home/​user/​build_terralib5/​report 
 + 
 +For more information on TerraLib, please, visit its main web page at: http://​www.terralib.org. 
 + 
 + 
 +==== CMake command line notes==== 
 + 
 +Using the CMake command line to build the compilation projects.
  
 If you do not have or do not wish to use the CMake-Gui, it is possible to run CMake via command line. Here is some information on how to do it: If you do not have or do not wish to use the CMake-Gui, it is possible to run CMake via command line. Here is some information on how to do it:
Line 82: Line 170:
 ^Variable^Effect^Example^ ^Variable^Effect^Example^
 | CMAKE_BUILD_TYPE | Sets the build type. Such as Debug or Release | -DCMAKE_BUILD_TYPE=Debug | | CMAKE_BUILD_TYPE | Sets the build type. Such as Debug or Release | -DCMAKE_BUILD_TYPE=Debug |
-| BUILD_TERRALIB4 | Enable/​disable [ON/OFF] the TerraLib4 module | -DBUILD_TERRALIB4=OFF | 
 | QWT_INCLUDE_DIR | Sets the include path of the QWT library | -DQWT_INCLUDE_DIR=<​DIRECTORY>​ | | QWT_INCLUDE_DIR | Sets the include path of the QWT library | -DQWT_INCLUDE_DIR=<​DIRECTORY>​ |
 | QWT_LIBRARY_DEBUG | Sets the path of the QWT library in Debug | -DQWT_LIBRARY_DEBUG=<​LIBRARY_FILE_PATH>​ | | QWT_LIBRARY_DEBUG | Sets the path of the QWT library in Debug | -DQWT_LIBRARY_DEBUG=<​LIBRARY_FILE_PATH>​ |
 | QWT_LIBRARY_RELEASE | Sets the path of the QWT library in Release | -DQWT_LIBRARY_RELEASE=<​LIBRARY_FILE_PATH>​ | | QWT_LIBRARY_RELEASE | Sets the path of the QWT library in Release | -DQWT_LIBRARY_RELEASE=<​LIBRARY_FILE_PATH>​ |
-| TE_DEPENDENCIES_DIR | Used as an easy and convenient way to locate terralib'​s dependencies | -DTE_DEPENDENCIES_DIR=<​unpack_dir>/​terralib_3rdparty_win32 | 
 | LOG4CXX_INCLUDE_DIR | Log4Cxx headers include path | -DLOG4CXX_INCLUDE_DIR=<​DIRECTORY>​ | | LOG4CXX_INCLUDE_DIR | Log4Cxx headers include path | -DLOG4CXX_INCLUDE_DIR=<​DIRECTORY>​ |
 | LOG4CXX_LIBRARY_DEBUG | Log4Cxx debug library file path | -DLOG4CXX_LIBRARY_DEBUG=<​LIBRARY_FILE_PATH>​ | | LOG4CXX_LIBRARY_DEBUG | Log4Cxx debug library file path | -DLOG4CXX_LIBRARY_DEBUG=<​LIBRARY_FILE_PATH>​ |
Line 113: Line 199:
  
 A few examples of how to call CMake to build terralib: A few examples of how to call CMake to build terralib:
 +
 +  * Calling from a building dir while pointing to the source (main CmakeLists location), specifying Unix Makefiles as a generator, compiling in Release
 +
 +  $ cmake -G "Unix Makefiles"​ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:​PATH="/​usr/​local/​terralib"​ ../​codebase/​build/​
  
   * Specifying Visual Studio 10 as the generator, using source code located at C:​\Dev\Terralib\build and setting the option to generate a NSIS installer as true:   * Specifying Visual Studio 10 as the generator, using source code located at C:​\Dev\Terralib\build and setting the option to generate a NSIS installer as true:
  
-cmake -G '​Visual Studio 10' C:​\Dev\Terralib\build -DTE_DEPENDENCIES_DIR=C:/​Libs/​terralib_3rdparty_win32 -DCPACK_BINARY_NSIS=True+  $ cmake -G '​Visual Studio 10' C:​\Dev\Terralib\build -DTE_DEPENDENCIES_DIR=C:/​Libs/​terralib_3rdparty_win32 -DCPACK_BINARY_NSIS=True
  
   * Calling from a building dir while pointing to the source (main CmakeLists location), specifying Unix Makefiles as a generator, compiling in Release and adjusting the QWT references to the path of a locally compiled version:   * Calling from a building dir while pointing to the source (main CmakeLists location), specifying Unix Makefiles as a generator, compiling in Release and adjusting the QWT references to the path of a locally compiled version:
  
-cmake -G 'Unix Makefiles'​ /​home/<​user>/​terralib5/​build -DCMAKE_BUILD_TYPE=Release -DQWT_INCLUDE_DIR=/​usr/​local/​qwt-6.1.0/​ include -DQWT_LIBRARY_RELEASE=/​usr/​local/​qwt-6.1.0/​lib/​libqwt.so.6.1.0+  $ cmake -G 'Unix Makefiles'​ /​home/<​user>/​terralib5/​build -DCMAKE_BUILD_TYPE=Release -DQWT_INCLUDE_DIR=/​usr/​local/​qwt-6.1.0/​include -DQWT_LIBRARY_RELEASE=/​usr/​local/​qwt-6.1.0/​lib/​libqwt.so.6.1.0
  
 == Notes for Linux build == == Notes for Linux build ==
Line 129: Line 219:
 | LD_LIBRARY_PATH | A colon-separated set of directories where third party libraries should be searched for first, before the standard set of directories | LD_LIBRARY_PATH=/​home/​user/​mylibraries | | LD_LIBRARY_PATH | A colon-separated set of directories where third party libraries should be searched for first, before the standard set of directories | LD_LIBRARY_PATH=/​home/​user/​mylibraries |
  
-=== Using the curses based Interface (ccmake) to build the compilation projects === 
- 
-On some Unix platforms, you can install a curses based cmake gui that is a terminal based text application and can be used as well. The commands are basically the same as before, but instead of using "​cmake"​ use "​ccmake"​ instead. 
- 
-Example: ccmake /​home/<​username>/​source/​terralib5/​build (Executed from the <​building_dir>​) 
- 
-{{ :​wiki:​ccmake.png?​1080 |}} 
- 
-Once executed, the user can manually adjust the variables and customize the compilation. Once the options have been adjusted type c to configure the project and then type g to generate the build files and exit ccmake. 
-===== Building the Examples ===== 
- 
-This section will detail the proccess of building the examples after building or installing Terralib. Some examples are listed here: 
- 
-^  Folder ​ ^  Content ​  ^ 
-| example_ado| It shows how to interact with Microsoft Access driver. | 
-| example_dataaccess| It shows how to interact with DataAccess Module and drivers PostGIS, ORG and GDAL| 
-| example_geometry| It shows how to create geometries and some Spatial Operators.| 
-| terralib_raster| It shows how to manipulate raster data.| 
-| example_rp| It show how use the raster processing module.| 
-| example_srs| It shows how to use the sapatial reference system manager. | 
-| example_st| It show how to use the Spatial Temporal Module.| 
-| example_vp| It shows how to use the Vector Processing Module.| 
- 
- 
-The proccess is similar to Terralib'​s proccess, steps such as using the cmake-gui or command line are similar, however, there a few differences worth mentioning. 
- 
-First, in order to build either the examples cmake must be told where is the CMakeLists main file which is <​terralib_root>/​build/​examples. ​ 
-Also, examples use a few variables that can edited, they are: 
- 
-^Variable^Comment^Value^ 
-|terralib_DIR | Where terralib has been built/​installed | it can either ​ be defined as an environmental variable or be defined at the CMake interface using the Add Entry button, type PATH, value <​building_dir>/​terralib | 
-| DATA_DIR ​ | where the data used by the examples will be downloaded and unpacked ​ | Inform the path where you downloaded the http://​www.dpi.inpe.br/​terralib5/​data.zip | 
- 
- 
-After pressing ''​Configure'',​ Review the "​EXAMPLE"​ group and check which example you want to build. Some are already checked and you can keep or change the examples that will be compiled, for example: 
- 
- 
-{{:​wiki:​examples-compilation.png|}} 
- 
-You can edit these variables in the same way used to configure terralib'​s variables. ​ 
- 
-Once you are done, just ''​Configure''​ and ''​Generate''​ the build files in the same way explained on the terralib section.