Skip to content
Commits on Source (38)
*~
include/ossim/ossimConfig.h
include/ossim/ossimVersion.h
doc/html
*CMakeFiles*
*Makefile
cmake_install*
*.swp
CMakeCache.txt
PROJECT(ossimcore)
PROJECT(ossim)
SET(CMAKE_MODULE_PATH "${${PROJECT_NAME}_SOURCE_DIR}/cmake/CMakeModules;${CMAKE_MODULE_PATH}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Message("################## Setting up OSSIM core library #########################")
IF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
......@@ -7,24 +13,22 @@ ENDIF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_MODULE_PATH "${${PROJECT_NAME}_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
SET(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/ossim/cmake/CMakeModules" ${CMAKE_MODULE_PATH})
include(CMakeDetermineSystem)
INCLUDE(OssimVersion)
INCLUDE(OssimCommonVariables)
# Expose some build options
set(LIB_NAME ossim CACHE STRING "Name of ossim libray (default is ossim).")
OPTION(BUILD_OSSIM_FREETYPE_SUPPORT "Set to ON to build OSSIM with freetype support. Use OFF to turn off freetype support." ON)
OPTION(BUILD_OSSIM_MPI_SUPPORT "Set to ON to build OSSIM with MPI support. Use OFF to turn off MPI support." OFF)
OPTION(BUILD_OSSIM_ID_SUPPORT "Set to ON to build OSSIM GIT ID support into the library. Use OFF to turn off ID support." ON)
OPTION(BUILD_OSSIM_MPI_SUPPORT "Set to ON to build OSSIM with MPI support. Use OFF to turn off MPI support." ON)
OPTION(BUILD_OSSIM_ID_SUPPORT "Set to ON to build OSSIM SVN ID support into the library. Use OFF to turn off ID support." ON)
OPTION(BUILD_OSSIM_APPS "Set to ON to build ossim apps. Use OFF to disable." ON)
OPTION(BUILD_OSSIM_CURL_APPS "Set to ON to build ossim curl dependent apps. Use ON to enable." OFF)
OPTION(BUILD_OSSIM_TEST_APPS "Set to ON to build ossim test apps. Use OFF to disable." ON)
OPTION(BUILD_OSSIM_APPS "Set to ON to build ossim test apps. Use OFF to disable." ON)
OPTION(BUILD_OSSIM_APPS "Set to ON to build OSSIM applications." ON)
OPTION(BUILD_OSSIM_CURL_APPS "Set to ON to build ossim curl dependent apps. Use ON to enable." OFF)
OPTION(BUILD_OSSIM_TESTS "Set to ON to build OSSIM unit/functional tests." ON)
###################################################################################
# Include the Utilities in the root make
......@@ -43,6 +47,7 @@ CHECK_INCLUDE_FILE("dlfcn.h" CMAKE_HAVE_DLFCN_H)
# Set our include paths:
include_directories( ${PROJECT_SOURCE_DIR}/include )
include_directories( ${PROJECT_BINARY_DIR}/include )
include_directories( ${OSSIM_INCLUDE_DIR} )
# Stores list of libs to link with. Initialized throughout.
set( ossimDependentLibs )
......@@ -52,7 +57,7 @@ set( ossimDependentLibs )
#---
# GEOS - Currently optional until it is actually called.:
find_package( GEOS )
find_package( GEOS QUIET)
if( GEOS_FOUND )
include_directories( ${GEOS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOS_LIBRARY} )
......@@ -60,6 +65,14 @@ else( GEOS_FOUND )
message( FATAL_ERROR "Could not find geos package! Consider installing this as it will soon become a required package." )
endif( GEOS_FOUND )
find_package( JsonCpp QUIET)
if( JSONCPP_FOUND )
include_directories( ${JSONCPP_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JSONCPP_LIBRARY} )
else( JSONCPP_FOUND )
message("Could not find JSONCPP package! Consider installing this as it will soon become a required package." )
endif( JSONCPP_FOUND )
# GEOFIFF - Required:
set( OSSIM_HAS_GEOTIFF 0 )
find_package( GEOTIFF )
......@@ -89,15 +102,6 @@ else( JPEG_FOUND )
message( FATAL_ERROR "Could not find required jpeg package!" )
endif( JPEG_FOUND )
# OpenThreads - Required:
find_package( OpenThreads )
if( OPENTHREADS_FOUND )
include_directories( ${OPENTHREADS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${OPENTHREADS_LIBRARY} )
else( OPENTHREADS_FOUND )
message( FATAL_ERROR "Could not find required OpenThreads package!" )
endif( OPENTHREADS_FOUND )
# TIFF - Required:
find_package( TIFF )
if( TIFF_FOUND )
......@@ -107,16 +111,26 @@ else( TIFF_FOUND )
message( FATAL_ERROR "Could not find required tiff package!" )
endif( TIFF_FOUND )
# DL - Required on unix:
if( UNIX )
find_library( DL_LIBRARY dl )
if ( DL_LIBRARY )
set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
else( DL_LIBRARY )
# TODO: Is this required on unix? If so move to the required section.
message( FATAL_ERROR "Could not find dl library!" )
endif( DL_LIBRARY )
endif( UNIX )
# This caused a core dump on ossim executables running in jenins pipeline (ossim-test-dev)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
find_library( DL_LIBRARY dl )
if ( DL_LIBRARY )
set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
else( DL_LIBRARY )
# TODO: Is this required on unix? If so move to the required section.
message( FATAL_ERROR "Could not find dl library!" )
endif( DL_LIBRARY )
endif() # if (CMAKE_SYSTEM_NAME MATCHES "Linux")
#if( UNIX )
# find_library( DL_LIBRARY dl )
# if ( DL_LIBRARY )
# set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
# else( DL_LIBRARY )
# # TODO: Is this required on unix? If so move to the required section.
# message( FATAL_ERROR "Could not find dl library!" )
# endif( DL_LIBRARY )
#endif( UNIX )
# FREETYPE - Optional:
set( OSSIM_HAS_FREETYPE 0 )
......@@ -155,22 +169,46 @@ else ( ZLIB_FOUND )
message( WARNING "Could not find optional zlib package!" )
endif ( ZLIB_FOUND )
# HDF5 - Optional
set( OSSIM_HAS_HDF5 0 )
if (BUILD_OSSIM_HDF5_SUPPORT)
message( STATUS "Native HDF5 support requested. Searching for HDF5 library..." )
find_package( HDF5A )
if ( HDF5A_FOUND)
include_directories( ${HDF5A_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${HDF5A_LIBRARIES} )
set( OSSIM_HAS_HDF5 1 )
else ( HDF5A_FOUND )
message( WARNING "Could not find optional HDF5A package. Excluding native support." )
endif ( HDF5A_FOUND )
else (BUILD_OSSIM_HDF5_SUPPORT)
message( STATUS "Native HDF5 support was not requested. If you want HDF5 support, set the environment BUILD_OSSIM_HDF5_SUPPORT=ON..." )
endif ( BUILD_OSSIM_HDF5_SUPPORT )
find_package( Threads )
set( ossimDependentLibs ${ossimDependentLibs} ${CMAKE_THREAD_LIBS_INIT} )
#---
# Call the OSSIM macros in OssimUtilities.cmake
#---
TODAYS_DATE(OSSIM_BUILD_DATE)
SET(OSSIM_SVN_REVISION_NUMBER "UNKNOWN")
GET_SVN_REVISION()
if ( NOT OSSIM_BUILD_DATE )
TODAYS_DATE(OSSIM_BUILD_DATE)
endif( NOT OSSIM_BUILD_DATE )
SET(OSSIM_GIT_REVISION_NUMBER "UNKNOWN")
GET_GIT_REVISION()
if ( NOT ${Project_WC_REVISION} EQUAL 0 )
set( OSSIM_SVN_REVISION_NUMBER ${Project_WC_REVISION} )
set( OSSIM_GIT_REVISION_NUMBER ${Project_WC_REVISION} )
endif()
#####################################################################################
# Call the configure files for ossimConfig and ossimVersion setup
#####################################################################################
set(OSSIM_VERSION_NUMBER "\"${OSSIM_VERSION}\"")
set(OSSIM_BUILD_DATE "\"${OSSIM_BUILD_DATE}\"")
set(OSSIM_REVISION_NUMBER "\"${OSSIM_SVN_REVISION_NUMBER}\"")
set(OSSIM_REVISION "\"${OSSIM_GIT_REVISION_NUMBER}\"")
# Setting of OSSIM_ID to variable expanded $Id$ results. Embedded troughout code.
set(OSSIM_ID_ENABLED 1)
......@@ -179,42 +217,21 @@ IF(NOT BUILD_OSSIM_ID_SUPPORT)
ENDIF(NOT BUILD_OSSIM_ID_SUPPORT)
SET(OSSIM_CONFIGURE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimConfig.h")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/ossimConfig.h.in"
"${OSSIM_CONFIGURE_HEADER}")
SET(OSSIM_VERSION_HEADER_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/ossimVersion.h.in")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/ossimConfig.h.in"
"${OSSIM_CONFIGURE_HEADER}")
SET(OSSIM_VERSION_HEADER_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimVersion.h.in")
SET(OSSIM_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimVersion.h")
CONFIGURE_FILE("${OSSIM_VERSION_HEADER_CONFIG}"
"${OSSIM_VERSION_HEADER}")
##################################################################################################
# Instead of creating another CMakeLists under src we will just add the subdirectories to build
# here
# Point to the CMakeLists.txt in the src dir. OLK: Removed unnecessary src/ossim structure and
# replaced with simply src.
##################################################################################################
subdirs(src/ossim)
subdirs(src)
#---
# Building apps optional.
#---
if(BUILD_OSSIM_APPS)
subdirs(src/apps)
endif()
#---
# Building curl dependant apps optional. default=OFF
#---
if(BUILD_OSSIM_CURL_APPS)
subdirs(src/apps/curl_apps)
endif()
#---
# Building test apps optional.
#---
if(BUILD_OSSIM_TEST_APPS)
subdirs(src/test)
endif()
set(TARGET_COMMON_LIBRARIES ossim ${OPENTHREADS_LIBRARY})
set(TARGET_COMMON_LIBRARIES ossim)
##################################################################################################
#
......@@ -229,21 +246,13 @@ INSTALL(FILES ${ossim_projection_codes_csv} DESTINATION share/ossim/projection C
FILE(GLOB ossim_util_api_json ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/util/*.json)
INSTALL(FILES ${ossim_util_api_json} DESTINATION share/ossim/util COMPONENT ossim)
# 3) Fonts
FILE(GLOB ossim_fonts ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/fonts/*.ttf)
INSTALL(FILES ${ossim_fonts} DESTINATION share/ossim/fonts COMPONENT ossim)
###################### OUTPUT GENERAL VARIABLE SETTINGS #######################
MESSAGE( STATUS "OSSIM_REVISION_NUMBER = ${OSSIM_REVISION_NUMBER}" )
MESSAGE( STATUS "BUILD_LIBRARY_DIR = ${BUILD_LIBRARY_DIR}" )
MESSAGE( STATUS "BUILD_RUNTIME_DIR = ${BUILD_RUNTIME_DIR}" )
MESSAGE( STATUS "BUILD_OSSIM_FREETYPE_SUPPORT = ${BUILD_OSSIM_FREETYPE_SUPPORT}" )
MESSAGE( STATUS "BUILD_OSSIM_APPS = ${BUILD_OSSIM_APPS}" )
MESSAGE( STATUS "BUILD_OSSIM_CURL_APPS = ${BUILD_OSSIM_CURL_APPS}" )
MESSAGE( STATUS "BUILD_OSSIM_TEST_APPS = ${BUILD_OSSIM_TEST_APPS}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}" )
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "OSSIM_REVISION = ${OSSIM_REVISION}" )
MESSAGE( STATUS "FREETYPE_LIBRARY = ${FREETYPE_LIBRARIES}" )
MESSAGE( STATUS "FREETYPE_INCLUDE = ${FREETYPE_INCLUDE_DIRS}" )
MESSAGE( STATUS "GEOTIFF_LIBRARY = ${GEOTIFF_LIBRARIES}" )
......@@ -254,20 +263,28 @@ MESSAGE( STATUS "GEOS_LIBRARY = ${GEOS_LIBRARY}" )
MESSAGE( STATUS "GEOS_INCLUDE = ${GEOS_INCLUDE_DIR}" )
MESSAGE( STATUS "JPEG_LIBRARY = ${JPEG_LIBRARIES}" )
MESSAGE( STATUS "JPEG_INCLUDE = ${JPEG_INCLUDE_DIR}" )
MESSAGE( STATUS "MPI_LIBRARY = ${MPI_LIBRARIES}" )
MESSAGE( STATUS "MPI_INCLUDE = ${MPI_INCLUDE_PATH}" )
MESSAGE( STATUS "OPENTHREADS_LIBRARY = ${OPENTHREADS_LIBRARY}" )
MESSAGE( STATUS "OPENTHREADS_INCLUDE = ${OPENTHREADS_INCLUDE_DIR}" )
MESSAGE( STATUS "OSSIM_COMPILE_WITH_FULL_WARNING = ${OSSIM_COMPILE_WITH_FULL_WARNING}" )
MESSAGE( STATUS "OSSIM DEPENDENT LIBRARIES = ${ossimDependentLibs}" )
MESSAGE( STATUS "TIFF_LIBRARY = ${TIFF_LIBRARIES}" )
MESSAGE( STATUS "TIFF_INCLUDE = ${TIFF_INCLUDE_DIR}" )
MESSAGE( STATUS "ZLIB_LIBRARY = ${ZLIB_LIBRARIES}" )
MESSAGE( STATUS "ZLIB_INCLUDE = ${ZLIB_INCLUDE_DIR}" )
MESSAGE( STATUS "OSSIM_HAS_HDF5 = ${OSSIM_HAS_HDF5}" )
#-----------------------------------------------------------------------------
# uninstall target
#-----------------------------------------------------------------------------
OSSIM_ADD_COMMON_MAKE_UNINSTALL()
#OSSIM_ADD_COMMON_MAKE_UNINSTALL()
message("################## end of OSSIM core library setup #########################")
IF(BUILD_OSSIM_APPS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps ${CMAKE_CURRENT_BINARY_DIR}/apps)
ENDIF()
#---
# Building curl dependant apps optional. default=OFF
#---
if(BUILD_OSSIM_CURL_APPS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/curl_apps)
endif()
IF(BUILD_OSSIM_TESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/src ${CMAKE_CURRENT_BINARY_DIR}/test/src)
ENDIF()
The MIT License (MIT)
Copyright (c) 2015 OSSIM Labs
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -10,14 +9,14 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
### Jenkins Build Status
Resource | *master* | *dev* |
------------ | ------------- | -------------
OSSIM Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-dev&style=plastic)
Batch Test| ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-dev&style=plastic)
RPMS Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-dev&style=plastic)
RPMS Publish Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-dev&style=plastic)
<a href="https://scan.coverity.com/projects/ossimlabs">
<img alt="Coverity Scan Build Status"
src="https://img.shields.io/coverity/scan/7516.svg"/>
</a>
# Welcome to OSSIM
OSSIM is an open source, C++ (mostly), geospatial image processing library used by government, commercial, educational, and private entities throughout the solar system. It has been in active development since the last millenium. This repository contains the full OSSIM package including core library, applications, tests, and build system. It does *not* contain the OSSIM plugins and other OSSIM-related code such as java-bindings ([ossim-oms](https://github.com/ossimlabs/ossim-oms)), and GUI. Those are available for individually cloning. Refer to the root github page for [ossimlabs](https://github.com/ossimlabs).
Quick links:
* [What to Get](#relationship-between-repositories)
* [How to Build](#how-to-build)
* [How to Test](#how-to-test)
* [OSSIM Command Line Utility](#ossim-command-line-utility)
* [Doxygen Source Code Documentation](https://trac.osgeo.org/ossim/doxygen)
# Relationship between Repositories (What to Get)
The principal repository is this one (ossim), containing not only the core classes but also the command line utility applications code as well as the cmake build system files and related scripts. This repository must be cloned first before attempting to work with other _ossim-*_ repositories.
The remaining _ossim-*_ repositories are independent of each other and can be cloned in any order. However, it will be necessary to re-run the [build script (linux version)](/scripts/linux/build.sh) or at least regenerate makefiles with the [cmake script (linux version)](/cmake/scripts/ossim-cmake-config-LINUX.sh) before building. This must be done each time a new ossim-* repository is added to the ossimlabs build. See below for detailed build instructions.
# Branching Scheme and Pull Requests
The "master" branches (for all OSSIM family repos) contain the most stable code. It is periodically merged with "dev" branch. If you don't plan on developing code, but want to build from source, this is the branch you want. For bleeding edge development, use the "dev" branch. This branch serves as the parent to all feature branches and is frequently merged with those feature branches once those branches are tested by the developers responsible for them.
If you want to contribute code, you'll need to:
* create your own feature branch from dev,
* test your modification,
* then create a pull request.
The moderators will review the request and merge your changes to "dev". At that point, the automated continuous integration system (Jenkins) will get triggered to perform a build and test. If there are any failures, your merge commit will be backed out.
# How to Build
The easy way is to just run the script in `ossim/scripts/build.sh`. This approach should work for the default build configuration. This currently works for both linux and Mac. We hope to soon have a Windows `build.bat` file and world peace. Assuming all dependencies were met and no compile/link errors occured, this script will generate all build binaries under a sibling directory to the ossim repo directory, namely, `ossim/../build`. See the section on environment variables below for options on customizing the build location.
This repository provides the CMAKE infrastructure necessary to build the OSSIM core library and related plugins and applications. Throughout this document, reference is made to the local, top-level directory containing this repository. We'll call this directory simply *ossim-dev-home*. (In fact, you'll find the shell variable `OSSIM_DEV_HOME` used throughout the various scripts in this and other repositories.
The following 3rd-party SDKs are needed in order to build the core ossim library:
libtiff-devel (preferably version 4.x for BigTIFF support)
OpenThreads-devel
libjpeg-devel
libgeos-devel (on later Debian / Ubuntu versions, libgeos++-dev)
Plugins will require additional 3rd-party packages.
Building OSSIM and related repos from source is a two-step process: first create the make files using CMake, then run `make` to build the binaries. Scripts are available for Linux/Mac and (soon) Windows to run CMake with default settings. You can run the script from any working directory and default settings will be used for creating the default build environment. It is possible to override specific defaults for your own custom requirements or preferences.
Presently, the default setting is to disable the building of all plugins. If you want specific plugin libraries to be built, you'll need to edit your cmake script at `cmake/scripts/ossim-cmake-config.sh` (or similar `.bat` file for Windows). Scroll down to the "Plugins" section and set the corresponding variables to "ON". Note that you could also define those variables in your shell environment in lieu of editing the script.
## Creating the Makefiles
### Creating a Default Build Environment
The cmake configuration scripts are available in the `cmake/scripts` subdirectory. Assuming no OSSIM environment variables are available to override the defaults, the "out-of-source" `build` directory will be created under the same parent directory *ossim-dev-home* as this repo. The linux/Mac script `ossim/scripts/build.sh`, if run in an interactive shell will query for the build type. If the script is run as part of a batch process, "Release" is assumed. If the build directory does not exist, it will be created.
### Customizing the Build
There are two ways to customize the build: via environment variables and by directly editing the cmake configuration script.
#### Environment Variables
The CMake system will locally define certain environment variables that live for the lifetime of the cmake config script execution. The following shell variables, if defined, are referenced to override the default settings.
The developer has the option to override the default build directory location by setting the environment variable `OSSIM_BUILD_DIR` prior to running the cmake config script. If not present, the `build` directory will be located just under *ossim-dev-home* as described above.
Another defaulted environment variable is `OSSIM_INSTALL_PREFIX`. This variable as two distinct functions. First, it indicates where to install the OSSIM SDK when running `make install`. Second, it serves to specify a path to SDKs that OSSIM depends on. The CMake system will scan `OSSIM_INSTALL_PREFIX` for the presence of dependency packages such as GeoTiff, JPEG, and others. This secondary purpose of `OSSIM_INSTALL_PREFIX` used to be handled by the now obsolete environment variable `OSSIM_DEPENDENCIES`. It is a reasonable consolidation since the OSSIM install will need to include these dependencies if they are not available in their standard installation locations (/usr/lib, /usr/local/lib, etc.), so placing these SDKs in the final OSSIM install directory prior to building OSSIM makes sense. If no override is defined for `OSSIM_INSTALL_PREFIX`, then the cmake config script will default to `$OSSIM_DEV_HOME/install`. You can populate that directory with non-standard installs of the OSSIM dependencies prior to running the script. If the directory does not exist, it is created by the script. Obviously, in that case, all OSSIM dependencies will be expected to be found in standard system install folders.
As already mentioned, you can enable the building of specific plugins by defining the corresponding environment variable: `BUILD_<NAME>_PLUGIN=ON`.
NOTE: For legacy reasons, `OSSIM_DEPENDENCIES` is still scanned for dependency SDKs. New dependencies however should be "installed" in `OSSIM_INSTALL_PREFIX`.
#### Editing the CMake Config Script
The default configuration relies on the presence of the OSSIM repositories under the *ossim-dev-home* to decide whether to include those in the build (with the exception of the plugins, which default to "OFF"). You may want to selectively exclude certain applications from the build without having to hide the workspaces from CMake. The flags enabling those are defined in the script. Simply set the corresponding variable to "OFF" and rerun the script. Likewise, for the plugins, you can modify the default ("OFF") by changing the corresponding variables in the script to "ON".
There are other flags available that direct CMake to generate project files for IDEs such as Eclipse and Visual Studio. You can also specify multi-threaded builds, non-standard output directories, and more. Feel free to experiment, but know that you'll be voiding the warranty.
### _How do I know what dependencies are needed?_
The CMake system will attempt to locate all necessary dependency SDKs in the system's standard install directories. On linux, this includes, but not limited to, /usr and /usr/local. If it cannot find them, the script will exit with an error message indicating the missing library. You can then install the missing library from the third-party repository before trying to run the OSSIM cmake config script again. You may get several dependency errors before CMake succeeds in generating all the Makefiles needed.
Remember, you can provide "sandbox" installations of dependency libraries that you want to link with, even though your system may (or may not) have installed different versions of those libraries. That's achieved by "installing" those SDKs inside the directory indicated by the CMake environment variable `OSSIM_INSTALL_PREFIX` (defaults to *ossim-dev-home*/install, see above).
Eventually, we hope to provide an artifact repository so that CMake itself can access any missing dependencies without the need for the developer to manually install them.
## Building the Binaries
Once the cmake configuration script terminates successfully, you are ready to build the binaries. Build instructions vary slightly between OS's, but generally involve simply running `make` inside the build directory.
First change directory to the build folder created by the cmake config script. There you will find a top-level Makefile that will bootstrap the build. From a terminal, run `make`. The build should proceed normally for a few minutes, longer if the first time through. Upon successful completion, you should find a "lib" and "bin" folder containing the ossim library and executable, respectively.
Developers have different ways of working -- all we're helping you with here is building the OSSIM library and associated plugins and executables. You may choose to then run `make install` to copy the binaries to some standard system location (you'll need to have the appropriate permissions). Alternatively, you can append your `PATH` environment variable to include the `build/bin` folder containing the executables. You also need to update the library path to include `build/lib`. These settings vary by OS so you're on your own here.
## Integrated Development Environments
You may be able to import the build environment into your IDE "as a Makefile project." The Windows cmake configuration script will generate Visual Studio project files for direct import into Visual Studio. You may want to take a look at that script to see if there is a custom setting (or command line argument) you need to tinker with.
### Eclipse Users
For convenience, you can specify "eclipse" as the build-type to the script at `ossim/cmake/scripts/ossim-cmake-config-LINUX.sh` that will generate the Eclipse CDT4 project files along with the makefiles for a debug build. The output build directory will be one level up from *ossim-dev-home* since Eclipse does not support the build directory as sibling of source. Eclipse will properly generate "Subprojects" corresponding to each ossimlabs repo present in your *ossim-dev-home* for indexed navigation of the source files. It is built with debug. To import into your Eclipse workspace, right-click in the Project Explorer and select Import->General->"Existing Project...", then select the root directory by browsing to `<ossim-dev-home>/../build` and clicking "OK".
# How to Test
The first check of a successful build is to run the ossim command line utility `ossim-cli --version`. You should get the current version output to the console. More on the `ossim-cli` command below.
Testing is generally divided into unit, functional, and integration tests. At the moment, true unit testing in OSSIM is very limited, and likely to stay that way. There is however a _de facto_ scheme in place that has been used for implementing integration and functional testing using the `ossim-batch-test` command line executable. Much of the functional testing supplied through `ossim-batch-test` configuration files is fairly fine-grained, almost to the unit-test level of granularity. This testing platform lets the developer create any level of test, from top-level integration test to individual class method test. This application spawns other OSSIM utility applications to generate results, including dedicated test utilities, which are then compared against an expected-results dataset. This command-line app reads a configuration file that specifies a test or series of tests to run and possibly compare against expected results. There is an option to accept current results as the new expected results. While not explicitly required, the majority of testing done with `ossim-batch-test` will involve input source data, typically imagery, that the tester must preinstall on the target machine. The expected results will also need to be generated and its location specified on the command line. See the usage for `ossim-batch-test` for more detail.
A rudimentary test suite is encapsulated in this [test script (linux version)](/scripts/test.sh). It defines the locations of the input source data and expected results, and runs the command-line test applications.
The _ossim_ repository contains `test/src` and `test/config` subdirectories which contain items available for testing OSSIM core functionality. At some point when we start including unit tests, there will be a third directory, `test/scripts`, that will contain the commands to run those unit tests.
## test/src
This directory contains the source code for unit and functional testing of core OSSIM objects. It is automatically built by the cmake/make system, assuming `BUILD_OSSIM_TESTS` is set to `ON` (the default). The resulting executables, located in `build/bin`, can be run standalone on the command line. The code in this directory is also a good source of examples for interfacing to many important OSSIM classes. This directory also contains the source code for `ossim-batch-test`.
## test/config
This subdirectory contains, primarily, configuration files for existing `ossim-batch-test` runs.
The input data referenced in the `ossim-batch-test` configuration files are presently hosted on an Amazon S3 storage. Contact the [OSSIM developer list](mailto:ossim-developer@lists.sourceforge.net) if you want access to this public data for your own testing.
# OSSIM Command Line Utility
The executable `ossim-cli` will eventually consolidate the plethora of ossim utility applications currently existing. For now it supports a small subset of utilities though among them is `info` that reproduces the functionality of the ubiquitous `ossim-info`.
The usage is: `ossim-cli <command> [options and parameters]`
With no arguments, the app will give a list of capabilities. Currently those are
* help <command> -- To get help on specific command. Same as "<command> --help"
* bandmerge -- Merges multiple band files into a single RGB image.
* hillshade -- Computes shaded representation of input elevation surface with specified lighting parameters.
* hlz -- Computes bitmap of helicopter landing zones given ROI and DEM.
* info -- Dumps metadata information about input image and OSSIM in general.
* ortho -- Utility for orthorectifying and reprojecting image data.
* potrace -- Computes vector representation of input raster image.
* shoreline -- Computes bitmap of water versus land areas in an input image.
* slope -- Utility for computing the slope at each elevation post and generating a corresponding slope image.
* vertices -- Utility for determining the active image corner vertices inside larger null-filled image rectangle.
* viewshed -- Computes bitmap image representing the viewshed from specified location using only DEM information.
For example, to get projection and image information for an image file, use
`ossim-cli info -p -i <image-filename>`
You can also give a keyword list (KWL) file as the only arg. The KWL must contain the keyword "tool" with one of the supported commands above, along with the keywords expected by that utility. You can even get KWL templates or enter the keyword/values interactively.
......@@ -2,6 +2,15 @@ FILE(GLOB OSSIM_APP_DIRS "ossim-*")
FILE(GLOB OSSIM_CONFIG_DIR "ossim-config*")
LIST(REMOVE_ITEM OSSIM_APP_DIRS ${OSSIM_CONFIG_DIR})
# FIND_PACKAGE(ossim)
# if( OSSIM_FOUND )
# include_directories( ${OSSIM_INCLUDE_DIR} )
# else( OSSIM_FOUND )
# message( FATAL_ERROR "Could not find required OSSIM package!" )
# endif( OSSIM_FOUND )
# set(TARGET_COMMON_LIBRARIES ${OSSIM_LIBRARY} ${OPENTHREADS_LIBRARY})
FOREACH(f ${OSSIM_APP_DIRS})
ADD_SUBDIRECTORY(${f})
ADD_SUBDIRECTORY(${f})
ENDFOREACH(f)
......@@ -14,15 +14,6 @@ else()
set(LIBSUFFIX "")
endif()
# OpenThreads - Required:
find_package( OpenThreads )
if( OPENTHREADS_FOUND )
include_directories( ${OPENTHREADS_INCLUDE_DIR} )
set( requiredLibs ${requiredLibs} ${OPENTHREADS_LIBRARY} )
else( OPENTHREADS_FOUND )
message( FATAL_ERROR "Could not find required OpenThreads package!" )
endif( OPENTHREADS_FOUND )
find_package( CURL )
if( CURL_FOUND )
include_directories( ${CURL_INCLUDE_DIR} )
......@@ -45,8 +36,6 @@ include_directories(".")
message( STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}" )
message( STATUS "CURL_LIBRARY = ${CURL_LIBRARY}" )
message( STATUS "OPENTHREADS_LIBRARY = ${OPENTHREADS_LIBRARY}" )
message( STATUS "OPENTHREADS_INCLUDE = ${OPENTHREADS_INCLUDE_DIR}" )
message( STATUS "OSSIM_INCLUDE_DIR = ${OSSIM_INCLUDE_DIR}" )
message( STATUS "OSSIM_LIBRARIES = ${OSSIM_LIBRARIES}" )
message( STATUS "Required libs = ${requiredLibs}" )
......@@ -61,13 +50,13 @@ add_executable(omar-data-mgr omar-data-mgr.cpp omarDataMgrUtil.cpp )
# Set the output dir:
set_target_properties(omar-data-mgr
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# omar-data-mgr application links with required libs.
target_link_libraries( omar-data-mgr ${requiredLibs} )
# Install app:
install( TARGETS omar-data-mgr
DESTINATION ${INSTALL_RUNTIME_DIR} )
DESTINATION bin )
message( "************** End: CMAKE SETUP FOR ossim curl apps ******************" )
......@@ -14,6 +14,7 @@
#include <ossim/base/ossimNotify.h>
#include <ossim/base/ossimRefPtr.h>
#include <ossim/init/ossimInit.h>
#include <ossim/parallel/ossimMpi.h>
#include "omarDataMgrUtil.h"
#include <iostream>
......@@ -21,6 +22,10 @@ using namespace std;
int main(int argc, char *argv[])
{
#if OSSIM_HAS_MPI
ossimMpi::instance()->initialize(&argc, &argv);
#endif
int rv = 0; // Return value.
//---
......
......@@ -35,6 +35,7 @@
#include <string>
#include <vector>
static std::string ACCESS_TIME_THRESHOLD_KW = "access_time_threshold";
static std::string CLEAN_KW = "clean";
static std::string DUMP_FILTERED_IMAGES_KW = "dump_filtered_images";
static std::string FALSE_KW = "false";
......@@ -79,6 +80,9 @@ void omarDataMgrUtil::addArguments(ossimArgumentParser& ap)
au->setCommandLineUsage(usageString);
// Set the command line options:
au->addCommandLineOption("--access-time-threshold", "<days> For \"remove\" action. Only remove if last access is greater than days.");
au->addCommandLineOption("--clean", "Cleans/removes image file and associated files from file system if present.\n\"remove\" option only.\nLooks for associated files of image, e.g. .ovr, .his, .omd, .geom\nCAUTION: This command is irreversible once envoked!");
au->addCommandLineOption("--dump-filtered-image-list", "Outputs list of filtered images.");
......@@ -127,6 +131,15 @@ bool omarDataMgrUtil::initialize(ossimArgumentParser& ap)
std::string ts1;
ossimArgumentParser::ossimParameter sp1(ts1);
if( ap.read("--access-time-threshold", sp1) )
{
m_kwl->addPair( ACCESS_TIME_THRESHOLD_KW, ts1 );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--clean") )
{
addOption( CLEAN_KW, TRUE_KW );
......@@ -175,6 +188,16 @@ bool omarDataMgrUtil::initialize(ossimArgumentParser& ap)
if( ap.read("--preproc"))
{
m_imageUtil = new ossimImageUtil();
if ( getOverrideFilteredImagesFlag() )
{
//---
// User requested override but the arg parser for omarDataMgr has
// stripped the argument for image util so manually set it.
//---
m_imageUtil->setOverrideFilteredImagesFlag( true );
}
m_imageUtil->initialize(ap);
}
......@@ -278,9 +301,8 @@ ossim_int32 omarDataMgrUtil::execute()
if ( !getOverrideFilteredImagesFlag() && m_filteredImages.empty() )
{
initializeDefaultFilterList();
m_fileWalker->initializeDefaultFilterList();
}
m_fileWalker->initializeDefaultFilterList();
//---
// Passing getNumberOfThreads() to ossimFileWalker::setNumberOfThreads was
......@@ -421,6 +443,11 @@ void omarDataMgrUtil::usage(ossimArgumentParser& ap)
<< ap.getApplicationName()
<< " add 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Build overviews, histogram, and add to database.\n"
<< ap.getApplicationName()
<< " --preproc --ot ossim_kakadu_nitf_j2k --ch add "
<< "5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Passing in url:\n"
<< ap.getApplicationName()
<< " -u http://your_url/omar add 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
......@@ -439,7 +466,11 @@ void omarDataMgrUtil::usage(ossimArgumentParser& ap)
<< "Removing all images in a directory using 32 threads:\n"
<< ap.getApplicationName()
<< " --clean --threads 32 remove /data1/imagery/2015/09/28/0000\n"
<< " --clean --threads 32 remove /data1/imagery/2015/09/28/0000\n\n"
<< "Removing all images in a directory using 4 threads that have not been accessed in 30 days:\n"
<< ap.getApplicationName()
<< " --access-time-threshold 30 --clean --threads 4 remove /data1/imagery/2015/09/28/0000\n"
<< std::endl;
}
......@@ -461,6 +492,42 @@ bool omarDataMgrUtil::isDirectoryBasedImage(const ossimImageHandler* ih) const
return result;
}
bool omarDataMgrUtil::isPastLastAccessedThreshold( const ossimFilename& file ) const
{
// Default to true.
bool result = true;
std::string value = m_kwl->findKey( ACCESS_TIME_THRESHOLD_KW );
if ( value.size() )
{
const ossim_int64 SECONDS_PER_DAY = 86400; // 60 * 60 * 24
ossim_int64 thresholdInDays = ossimString(value).toInt64();
if ( thresholdInDays )
{
// Returns -1 if does not exist.
ossim_int64 secondsSinceAccessed = file.lastAccessed();
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< ACCESS_TIME_THRESHOLD_KW << ": " << thresholdInDays
<< "\nfile_last_accessed: " << secondsSinceAccessed/SECONDS_PER_DAY
<< "\n";
}
if ( secondsSinceAccessed > 0 )
{
if ( secondsSinceAccessed/SECONDS_PER_DAY <= thresholdInDays )
{
result = false;
}
}
}
}
return result;
}
void omarDataMgrUtil::setNumberOfThreads( ossim_uint32 threads )
{
addOption( THREADS_KW, threads );
......@@ -706,76 +773,80 @@ bool omarDataMgrUtil::callRemoveRasterService( const ossimFilename& file )
}
bool result = false;
if ( isPastLastAccessedThreshold( file ) )
{
std::string service;
getService( service );
std::string service;
getService( service );
std::string url;
getUrl( url );
std::string url;
getUrl( url );
if ( service.size() && url.size() )
{
CURL* curl = curl_easy_init();
if ( curl )
if ( service.size() && url.size() )
{
// Data for POST:
std::string data = std::string("filename=") + file.string();
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data.c_str() );
CURL* curl = curl_easy_init();
if ( curl )
{
// Data for POST:
std::string data = std::string("filename=") + file.string();
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data.c_str() );
// Create the URL string:
std::string urlString = url + service;
curl_easy_setopt( curl, CURLOPT_URL, urlString.c_str() );
// Create the URL string:
std::string urlString = url + service;
curl_easy_setopt( curl, CURLOPT_URL, urlString.c_str() );
ossimNotify(ossimNotifyLevel_INFO)
<< "data: " << data
<< "\nurl: " << urlString.c_str()
<< std::endl;
ossimNotify(ossimNotifyLevel_INFO)
<< "data: " << data
<< "\nurl: " << urlString.c_str()
<< std::endl;
// Tell libcurl to follow redirection
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
// Tell libcurl to follow redirection
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
// Run it:
CURLcode res = curl_easy_perform(curl);
// Run it:
CURLcode res = curl_easy_perform(curl);
// Check for errors:
if ( res == CURLE_OK )
{
// Response code of the http transaction:
long respcode;
res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &respcode);
// Check for errors:
if ( res == CURLE_OK )
{
if ( respcode == 200 ) // OK 200 "The request was fulfilled."
// Response code of the http transaction:
long respcode;
res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &respcode);
if ( res == CURLE_OK )
{
result = true; // Set return status for caller.
// Check for clean flag:
if ( getCleanFlag() )
if ( respcode == 200 ) // OK 200 "The request was fulfilled."
{
clean( file );
result = true; // Set return status for caller.
// Check for clean flag:
if ( getCleanFlag() )
{
clean( file );
}
}
}
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< "curl_easy_perform() failed: \n"
<< curl_easy_strerror(res)
<< std::endl;
setErrorStatus( (ossim_int32)res );
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< "curl_easy_perform() failed: \n"
<< curl_easy_strerror(res)
<< std::endl;
setErrorStatus( (ossim_int32)res );
}
ossimNotify(ossimNotifyLevel_WARN) << std::endl;
ossimNotify(ossimNotifyLevel_WARN) << std::endl;
// Always cleanup:
curl_easy_cleanup(curl);
}
// Always cleanup:
curl_easy_cleanup(curl);
}
// Cleanup curl:
curl_global_cleanup();
// Cleanup curl:
curl_global_cleanup();
} // Matches: if ( service.size() )
} // Matches: if ( service.size() )
} // Matches: if ( isPastLastAccessedThreshold( file ) )
if(traceDebug())
{
......@@ -796,7 +867,7 @@ void omarDataMgrUtil::clean( const ossimFilename& file ) const
// Base image file:
if ( f.exists() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << "Removing file: " << f << "\n";
ossimNotify(ossimNotifyLevel_NOTICE) << "\nRemoving file: " << f << "\n";
ossimFilename::remove( f );
}
......
......@@ -22,9 +22,9 @@
#include <ossim/base/ossimRefPtr.h>
#include <ossim/util/ossimImageUtil.h>
#include <OpenThreads/Mutex>
#include <ostream>
#include <vector>
#include <mutex>
class ossimArgumentParser;
class ossimFileWalker;
......@@ -250,6 +250,17 @@ private:
*/
bool isDirectoryBasedImage(const ossimImageHandler* ih) const;
/**
* @brief Checks file last access time against threshold.
*
* This check for option key "access_time_threshold", value in days. If
* found will return true if files last access time is greater than the
* threshold days. If key is not set the default return is true.
*
* @return true if file is past last accessed threshold.
*/
bool isPastLastAccessedThreshold( const ossimFilename& file ) const;
/** @return true if key is set to true; false, if not. */
bool keyIsTrue( const std::string& key ) const;
......@@ -257,7 +268,7 @@ private:
ossimRefPtr<ossimKeywordlist> m_kwl;
ossimFileWalker* m_fileWalker;
OpenThreads::Mutex m_mutex;
std::mutex m_mutex;
ossimRefPtr<ossimImageUtil> m_imageUtil;
ossim_int32 m_errorStatus;
......
......@@ -2,7 +2,7 @@
//----------------------------------------------------------------------------
// Copyright (c) 2005, David Burken, all rights reserved.
//
// License: MIT
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
......@@ -320,4 +320,3 @@ bool processImage(ossimApplanixEOFile& eo,
}
return true;
}
......@@ -2,7 +2,7 @@
//
// File: ossim-autreg.cpp
//
// License: MIT
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
......@@ -94,4 +94,3 @@ int main(int argc, char *argv[])
exit(0);
} // End of main...
//*******************************************************************
// Copyright (C) 2002 ImageLinks Inc.
//
// License: MIT
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
......@@ -54,7 +54,7 @@ int main(int argc, char* argv[])
argumentParser.getApplicationUsage()->setApplicationName(argumentParser.getApplicationName());
argumentParser.getApplicationUsage()->setDescription(argumentParser.getApplicationName()+" merges band separate images to one image");
argumentParser.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
argumentParser.getApplicationUsage()->addCommandLineOption("-o or --create-overiew", "Creates and overview for the output image");
argumentParser.getApplicationUsage()->addCommandLineOption("-o or --create-overview", "Creates and overview for the output image");
argumentParser.getApplicationUsage()->addCommandLineOption("-w or --tile-width", "Defines the tile width for the handlers that support tiled output");
if (traceDebug()) CLOG << " Entered..." << std::endl;
......@@ -324,4 +324,3 @@ void outputWriterTypes()
}
std::cout << std::endl;
}