• Thibault Hallouin's avatar
    propagate templates to probabilist Evaluator class · ee8e2ef0
    Thibault Hallouin authored
    This is required for the bindings, because the 2D views on 4D tensors
    must be on the correct type (i.e. pytensor/rtensor/xtensor). Although,
    casting of the views to become xtensor could have been used instead.
    
    In doing so, there is no source file to be compiled anymore, so this
    becomes a header-only library. But to keep the "public" headers separate
    from the implementation, a subdirectory "detail/" is added.
    ee8e2ef0
CMakeLists.txt 2.50 KiB
cmake_minimum_required(VERSION 3.15)
project(
        EvalHyd
        LANGUAGES CXX
        VERSION 0.0.1
        DESCRIPTION "Utility to evaluate streamflow predictions"
# ------------------------------------------------------------------------------
# dependencies
# ------------------------------------------------------------------------------
find_package(xtensor REQUIRED)
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
# ------------------------------------------------------------------------------
# build
# ------------------------------------------------------------------------------
# define evalhyd library
add_library(
        evalhyd
        INTERFACE
add_library(EvalHyd::evalhyd ALIAS evalhyd)
set_target_properties(
        evalhyd
        PROPERTIES
                VISIBILITY_INLINES_HIDDEN ON
target_include_directories(
        evalhyd
        INTERFACE
                $<INSTALL_INTERFACE:include>
                $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
target_link_libraries(
        evalhyd
        INTERFACE
                xtensor
target_compile_features(
        evalhyd
        INTERFACE
                cxx_std_14
# test suite
OPTION(EVALHYD_BUILD_TEST "configure and compile tests" ON)
if(EVALHYD_BUILD_TEST)
    add_subdirectory(tests)
endif()
# ------------------------------------------------------------------------------
# installation
# ------------------------------------------------------------------------------
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# install library file (.a/.so)
install(
        TARGETS evalhyd
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
EXPORT evalhyd-targets ) # install headers install( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/evalhyd" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.hpp" ) # generate target file export( EXPORT evalhyd-targets FILE "${CMAKE_CURRENT_BINARY_DIR}/EvalHydTargets.cmake" ) # install target file install( EXPORT evalhyd-targets FILE "EvalHydTargets.cmake" NAMESPACE EvalHyd:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EvalHyd ) # generate config file configure_package_config_file( EvalHydConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/EvalHydConfig.cmake" INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EvalHyd ) # install files install( FILES "${CMAKE_CURRENT_BINARY_DIR}/EvalHydConfig.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/EvalHyd" )