From 3cccbb5563853b81e96e0aefc4db43a529dc7c51 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 20 Jul 2023 07:56:47 +0200 Subject: [PATCH] Add AMICI_TRY_ENABLE_HDF5 env var (#2148) Add AMICI_TRY_ENABLE_HDF5 environment variable to disable trying to build with HDF5 support if HDF5 is found. Related to #2144 --- CMakeLists.txt | 12 ++++++++++-- documentation/python_installation.rst | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf0ff8fed..a763fbc301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,13 @@ cmake_minimum_required(VERSION 3.15) project(amici) # misc options +if(DEFINED ENV{AMICI_TRY_ENABLE_HDF5}) + option(AMICI_TRY_ENABLE_HDF5 "Build with HDF5 support if available?" + $ENV{AMICI_TRY_ENABLE_HDF5}) +else() + option(AMICI_TRY_ENABLE_HDF5 "Build with HDF5 support if available?" ON) +endif() option(AMICI_PYTHON_BUILD_EXT_ONLY "Build only the Python extension?" OFF) -option(AMICI_TRY_ENABLE_HDF5 "Build with HDF5 support if available?" ON) option(ENABLE_HDF5 "Build with HDF5 support?" OFF) option(SUNDIALS_SUPERLUMT_ENABLE "Enable sundials SuperLUMT?" OFF) option(EXPORT_PACKAGE "Export AMICI library to CMake package registry?" ON) @@ -324,7 +329,10 @@ if(HDF5_FOUND) target_link_libraries(${PROJECT_NAME} PUBLIC hdf5::hdf5_hl_cpp hdf5::hdf5_hl hdf5::hdf5_cpp hdf5::hdf5) else() - message(STATUS "HDF5 library NOT found. Building AMICI WITHOUT HDF5 support.") + message( + STATUS + "HDF5 support disabled or HDF5 library not found. Building AMICI WITHOUT HDF5 support." + ) endif() if(AMICI_PYTHON_BUILD_EXT_ONLY) diff --git a/documentation/python_installation.rst b/documentation/python_installation.rst index 55e53342c6..5332520139 100644 --- a/documentation/python_installation.rst +++ b/documentation/python_installation.rst @@ -295,6 +295,10 @@ environment variables: | | processes to be used for C(++) | | | | compilation (defaults to 1) | | +----------------------------+----------------------------------+---------------------------------+ +| ``AMICI_TRY_ENABLE_HDF5`` | Whether to build AMICI with | ``AMICI_TRY_ENABLE_HDF5=OFF`` | +| | HDF5-support if possible. | | +| | Default: ``ON`` | | ++----------------------------+----------------------------------+---------------------------------+ Installation under Anaconda ---------------------------