Skip to content

Commit

Permalink
Merge with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarkramer committed May 26, 2020
2 parents d79503f + a8cfd0b commit 459eac1
Show file tree
Hide file tree
Showing 46 changed files with 3,656 additions and 1,612 deletions.
66 changes: 57 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
PROJECT(ossim)
############################################################
# From https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
#
# Use, don't skip, the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# When building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")
#################################################################



SET(CMAKE_MODULE_PATH "${${PROJECT_NAME}_SOURCE_DIR}/cmake/CMakeModules;${CMAKE_MODULE_PATH}")

set(CMAKE_CXX_STANDARD 11)
Expand All @@ -23,6 +48,7 @@ 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_HDF5_SUPPORT "Set to ON to build OSSIM with HDF5 support. Use OFF to turn off HDF5 support." OFF)
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)

Expand All @@ -48,6 +74,7 @@ CHECK_INCLUDE_FILE("dlfcn.h" CMAKE_HAVE_DLFCN_H)
include_directories( ${PROJECT_SOURCE_DIR}/include )
include_directories( ${PROJECT_BINARY_DIR}/include )
include_directories( ${OSSIM_INCLUDE_DIR} )
include_directories( ${OSSIM_INCLUDE_DIR}/ossim )

# Stores list of libs to link with. Initialized throughout.
set( ossimDependentLibs )
Expand Down Expand Up @@ -105,15 +132,16 @@ endif( TIFF_FOUND )

# JSONCPP - Required. This will use the amalgamated form embedded in OSSIM. If an previously
# installed JSONCPP package is preferred, add "-DUSE_OSSIM_JSONCPP=OFF" to the cmake command
find_package( JsonCpp )
if( JSONCPP_FOUND )
include_directories( ${JSONCPP_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JSONCPP_LIBRARY} )
message("-- Found JsonCpp: ${JSONCPP_INCLUDE_DIR}" )
else( JSONCPP_FOUND )
message( FATAL_ERROR "Could not find required JsonCpp package!" )
endif( JSONCPP_FOUND )

if(NOT USE_OSSIM_JSONCPP)
find_package( JsonCpp )
if(JSONCPP_FOUND )
include_directories( ${JSONCPP_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JSONCPP_LIBRARY} )
message("-- Found JsonCpp: ${JSONCPP_INCLUDE_DIR}" )
else( JSONCPP_FOUND )
message( FATAL_ERROR "Could not find required JsonCpp package!" )
endif( JSONCPP_FOUND )
endif(NOT USE_OSSIM_JSONCPP)
# 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 )
Expand Down Expand Up @@ -153,7 +181,11 @@ set( OSSIM_HAS_MPI 0 )
if( BUILD_OSSIM_MPI_SUPPORT )
find_package(MPI)
if ( MPI_FOUND )
# /usr/share/cmake/Modules/FindMPI.cmae are not consistent in terminology,
# so we include multiple list names, knowing some will be empty
include_directories( ${MPI_INCLUDE_DIR} )
include_directories( ${MPI_CXX_INCLUDE_PATH} ${MPI_CXX_INCLUDE_DIRS} )
include_directories( ${MPI_C_INCLUDE_PATH} ${MPI_C_INCLUDE_DIRS} )
set( ossimDependentLibs ${ossimDependentLibs} ${MPI_LIBRARIES} )
set( OSSIM_HAS_MPI 1 )
else ( MPI_FOUND )
Expand Down Expand Up @@ -204,9 +236,25 @@ if ( NOT ${Project_WC_REVISION} EQUAL 0 )
set( OSSIM_GIT_REVISION_NUMBER ${Project_WC_REVISION} )
endif()



