Saving.cmake 4.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
###########################################################################
# This file is part of LImA, a Library for Image Acquisition
#
#  Copyright (C) : 2009-2017
#  European Synchrotron Radiation Facility
#  BP 220, Grenoble 38043
#  FRANCE
#
#  Contact: lima@esrf.fr
#
#  This is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This software is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################

set(saving_definitions)
set(saving_libs)
set(saving_private_libs)
set(saving_includes)

if(LIMA_ENABLE_EDFGZ)
  find_package(ZLIB)
  if(${ZLIB_FOUND})
    list(APPEND saving_definitions -DWITH_Z_COMPRESSION)
    list(APPEND saving_libs ${ZLIB_LIBRARIES})
    list(APPEND saving_includes ${ZLIB_INCLUDE_DIRS})
    else()
    message(FATAL_ERROR "ZLIB library not found, please install or disable LIMA_ENABLE_EDFGZ")
  endif()
endif()

if(LIMA_ENABLE_EDFLZ4)
  find_package(LZ4)
  if (${LZ4_FOUND})
    list(APPEND saving_definitions -DWITH_LZ4_COMPRESSION)
    list(APPEND saving_libs ${LZ4_LIBRARIES})
  	list(APPEND saving_includes ${LZ4_INCLUDE_DIRS})
  else()
    message(FATAL_ERROR "LZ4 library: required version = 1.8.2, please update or switch off LIMA_ENABLE_EDFLZ4")
  endif()
endif()

if(LIMA_ENABLE_CBF)
  find_package(CBF)
  if (${CBF_FOUND})
    list(APPEND saving_definitions -DWITH_CBF_SAVING)
    list(APPEND saving_definitions -DPROTOTYPES)
    list(APPEND control_srcs control/src/CtSaving_Cbf.cpp)
    list(APPEND saving_libs ${CBF_LIBRARIES} crypto)
    list(APPEND saving_includes ${CBF_INCLUDE_DIRS})
  else()
    message(FATAL_ERROR "CBF library not found, please install or disable LIMA_ENABLE_CBF")
  endif()
endif()

if(LIMA_ENABLE_FITS)
  find_package(CCFits)
  if(${CCFITS_FOUND})
    list(APPEND saving_definitions -DWITH_FITS_SAVING)
    list(APPEND control_srcs control/src/CtSaving_Fits.cpp)
    list(APPEND saving_libs ${CFITSIO_LIBRARY} ${CCFITS_LIBRARY})
    list(APPEND saving_includes ${CFITSIO_INCLUDE_DIR})
  else()
    message(FATAL_ERROR "CFITSIO and/or CCFITS library not found, please install or disable LIMA_ENABLE_FITS")
  endif()
endif()

if(LIMA_ENABLE_HDF5)
  #set (HDF5_USE_STATIC_LIBRARIES ON)
  find_package(HDF5 COMPONENTS CXX HL)
  if(${HDF5_FOUND})
    list(APPEND saving_definitions -DWITH_HDF5_SAVING ${HDF5_DEFINITIONS})
    list(APPEND control_srcs control/src/CtSaving_Hdf5.cpp)
    list(APPEND saving_libs ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${LIB_SZIP} ${LIB_ZLIB})
    list(APPEND saving_includes ${HDF5_INCLUDE_DIRS})
  else()
    message(FATAL_ERROR "HDF5 library not found, please install or disable LIMA_ENABLE_HDF5")
  endif()

  if(LIMA_ENABLE_HDF5_BS)
    #set(BITSHUFFLE_EXTERNALLY_CONFIGURED ON)
    add_subdirectory(control/bitshuffle)

    list(APPEND saving_definitions -DWITH_BS_COMPRESSION)
    list(APPEND saving_includes ${CMAKE_CURRENT_SOURCE_DIR}/third-party/bitshuffle/src)
    list(APPEND saving_private_libs h5bshuf_static)

    # set(LIB_BS_INCLUDE_DIR "/usr/local/include/" CACHE PATH "Path to BitShuffle include files")
    # link_directories(${LIB_HDF5_PLUGIN})
    # find_library(LIB_HDF5_BS h5bshuf ${LIB_HDF5_PLUGIN})
    # find_path(LIB_BS_INCLUDE_DIR bitshuffle.h)
    # list(APPEND saving_libs ${LIB_HDF5_BS})
    # list(APPEND saving_includes ${LIB_BS_INCLUDE_DIR})
  endif()
endif()

if(LIMA_ENABLE_NXS)
  find_package(NXS)
  if(${NXS_FOUND})
    list(APPEND saving_definitions -DWITH_NXS_SAVING)
    list(APPEND control_srcs control/src/CtSaving_NXS.cpp)
    list(APPEND saving_includes ${NXS_INCLUDE_DIRS})
    list(APPEND saving_libs ${NXS_LIBRARIES})
  else()
    message(FATAL_ERROR "NEXUS cpp library not installed, please install or disable LIMA_ENABLE_NXS")
  endif()
endif()

if(LIMA_ENABLE_TIFF)
  find_package(TIFF)
  if(${TIFF_FOUND})
    list(APPEND saving_definitions -DWITH_TIFF_SAVING)
    list(APPEND control_srcs control/src/CtSaving_Tiff.cpp)
    list(APPEND saving_libs ${TIFF_LIBRARIES})
    list(APPEND saving_includes ${TIFF_INCLUDE_DIRS})
  else()
    message(FATAL_ERROR "TIFF library not found, please install or disable LIMA_ENABLE_TIFF")
  endif()
endif()