From 7302d240686b73a02f17ce273030150b349095f9 Mon Sep 17 00:00:00 2001 From: jay <jlaura@usgs.gov> Date: Thu, 9 Aug 2018 12:42:36 -0700 Subject: [PATCH] Adds conda build --- .travis.yml | 22 ++++++++++++++++++++++ python/CMakeLists.txt | 7 +++++-- recipe/build.sh | 5 +++++ recipe/meta.yaml | 23 +++++++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 .travis.yml create mode 100644 recipe/build.sh create mode 100644 recipe/meta.yaml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cf7700c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: generic + +os: + - linux + - osx + + 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.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh; + fi + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - conda install -y -c usgs-astrogeology libcsm + - conda install -y -c conda-forge cmake pytest + +script: + - .run_build.sh + - pytest tests diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4addffd..9b0fe30 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -7,8 +7,11 @@ set(CMAKE_SWIG_FLAGS "") set_source_files_properties(../csmapi.i PROPERTIES CPLUSPLUS ON) -find_path(CSM_INCLUDE_DIR NAMES csm.h PATH_SUFFIXES csm) -find_library(CSM_LIBRARY NAMES csmapi) +find_path(CSM_INCLUDE_DIR NAMES csm.h + PATH_SUFFIXES csm + PATHS $ENV{CONDA_PREFIX}/include) +find_library(CSM_LIBRARY NAMES csmapi + PATHS $ENV{CONDA_PREFIX}/lib) include_directories(${CSM_INCLUDE_DIR}) diff --git a/recipe/build.sh b/recipe/build.sh new file mode 100644 index 0000000..c789abd --- /dev/null +++ b/recipe/build.sh @@ -0,0 +1,5 @@ +source activate base +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. +make +python python/setup.py install \ No newline at end of file diff --git a/recipe/meta.yaml b/recipe/meta.yaml new file mode 100644 index 0000000..c619929 --- /dev/null +++ b/recipe/meta.yaml @@ -0,0 +1,23 @@ +package: + name: csmwrapper + version: "0.1.0" + +source: + git_url: https://github.com/USGS-Astrogeology/CSM-Swig.git + +requirements: + build: + - {{ compiler('cxx') }} + - cmake >=3.10 + - libcsm + +test: + commands: + - import csmapi + - import csmapi.Isd + + +about: + home: https://github.com/USGS-Astrogeology/CSM-Swig + license: None +summary: "SWIG Wrapper to generate bindings to the Community Sensor Model" \ No newline at end of file -- GitLab