BARTConfig.cmake.in 3.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# Copyright 2018. Damien Nguyen <damien.nguyen@alumni.epfl.ch>
# All rights reserved. Use of this source code is governed by
# a BSD-style license which can be found in the LICENSE file.
# \author Damien Nguyen <damien.nguyen@alumni.epfl.ch>

@PACKAGE_INIT@

set(BART_ENABLE_MEM_CFL @BART_ENABLE_MEM_CFL@)
set(BART_FPIC @BART_FPIC@)
set(BART_FFTWTHREADS @BART_FFTWTHREADS@)
set(BART_DISABLE_PNG @BART_DISABLE_PNG@)
set(BART_ISMRMRD @BART_ISMRMRD@)
set(BART_LOCAL_FFTW @BART_LOCAL_FFTW@)
set(BART_LOG_BACKEND @BART_LOG_BACKEND@)
set(BART_LOG_SIEMENS_BACKEND @BART_LOG_SIEMENS_BACKEND@)
set(BART_LOG_ORCHESTRA_BACKEND @BART_LOG_ORCHESTRA_BACKEND@)
set(BART_LOG_GADGETRON_BACKEND @BART_LOG_GADGETRON_BACKEND@)
set(BART_NO_LAPACKE @BART_NO_LAPACKE@)
set(BART_MATLAB @BART_MATLAB@)
set(BART_MEMONLY_CFL @BART_MEMONLY_CFL@)
set(BART_USE_CUDA @USE_CUDA@)
22
set(BART_USE_NATIVE_CUDA @BART_USE_NATIVE_CUDA@)
23 24 25 26 27 28 29 30 31 32
set(BART_USE_OPENMP @USE_OPENMP@)
set(BART_REDEFINE_PRINTF_FOR_TRACE @BART_REDEFINE_PRINTF_FOR_TRACE@)

set(BART_LINALG_VENDOR "@LINALG_VENDOR@")
set(LINALG_VENDOR "@LINALG_VENDOR@")

# ------------------------------------------------------------------------------

get_filename_component(BART_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

33 34 35 36
list(INSERT CMAKE_MODULE_PATH 0 ${BART_CMAKE_DIR})

include(CMakeFindDependencyMacro)

37
include(${BART_CMAKE_DIR}/BARTFindBLASlib.cmake)
38 39 40 41 42 43

if(BART_ISMRMRD)
  find_dependency(ISMRMRD)
endif()

if(NOT BART_LOCAL_FFTW)
44
  if(CMAKE_VERSION VERSION_LESS 3.9)
45
    find_package(FFTW 3 REQUIRED COMPONENTS FFTWF FFTWF_MT)
46 47
  else()
    find_dependency(FFTW 3 COMPONENTS FFTWF FFTWF_MT)
48 49 50 51 52 53 54
  endif()
else()
  find_dependency(Threads)
endif()

if(NOT BART_DISABLE_PNG)
  find_dependency(PNG)
55 56 57 58 59 60 61 62 63 64
  if(CMAKE_VERSION VERSION_LESS 3.5)
    add_library(PNG::PNG SHARED IMPORTED GLOBAL)
    set_target_properties(PNG::PNG
      PROPERTIES
      IMPORTED_LOCATION "${PNG_LIBRARY}"
      INTERFACE_DEFINITIONS "${PNG_DEFINITIONS}"
      INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}"
      INTERFACE_LINK_LIBRARIES "${PNG_LIBRARIES}"
      )
  endif()
65 66
endif()

67 68 69 70 71 72 73 74 75 76 77 78
if(BART_USE_OPENMP)
  if(CMAKE_VERSION VERSION_LESS 3.11)
    # Actually CMake 3.9 should be enough for OpenMP::OpenMP support,
    # however, until CMake 3.11 we might get problems with the
    # INTERFACE_COMPILE_OPTIONS property if we are compiling with
    # CMake's native CUDA compilation
    find_package(BOpenMP REQUIRED) # BOpenMP is FindOpenMP.cmake from 3.12
  else()
    find_package(OpenMP REQUIRED)
  endif()
endif()

79
if(BART_USE_NATIVE_CUDA)
80
  find_dependency(CUDAlibs COMPONENTS CUBLAS CUFFT)
81 82 83
endif()

list(REMOVE_AT CMAKE_MODULE_PATH 0)
84 85 86 87 88 89 90 91 92 93 94 95 96

# ==============================================================================

set_and_check(BARTTargetForEmbedding "${BART_CMAKE_DIR}/BARTTargetsForEmbedding.cmake")
include(${BARTTargetForEmbedding})

set(BARTTargetGeneral "${BART_CMAKE_DIR}/BARTTargets.cmake")
if(NOT TARGET BART::BART AND EXISTS ${BARTTargetGeneral})
  include(${BARTTargetGeneral})
endif()

# ==============================================================================