Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usgs Astro CSM Code Changes #30

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.0.3.{build}'

image: Visual Studio 2017

platform:
- x64

configuration:
- Release

install:
- call C:\\Miniconda36-x64\Scripts\activate.bat
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda create -n csm
- conda install -c conda-forge cmake
- conda activate csm

before_build:
- mkdir build
- cd build

build_script:
- cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Visual Studio 15 2017 Win64" ..
- cmake --build . --target ALL_BUILD --config Release

artifacts:
- path: build\Release\csmapi.dll
name: csmapi.dll
- path: build\Release\csmapi.lib
name: csmapi.lib
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ solaris64_stlport/
solaris86/
win32/
*~
*.o
*.so*
48 changes: 48 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
language: cpp
sudo: false

branches:
only:
- master

matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- MATRIX_EVAL="CXX=g++-7 && CC=gcc-7"
- os: osx
osx_image: xcode9.4
env:
- MATRIX_EVAL="CXX=clang++ && CC=clang"

before_install:
- echo "$TRAVIS_PULL_REQUEST"
- eval "${MATRIX_EVAL}"

install:
# Install a supported cmake version (>= 3.10)
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
else
curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda config --set always_yes yes
- conda update -q conda
- conda create -n csm
- conda activate csm
- conda install -c conda-forge cmake

script:
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=RELEASE ..
- cmake --build .
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.10)
project(csmapi VERSION 3.0.3 DESCRIPTION "Community Sensor Model API")

add_library(csmapi SHARED
BundleGM.cpp
CorrelationModel.cpp
csmPointCloud.cpp
Ellipsoid.cpp
FourParameterCorrelationModel.cpp
GeometricModel.cpp
Isd.cpp
LinearDecayCorrelationModel.cpp
ModelIdentifier.cpp
Plugin.cpp
PointCloudGM.cpp
PointCloudIsd.cpp
RasterGM.cpp
SettableEllipsoid.cpp
Version.cpp
)

