From aa6957eadf3016f83f9579a4b828a18a4c1757f3 Mon Sep 17 00:00:00 2001
From: Jesse Mapel <jmapel@usgs.gov>
Date: Mon, 6 Jul 2020 10:55:35 -0700
Subject: [PATCH] Updated build stuff and CI (#376)

* Updated build stuff and CI

* Appveyor is strange
---
 .appveyor.yml         |  4 ++--
 .travis.yml           |  4 ++--
 CMakeLists.txt        | 16 +++++++++-------
 cmake/config.cmake.in |  1 -
 environment.yml       |  2 +-
 recipe/bld.bat        |  1 +
 recipe/meta.yaml      |  2 +-
 setup.py              |  2 +-
 8 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/.appveyor.yml b/.appveyor.yml
index 13b2279..2fda45c 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -14,7 +14,7 @@ install:
   - conda config --set always_yes yes --set changeps1 no
   - conda update -q conda
   - conda install conda-build anaconda-client
-  - conda env create -n ale python=3.7.3
+  - conda env create -n ale
   - conda env update -f environment.yml -n ale
   - conda activate ale
 
@@ -24,7 +24,7 @@ before_build:
 
 build_script:
   - python ..\setup.py install
-  - cmake -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -G "Visual Studio 15 2017 Win64" -DALE_BUILD_TESTS=OFF ..
+  - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -G "Visual Studio 15 2017 Win64" -DALE_BUILD_TESTS=OFF ..
   - cmake --build . --target ALL_BUILD --config Release
 
 artifacts:
diff --git a/.travis.yml b/.travis.yml
index 8b4bddd..26de9b5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,7 +40,7 @@ install:
   - bash miniconda.sh -b -p $HOME/miniconda
   - export PATH="$HOME/miniconda/bin:$PATH"
   - conda config --set always_yes yes
-  - conda env create -n ale python=3.7.3
+  - conda env create -n ale
   - conda env update -f environment.yml -n ale
   - source activate ale
   - conda install pytest
@@ -50,7 +50,7 @@ script:
   - python setup.py install # install to use python lib in c code
   - mkdir -p build
   - cd build
-  - cmake -DCOVERAGE=ON ..
+  - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCOVERAGE=ON ..
   - cmake --build .
   - ctest -VV
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c5ab7e..3b80065 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,9 +5,9 @@
 # CMake initialization
 
 # Specify the required version of CMake.
-# cmake 3.10 required for ctest/gtest integration
-cmake_minimum_required(VERSION 3.10)
-project(ale VERSION 0.8.1 DESCRIPTION "Abstraction Library for Ephemerides ")
+# cmake 3.15 required for findPython virtualenv configuration
+cmake_minimum_required(VERSION 3.15)
+project(ale VERSION 0.8.2 DESCRIPTION "Abstraction Library for Ephemerides ")
 
 # include what we need
 include(GNUInstallDirs)
@@ -15,8 +15,8 @@ include(GNUInstallDirs)
 set(CMAKE_CXX_STANDARD 11)
 
 option(ALE_BUILD_LOAD "If the C++ Python load interface should be built." ON)
-option(ALE_USE_EXTERNAL_JSON "If an external nlohmann JSON library should be used" OFF)
-option(ALE_USE_EXTERNAL_EIGEN "If an external EIGEN library should be used" OFF)
+option(ALE_USE_EXTERNAL_JSON "If an external nlohmann JSON library should be used" ON)
+option(ALE_USE_EXTERNAL_EIGEN "If an external EIGEN library should be used" ON)
 
 # Third Party Dependencies
 if(ALE_USE_EXTERNAL_JSON)
@@ -38,8 +38,10 @@ endif()
 if(ALE_BUILD_LOAD)
   # If there is an Anaconda environment activated, search that for Python first
   if(EXISTS $ENV{CONDA_PREFIX})
-    message("Searching $ENV{CONDA_PREFIX} for Python libraries")
-    set(Python_ROOT_DIR $ENV{CONDA_PREFIX})
+    message("Searching Anaconda environment at $ENV{CONDA_PREFIX} for Python libraries")
+    set(Python_FIND_VIRTUALENV FIRST)
+    set(Python_FIND_REGISTRY LAST)
+    set(Python_FIND_FRAMEWORK LAST)
     set(Python_FIND_STRATEGY LOCATION)
   endif()
   find_package(Python REQUIRED COMPONENTS Development)
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index 82500f6..c223d95 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -3,6 +3,5 @@ set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
 find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)
 
 if(NOT TARGET @PROJECT_NAME@::ale)
-    find_package(nlohmann_json REQUIRED)
     include("${CMAKE_CURRENT_LIST_DIR}/aleTargets.cmake")
 endif()
diff --git a/environment.yml b/environment.yml
index 9d26978..712eaef 100644
--- a/environment.yml
+++ b/environment.yml
@@ -4,7 +4,7 @@ channels:
   - default
 
 dependencies:
-  - cmake>=3.10
+  - cmake>=3.15
   - pytest
   - eigen
   - jupyter
diff --git a/recipe/bld.bat b/recipe/bld.bat
index 21e7e72..f39eff7 100644
--- a/recipe/bld.bat
+++ b/recipe/bld.bat
@@ -4,6 +4,7 @@ cd build
 cmake   -GNinja ^
         -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ^
         -DALE_BUILD_TESTS=OFF ^
+        -DCMAKE_BUILD_TYPE=Release ^
         -DCMAKE_INSTALL_PREFIX="%PREFIX%" ^
         -DCMAKE_INSTALL_LIBDIR="%LIBRARY_LIB%" ^
         -DCMAKE_INSTALL_INCLUDEDIR="%LIBRARY_INC%" ^
diff --git a/recipe/meta.yaml b/recipe/meta.yaml
index 40808ab..8419348 100644
--- a/recipe/meta.yaml
+++ b/recipe/meta.yaml
@@ -15,7 +15,7 @@ build:
 
 requirements:
   build:
-    - cmake>=3.10
+    - cmake>=3.15
     - eigen
   host:
     - pip
diff --git a/setup.py b/setup.py
index bb71daa..5b1c1ee 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ import sys
 from setuptools import setup, find_packages
 
 NAME = "Ale"
-VERSION = "0.8.1"
+VERSION = "0.8.2"
 
 # To install the library, run the following
 #
-- 
GitLab