Skip to content

Building and Configuring

Rodrigo Avancini edited this page May 3, 2016 · 51 revisions

How to build TerraME

This small tutorial is a guide that describes the steps to build and configure TerraME from its source code. In all the platforms, TerraME depends on the external packages and libraries listed bellow, that should be installed separately:

Mandatory

Optional


## Mac OSX environment (ref. OS X El Capitan)

CMake 3.X (ref. 3.5.1)

Download CMake and put cmake command in the PATH environment variable:

export PATH=$PATH:/path/to/cmake/bin  

TerraME 2.X

Clone TerraME from git:

https://github.com/TerraME/terrame.git

Recomendated to create a structure of directories like:

-- someplace
      |
       -- terrame
            |
             -- depends
             -- build-cmake
             -- git
                 |
                  -- terrame (clone here)

TerraLib 5.X (ref. release-5.1)

Clone TerraLib from git. If you are using Sourcetree, go to Sourcetree, Preferences, Git, and then check Disable SSL certificate validation (note: potentially insecure) to allow downloading TerraLib.

Clone TerraLib from the following Git repository:

https://tester:terralibdpi@git.dpi.inpe.br/terralib5

Recomendated to create a structure of directories like:

-- someplace
      |
       -- terralib
            |
             -- 3rdparty
             -- build-cmake
             -- git
                 |
                  -- terralib (clone here)

