diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..a62a223 --- /dev/null +++ b/.appveyor.yml @@ -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 diff --git a/.gitignore b/.gitignore index 179fec7..53e827a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ solaris64_stlport/ solaris86/ win32/ *~ +*.o +*.so* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bf02b09 --- /dev/null +++ b/.travis.yml @@ -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 . diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..18d1a11 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/Makefile b/Makefile index a4a7118..444ef1e 100644 --- a/Makefile +++ b/Makefile @@ -58,4 +58,3 @@ doxygen:: echo "INPUT_FILTER = $(DOXYGEN_FILTER)" >> $(DOXYFILE) rm -rf $(DOXYGEN_OUT) cd $(dir $(DOXYFILE)) && doxygen - diff --git a/Makefile.mac b/Makefile.mac new file mode 100644 index 0000000..c06b3cf --- /dev/null +++ b/Makefile.mac @@ -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 diff --git a/Makefile.win32 b/Makefile.win32 index 7277704..e5ba44b 100644 --- a/Makefile.win32 +++ b/Makefile.win32 @@ -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) diff --git a/ModelIdentifier.h b/ModelIdentifier.h index b32790c..4bf5615 100644 --- a/ModelIdentifier.h +++ b/ModelIdentifier.h @@ -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 //< @@ -528,3 +528,4 @@ class CSM_EXPORT_API MIDescription } // namespace csm #endif + diff --git a/README b/README deleted file mode 100644 index ee1ddba..0000000 --- a/README +++ /dev/null @@ -1,20 +0,0 @@ -This is the Community Sensor Model base interface library. - -Compilation ------------ -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. - - -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..39bd419 --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/csm.h b/csm.h index 0a3bc8c..8149513 100644 --- a/csm.h +++ b/csm.h @@ -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. //< diff --git a/csmPointCloud.h b/csmPointCloud.h index a13544e..92358c8 100644 --- a/csmPointCloud.h +++ b/csmPointCloud.h @@ -27,11 +27,31 @@ #ifndef __CSM_CSM_POINT_CLOUD_H #define __CSM_CSM_POINT_CLOUD_H +#include #include + +// 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