Unverified Commit 06db3fb4 authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Updating build to allow for building all dependencies (#296)

* Testing new build

* Now with 100% more lib files

* Typo fix

* Added ALE artifact to CI
parent d168ad0d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -22,12 +22,14 @@ before_build:
  - cd build

build_script:
  - cmake -G "Visual Studio 15 2017 Win64" -DUSGSCSM_BUILD_TESTS=OFF ..
  - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DUSGSCSM_BUILD_TESTS=OFF ..
  - cmake --build . --target ALL_BUILD --config Release

artifacts:
  - path: build\Release\usgscsm.dll
    name: usgscsm.dll
  - path: build\Release\ale.dll
    name: ale.dll

on_success:
- cd ../
+6 −0
Original line number Diff line number Diff line
@@ -4,3 +4,9 @@
[submodule "csm"]
	path = csm
	url = https://github.com/USGS-Astrogeology/csm
[submodule "ale"]
	path = ale
	url = https://github.com/USGS-Astrogeology/ale.git
[submodule "json"]
	path = json
	url = https://github.com/nlohmann/json.git
+3 −4
Original line number Diff line number Diff line
@@ -39,14 +39,13 @@ install:
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - source $HOME/miniconda/etc/profile.d/conda.sh
  - conda install -y -c conda-forge cmake ale nlohmann_json
  - conda env create -n usgscsm -f environment.yml

script:
  - conda activate
  - ls $CONDA_PREFIX/include/ale
  - conda activate usgscsm
  - mkdir build
  - cd build
  - cmake -DCOVERAGE=ON ..
  - cmake -DUSGSCSM_EXTERNAL_DEPS=ON -DCOVERAGE=ON ..
  - cmake --build .
  - ctest -VV
  - cd ..
+37 −21
Original line number Diff line number Diff line
@@ -13,24 +13,43 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
      STRING "Choose the type of build." FORCE)
endif()

# Optional build or link against CSM
option (BUILD_CSM "Build the CSM library" ON)
if(BUILD_CSM)
  add_subdirectory(csm)
  set(CSM_INCLUDE_DIR /csm)
  set(CSM_LIBRARY csmapi)
else()
# Use external or embedded dependencies
option(USGSCSM_EXTERNAL_DEPS "If the library should be built with external or embedded dependencies" OFF)

if(USGSCSM_EXTERNAL_DEPS)
  # CSM API library
  find_path(CSM_INCLUDE_DIR NAMES "csm.h"
                            PATH_SUFFIXES "csm"
                            PATHS $ENV{CONDA_PREFIX}/include/)
  find_library(CSM_LIBRARY csmapi PATHS $ENV{CONDA_PREFIX}/lib)
  message("--Found external CSM Library: ${CSM_LIBRARY}")
  message("--Found external CSM Include Directory: ${CSM_INCLUDE_DIR}")

  message("--Found CSM Library: ${CSM_LIBRARY}")
  message("--Found CSM Include Directory: ${CSM_INCLUDE_DIR}")
endif(BUILD_CSM)

  # Nlohmann JSON
  find_package(nlohmann_json REQUIRED)

  # ALE
  find_package(ale REQUIRED)
  set(ALE_TARGET ale::ale)
else()
  # CSM API library
  add_subdirectory(csm)
  set(CSM_INCLUDE_DIR /csm)
  set(CSM_LIBRARY csmapi)

  # Nlohmann JSON
  set(JSON_BuildTests OFF CACHE INTERNAL "")
  add_subdirectory(json)

  # ALE
  set(ALE_USE_EXTERNAL_EIGEN OFF)
  set(ALE_USE_EXTERNAL_JSON ON)
  set(ALE_BUILD_LOAD OFF)
  set(ALE_BUILD_TESTS OFF)
  add_subdirectory(ale)
  set(ALE_TARGET ale)
endif(USGSCSM_EXTERNAL_DEPS)


add_library(usgscsm SHARED
            src/UsgsAstroPlugin.cpp
@@ -56,18 +75,15 @@ target_include_directories(usgscsm

target_link_libraries(usgscsm
                      ${CSM_LIBRARY}
                      ale::ale
                      ${ALE_TARGET}
                      nlohmann_json::nlohmann_json)

if(WIN32)
  install(TARGETS usgscsm RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()

install(TARGETS usgscsm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(DIRECTORY ${USGSCSM_INCLUDE_DIRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})


# Optional build or link against CSM
# Optional build tests
option (USGSCSM_BUILD_TESTS "Build tests" ON)
if(USGSCSM_BUILD_TESTS)

Original line number Diff line number Diff line
Subproject commit 37bb560ac6a5327063f6c36d8259b3dbb6880bab
Loading