To build TerraLib dependencies in Mac OSX environment you must install Xcode (found in AppStore) and the Xcode command-line tools (https://developer.apple.com/downloads/index.action?=command%20line%20tools).

Compile the libraries dependencies of the TerraLib folowing the instructions on Mac OS X foud here.

Recomendated to use the structure of directories created:

-- someplace
      |
       -- terralib
            |
             -- 3rdparty
                 |
                  -- terralib-3rdparty-macosx-el-capitan.tar.gz (put here)
                  -- install-3rdparty-macosx-el-capitan.sh (put here)
                  -- libs (here is TERRALIB_DEPENDENCIES_DIR)
             -- build-cmake
             -- git 

If to need credentials to download the TerraLib dependencies, put this:

user = terralib5 
password = newterralib5

Or use this command:

wget --user=terralib5 --password=newterralib5 http://www.dpi.inpe.br/terralib5-devel/3rdparty-src/terralib-3rdparty-macosx-el-capitan.tar.gz

Run install-3rdparty-macosx-el-capitan.sh to compile and install the TerraLib dependencies.

Copy the scripts terralib-conf.cmake and terralib-conf.sh located in someplace/terrame/git/terrame/install to someplace/terralib/build-cmake

-- someplace
      |
       -- terralib
            |
             -- 3rdparty
             -- build-cmake
                 |
                  -- terralib-conf.cmake (put here)
                  -- terralib-conf.sh (put here)
             -- git 

In terralib-conf.sh set the variable:

export _TERRALIB_3RDPARTY_DIR=/someplace/terralib/3rdparty/libs

Go to someplace/terralib/build-cmake and run terralib-conf.sh.

After that, is created the build directory that contains the TerraLib Xcode project terralib.xcodeproj:

-- someplace
      |
       -- terralib
            |
             -- 3rdparty
             -- build-cmake
                 |
                  -- terralib-conf.cmake
                  -- terralib-conf.sh
                  -- build (created)
             -- git 

Enter in build directory and open terralib.xcodeproj.

Now in Xcode, firstly, build ALL_BUILD. Second build install.

In this point is created the direcroty /install that contains all libraries of TerraLib.

-- someplace
      |
       -- terralib
            |
             -- 3rdparty
             -- build-cmake
                 |
                  -- terralib-conf.cmake
                  -- terralib-conf.sh
                  -- build
                  -- install (created)
             -- git 

libqtlua 2.0 (fork in TerraME repository)

Download zip libqtlua from the following Git repository, do not need to clone:

https://github.com/TerraME/libqtlua

Recomendated to use the structure of directories created:

-- someplace
      |
       -- terrame
            |
             -- depends
                 |
                  -- libqtlua (put here)
             -- build-cmake
             -- git 

qtluae (fork in TerraME repository)

Download zip qtluae from the following Git repository, do not need to clone:

https://github.com/TerraME/qtluae

Recomendated to use the structure of directories created:

-- someplace
      |
       -- terrame
            |
             -- depends
                 |
                  -- libqtlua
                  -- qtluae (put here)
             -- build-cmake
             -- git 

Protobuf (ref. master)

Download zip protobuf from the following Git repository, do not need to clone:

https://github.com/google/protobuf

Recomendated to use the structure of directories created:

-- someplace
      |
       -- terrame
            |
             -- depends
                 |
                  -- libqtlua
                  -- qtluae
                  -- protobuf (put here)
             -- build-cmake
             -- git 

Copy the script terrame-deps-conf.sh located in someplace/terrame/git/terrame/install to someplace/terrame/depends/build.

-- someplace
      |
       -- terrame
            |
             -- depends
                 |
                  -- libqtlua
                  -- qtluae
                  -- protobuf
                  -- terrame-deps-conf.sh (put here)
             -- build-cmake
             -- git 

Put Qt5 in the PATH environment variable:

export PATH=$PATH:/path/to/qt5/version/bin

Run terrame-deps-conf.sh.

After run, is created the /install directory that contains the necessary libraries to compile TerraME.

TerraME 2.X (ref. 2.0)

Copy the scripts terrame-conf.cmake and terrame-conf.sh located in someplace/terrame/git/terrame/install to someplace/terrame/build-cmake

-- someplace
      |
       -- terrame
            |
             -- depends
             -- build-cmake
                 |
                  -- terrame-conf.cmake (put here)
                  -- terrame-conf.sh (put here)
             -- git 

In terrame-conf.sh set the variables:

export _TERRALIB_3RDPARTY_DIR=/someplace/terralib/3rdparty/libs
export _TERRAME_DEPENDS_DIR=/someplace/terrame/depends/install
export _TERRALIB_MODULES_DIR=/someplace/terralib/build-cmake/install
export _QT5_DIR=/path/to/qt5/version

Go to someplace/terrame/build-cmake and run terrame-conf.sh.

After that, is created the build directory that contains the TerraME Xcode project terrame.xcodeproj:

-- someplace
      |
       -- terrame
            |
             -- depends
             -- build-cmake
                 |
                  -- terrame-conf.cmake
                  -- terrame-conf.sh
                  -- build (created here)
             -- git 

Enter in build directory and open terrame.xcodeproj.

Now in Xcode, firstly, build ALL_BUILD. Second build install.

In this point is created the direcroty /install that contains all libraries and executable of TerraME.

-- someplace
      |
       -- terrame
            |
             -- depends
             -- build-cmake
                 |
                  -- terrame-conf.cmake
                  -- terrame-conf.sh
                  -- build
                  -- install (created here)
             -- git 

For run the TerraME is necessary set some paths in environment or create a ~/.bash_profile like:

export TME_ROOT_PATH=/someplace/terrame/build-cmake/install
export TME_PATH=$TME_ROOT_PATH/bin
export DYLD_LIBRARY_PATH=$TME_ROOT_PATH/lib

Run terrame command in terminal for test:

terrame -version

Compile TerraME as Bundle

See in Bundle Structures on Mac Page for datails about Bundle.

In terrame-conf.cmake set TERRAME_BUILD_AS_BUNDLE to ON.

If was created ~/.bash_profile or set environments variables, remove them.

Go to someplace/terrame/build-cmake and run terrame-conf.sh.

Enter in build directory and open terrame.xcodeproj.

Build install in Xcode.

After that is generated a bundle of TerraME in /install directory. For work to bundle is necessary set PATH environment variable to /bin of the TerraME or set this command in ~/.bash_profile:

export PATH=$PATH:/someplace/terrame/build-cmake/install/terrame.app/Contents/bin

Run terrame command in terminal for test:

terrame -version

Create TerraME installer DMG

With bundle enabled, it is only necessary run the command in /build directory:

cd /someplace/terrame/build-cmake/build && /Applications/CMake.app/Contents/bin/cpack -G DragNDrop -C Release --config ./CPackConfig.cmake
## Linux (Ubuntu) environment

This tutorial was developed using Ubuntu 14.04. Different linux distributions may have some different procedures or different names for the packages of the dependencies. To build TerraME in Linux environment, most of the dependencies can be found in the repository, and installed through apt-get, used in this tutorial, or similar, depending on the Linux distribution being used. In this tutorial, we will use the libraries found repository whenever possible.

After these steps, if the building and configuration processes were sucessful, TerraME must execute without problems in the command line. To ensure that it is running fine, execute the tests through the command terrame -test. If there is no fails in the test, TerraME is working fine. If any of the tests fails, please report it to the development team.