file(GLOB HEADER_FILES ${PROJECT_SOURCE_DIR}/*.h)
set_target_properties(csmapi PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 3
PUBLIC_HEADER "${HEADER_FILES}"
)

target_include_directories(csmapi PUBLIC ${PROJECT_SOURCE_DIR})

set(WINDOWS_EXPORT_ALL_SYMBOLS ON)

message(STATUS "CMAKE INSTALL LIBDIR: ${CMAKE_INSTALL_PREFIX}")
install(TARGETS csmapi LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/csm)
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ doxygen::
echo "INPUT_FILTER = $(DOXYGEN_FILTER)" >> $(DOXYFILE)
rm -rf $(DOXYGEN_OUT)
cd $(dir $(DOXYFILE)) && doxygen

15 changes: 15 additions & 0 deletions Makefile.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include Makefile

CC=clang++

LIBRARY=$(LIBNAME).dylib.$(LIBVERSION)

COPTS=-fPIC -O2 -m64 -Wall -stdlib=libc++ -std=c++11
LDOPTS=-dynamiclib -Wl,-install_name,@rpath/$(LIBRARY)
INSTDIR=$(PWD)/mac

clean::
$(RM) $(OBJS) $(LIBRARY) *~

install::
$(RM) $(INSTDIR)/lib/$(LIBNAME).so && $(LN) $(LIBRARY) $(INSTDIR)/lib/$(LIBNAME).dylib
2 changes: 1 addition & 1 deletion Makefile.win32
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ $(LIBRARY): $(OBJS)
install::
$(RM) $(INSTDIR)/lib/$(LIBNAME).so
$(CP) $(LIBRARY:%.dll=%.lib) $(INSTDIR)/lib

$(CP) $(HEADERS) $(INSTDIR)/include/csm
clean::
$(RM) $(LIBRARY).manifest $(LIBRARY:%.dll=%.ldf) $(LIBRARY:%.dll=%.lib) $(LIBRARY:%.dll=%.exp)
3 changes: 2 additions & 1 deletion ModelIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class CSM_EXPORT_API RangeList
// of type INT_TYPE
//<
bool contains(double argValue) const;
//> This method determines if the specified integer is in the current
//> This method determines if the specified double is in the current
// range, which will only be true if the current data type is
// of type DOUBLE_TYPE
//<
Expand Down Expand Up @@ -528,3 +528,4 @@ class CSM_EXPORT_API MIDescription
} // namespace csm

#endif

20 changes: 0 additions & 20 deletions README

This file was deleted.

75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
This is the Community Sensor Model base interface library.

[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org)

About csm
=========

Compilation using make
----------------------
The CSM library can be compiled on Linux (tested on RHEL5) i386, x86_64, or IA-64, Solaris SPARC (32 or 64 bit, with or without the "stlport" mode) and x86, and Windows. Use the appropriate Makefile when building. For example:

make -f Makefile.linux64 all install clean

By default, the built files are placed in an architecture subdirectory in the build area. This allows multiple architectures to be built. To specify a different installation directory, set the INSTDIR make variable:

make -f Makefile.linux64 all install clean INSTDIR=/path/to/csm3/install/dir

Compiling makes a 'csmapi' shared library (libcsmapi.so.3.1.0 on UNIX, csmapi.dll on Windows). This library must be used when creating both CSM plugins and Sensor Exploitation Tools (SETs) that use CSM.

Building CSM Cmake
------------------
This repo uses a CMake based build configuration. Run CMake with the desired configurations and generator to configure your build. Then, run your build system or use cmake. For example:

```
mkdir build install
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=../install ..
cmake --build . --target install
```

will build the library in your `build` directory and install it and the headers into your `install` directory.

Windows
-------
Windows compilation requires the use of Cygwin to provide tools like 'make' and 'perl'. You should also be sure that Microsoft's Visual C++'s "cl.exe" is in your $PATH and that $INCLUDE and $LIB are set appropriately. When compiling on Windows, the "all" target does not do the right thing. Instead build with:

make -f Makefile.win32 csmapi.dll install clean

Package license: Public Domain

Feedstock license: BSD 3-Clause

Current build status
====================
[![Linux](https://img.shields.io/circleci/project/github/conda-forge/csm-feedstock/master.svg?label=Linux)](https://circleci.com/gh/conda-forge/csm-feedstock)
[![OSX](https://img.shields.io/travis/conda-forge/csm-feedstock/master.svg?label=macOS)](https://travis-ci.org/conda-forge/csm-feedstock)
[![Windows](https://img.shields.io/appveyor/ci/conda-forge/csm-feedstock/master.svg?label=Windows)](https://ci.appveyor.com/project/conda-forge/csm-feedstock/branch/master)

Current release info
====================

| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [![Conda Recipe](https://img.shields.io/badge/recipe-csm-green.svg)](https://anaconda.org/conda-forge/csm) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/csm.svg)](https://anaconda.org/conda-forge/csm) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/csm.svg)](https://anaconda.org/conda-forge/csm) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/csm.svg)](https://anaconda.org/conda-forge/csm) |

Installing csm via conda
========================

Installing `csm` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:

```
conda config --add channels conda-forge
```

Once the `conda-forge` channel has been enabled, `csm` can be installed with:

```
conda install csm
```

It is possible to list all of the versions of `csm` available on your platform with:

```
conda search csm --channel conda-forge
```
2 changes: 1 addition & 1 deletion csm.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ namespace csm
//***
// STRUCT: EcefCoord
//> This structure represents a three-dimensional location (x,y,z in meters)
// in the WGS-84 Earth Centered Earth Fixed (ECEF) coordinate system.
// in the Earth-Centered Earth-Fixed (ECEF) coordinate system.
// It typically represents an absolute coordinate; the EcefVector structure
// is used for velocity and direction vectors.
//<
Expand Down
24 changes: 22 additions & 2 deletions csmPointCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,31 @@
#ifndef __CSM_CSM_POINT_CLOUD_H
#define __CSM_CSM_POINT_CLOUD_H

#include <cstring>
#include <string>

// This include ensures that CURRENT_CSM_VERSION below isn't overwritten by
// csm.h.
#include "csm.h"

namespace csm
{
#ifdef _WIN32
# ifdef CSM_POINT_CLOUD_LIBRARY
# define CSM_POINT_CLOUD_EXPORT_API __declspec(dllexport)
# else
# define CSM_POINT_CLOUD_EXPORT_API __declspec(dllimport)
# endif
#elif LINUX_BUILD
# define CSM_POINT_CLOUD_EXPORT_API __attribute__ ((visibility("default")))
#else
# define CSM_POINT_CLOUD_EXPORT_API
#endif

// The getCsmVersion method should use CURRENT_CSM_VERSION to
// return the CSM API version that the sensor model/plugin was written to.
#undef CURRENT_CSM_VERSION
#define CURRENT_CSM_VERSION csm::Version(3, 0, 2);

namespace csm {
//***
// STRUCT: ModelCoord
//> This structure represents a three-dimensional location (m0,m1,m2 in
Expand Down