view Resources/CMake/LibNiftiConfiguration.cmake @ 46:9b2a2fcc9878 nexus

added option to disable Nexus support
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Apr 2024 07:49:45 +0200
parents dd0cd39e6259
children
line wrap: on
line source

# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
# SPDX-License-Identifier: GPL-3.0-or-later

# STL plugin for Orthanc
# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
#
# This program 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 program 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/>.


if (STATIC_BUILD OR NOT USE_SYSTEM_NIFTILIB)
  set(NIFTILIB_SOURCES_DIR ${CMAKE_BINARY_DIR}/nifti_clib-3.0.0)
  DownloadPackage(
    "ee40068103775a181522166e435ee82d"
    "https://orthanc.uclouvain.be/downloads/third-party-downloads/nifti_clib-3.0.0.tar.gz"
    "${NIFTILIB_SOURCES_DIR}")

  include_directories(
    ${NIFTILIB_SOURCES_DIR}/niftilib
    ${NIFTILIB_SOURCES_DIR}/znzlib
    )

  add_definitions(
    -DHAVE_ZLIB=1
    )

  set(NIFTILIB_SOURCES
    ${NIFTILIB_SOURCES_DIR}/niftilib/nifti1_io.c
    ${NIFTILIB_SOURCES_DIR}/znzlib/znzlib.c
    )

else()
  find_path(NIFTILIB_INCLUDE_DIR
    NAMES nifti1.h
    PATHS
    /usr/include
    /usr/include/nifti
    /usr/local/include
    /usr/local/include/nifti
    )

  check_include_file(${NIFTILIB_INCLUDE_DIR}/nifti1.h HAVE_NIFTILIB_H)
  if (NOT HAVE_NIFTILIB_H)
    message(FATAL_ERROR "Please install the libnifti-dev package")
  endif()

  include_directories(${NIFTILIB_INCLUDE_DIR})

  link_libraries(niftiio znz)
endif()