#####################################################################################
# Call the configure files for ossimConfig and ossimVersion setup
#####################################################################################
include(CheckTypeSize)
check_type_size("short int" SIZE_OF_SHORT_INT)
check_type_size("int" SIZE_OF_INT)
check_type_size("long" SIZE_OF_LONG)
check_type_size("long long" SIZE_OF_LONG_LONG)
check_type_size("float" SIZE_OF_FLOAT)
check_type_size("double" SIZE_OF_DOUBLE)
check_type_size("long double" SIZE_OF_LONG_DOUBLE)

check_type_size("unsigned short int" SIZE_OF_UNSIGNED_SHORT_INT)
check_type_size("unsigned int" SIZE_OF_UNSIGNED_INT)
check_type_size("unsigned long" SIZE_OF_UNSIGNED_LONG)
check_type_size("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG)

set(OSSIM_VERSION_NUMBER "\"${OSSIM_VERSION}\"")
set(OSSIM_BUILD_DATE "\"${OSSIM_BUILD_DATE}\"")
set(OSSIM_REVISION "\"${OSSIM_GIT_REVISION_NUMBER}\"")
Expand Down
31 changes: 1 addition & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ properties([
])

node ("${BUILD_NODE}"){
env.WORKSPACE = pwd()

try {
stage( "Download Artifacts" ) {
Expand Down Expand Up @@ -124,36 +125,6 @@ node ("${BUILD_NODE}"){
archiveArtifacts "artifacts/*"
}

if (SCAN_WITH_SONARQUBE == "true" ) {
stage( 'SonarQube analysis' ) {
withSonarQubeEnv( "${ SONARQUBE_NAME }" ) {
// requires SonarQube Scanner for Gradle 2.1+
// It's important to add --info because of SONARJNKNS-281
sh "sonar-scanner"
}
}
}

if ( BUILD_WITH_FORTIFY == "true" ) {
stage( 'Fortify SCA' ) {
dir( "${ env.WORKSPACE }/build" ) {
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
sourceanalyzer -64 -b ossimlabs -scan -f fortifyResults-ossim.fpr
"""
archiveArtifacts "fortifyResults-ossim.fpr"
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'fortifyCredentials',
usernameVariable: 'HP_FORTIFY_USERNAME',
passwordVariable: 'HP_FORTIFY_PASSWORD']]) {
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
fortifyclient -url ${ HP_FORTIFY_URL } -user "${ HP_FORTIFY_USERNAME }" -password "${ HP_FORTIFY_PASSWORD }" uploadFPR -file fortifyResults-ossim.fpr -project ossim -version 1.0
"""
}
}
}
}
}
finally {
stage( "Clean Workspace" ) {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Jenkins Build Status

Resource | *master* | *dev* |
------------ | ------------- | -------------
OSSIM Build Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-dev&style=plastic)
Expand Down
116 changes: 116 additions & 0 deletions include/ossim/base/KwlNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#ifndef ossimKwlNode_HEADER
#define ossimKwlNode_HEADER
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimKeywordlist.h>
#include <map>
#include <memory>
namespace ossim
{
class KwlNode
{
public:
typedef std::map<ossimString, std::shared_ptr<KwlNode> > ChildMap;

KwlNode(const ossimString &key = ossimString(),
const ossimString &value = ossimString())
: m_key(key),
m_value(value),
m_isArray(false)
{
}

void setKey(const ossimString &key)
{
m_key = key;
}
void setValue(const ossimString &value)
{
m_value = value;
}
void setArrayFlag(bool flag)
{
m_isArray = flag;
}
const ossimString getKey() const
{
return m_key;
}
const ossimString getValue() const
{
return m_value;
}

const ChildMap &getChildren() const
{
return m_children;
}
ChildMap &getChildren()
{
return m_children;
}
const ChildMap &getAttributes() const
{
return m_attributes;
}
ChildMap &getAttributes()
{
return m_attributes;
}
bool hasChildren() const
{
return !m_children.empty();
}
bool hasAttributes() const
{
return !m_attributes.empty();
}
bool getIsArray() const
{
return m_isArray;
}
std::shared_ptr<KwlNode> findChild(const ossimString &key)
{
return findChild(m_children, key);
}
std::shared_ptr<const KwlNode> findChild(const ossimString &key) const
{
return findChild(m_children, key);
}

std::shared_ptr<KwlNode> findAttribute(const ossimString &key)
{
return findChild(m_attributes, key);
}

std::shared_ptr<const KwlNode> findAttribute(const ossimString &key) const
{
return findChild(m_attributes, key);
}
static std::shared_ptr<KwlNode> createTree(const ossimKeywordlist &kwl,
const ossimString &rootTag = ossimString(""));

protected:
ossimString m_key;
ossimString m_value;

ChildMap m_children;
ChildMap m_attributes;
bool m_isArray;

static std::shared_ptr<KwlNode> findChild(ChildMap &childMap,
const ossimString &key);

static std::shared_ptr<const KwlNode> findChild(const ChildMap &childMap,
const ossimString &key);
bool checkIfAttribute(const ossimString &value)const;
bool checkIfArray(const ossimString &value)const;
void extractKeyAndIndex(const ossimString &value,
ossimString &key,
ossimString &idx)const;
void loadPath(std::vector<ossimString> &q, const ossimString &value);
void addOrSetAttribute(const ossimString &key, const ossimString &value);
void loadPath(const ossimString &key, const ossimString &value);
};
} // namespace ossim

#endif
52 changes: 52 additions & 0 deletions include/ossim/base/KwlNodeFormatter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef ossimKwlNodeFormatter_HEADER
#define ossimKwlNodeFormatter_HEADER
#include <ossim/base/KwlNode.h>

namespace ossim
{
class KwlNodeFormatter
{
public:
class FormatHints
{
public:
enum FormatFlags
{
FORMAT_HINTS_NO_OPTION_FLAGS = 0,
FORMAT_HINTS_PRETTY_PRINT_FLAG = 1,
FORMAT_HINTS_OUTPUT_DOCUMENT_HEADER_FLAG = 2,
FORMAT_HINTS_UPCASE_PARENT_TAGS_FLAG = 4,
FORMAT_HINTS_ALL = (FORMAT_HINTS_PRETTY_PRINT_FLAG | FORMAT_HINTS_OUTPUT_DOCUMENT_HEADER_FLAG | FORMAT_HINTS_UPCASE_PARENT_TAGS_FLAG)
};
FormatHints(ossim_uint32 indent = 3,
FormatFlags formatFlags = FORMAT_HINTS_NO_OPTION_FLAGS)
: m_indent(indent),
m_formatFlags(formatFlags)
{
}
ossim_uint32 indent()const { return m_indent; }
void setIndent(ossim_uint32 indent) { m_indent = indent; }
bool prettyPrint() const { return m_formatFlags & FORMAT_HINTS_PRETTY_PRINT_FLAG; }
bool outputDocumentHeader() const { return m_formatFlags & FORMAT_HINTS_OUTPUT_DOCUMENT_HEADER_FLAG; }
bool upcaseParentTag() const { return m_formatFlags & FORMAT_HINTS_UPCASE_PARENT_TAGS_FLAG; }
void setFormatFlags(FormatFlags flags) { m_formatFlags = flags;}
FormatFlags getFormatFlags()const { return m_formatFlags;}
protected:
ossim_uint32 m_indent;
FormatFlags m_formatFlags;
};
KwlNodeFormatter(std::shared_ptr<KwlNode> kwlNode) : m_kwlNode(kwlNode)
{
}
KwlNodeFormatter(const ossimKeywordlist &kwl)
{
m_kwlNode = KwlNode::createTree(kwl);
}
virtual void write(ossimString &result, const FormatHints &hints = FormatHints()) const;
virtual void write(std::ostream &out, const FormatHints &hints = FormatHints()) const = 0;

protected:
std::shared_ptr<KwlNode> m_kwlNode;
};
}
#endif
Loading

0 comments on commit 459eac1

Please sign in to comment.