Commit bf21ee1e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add a FindHEIF cmake module

parent 132f4fcb
......@@ -532,6 +532,13 @@ set_package_properties(GIF PROPERTIES
TYPE OPTIONAL
PURPOSE "Required by the Krita GIF filter")
find_package(HEIF)
set_package_properties(HEIF PROPERTIES
DESCRIPTION "Library for loading and saving heif files."
URL "https://github.com/strukturag/libheif"
TYPE OPTIONAL
PURPOSE "Required by the Krita HEIF filter")
set(LIBRAW_MIN_VERSION "0.16")
find_package(LibRaw ${LIBRAW_MIN_VERSION})
set_package_properties(LibRaw PROPERTIES
......
......@@ -8,52 +8,52 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (NOT WIN32)
include(LibFindMacros)
libfind_pkg_check_modules(FFTW3_PKGCONF fftw3>=3.2)
find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
HINTS ${FFTW3_PKGCONF_INCLUDE_DIRS} ${FFTW3_PKGCONF_INCLUDEDIR}
PATH_SUFFIXES fftw3
)
find_library(FFTW3_LIBRARY
NAMES fftw3
HINTS ${FFTW3_PKGCONF_LIBRARY_DIRS} ${FFTW3_PKGCONF_LIBDIR}
)
set(FFTW3_PROCESS_LIBS FFTW3_LIBRARY)
set(FFTW3_PROCESS_INCLUDES FFTW3_INCLUDE_DIR)
libfind_process(FFTW3)
if(FFTW3_FOUND)
message(STATUS "FFTW Found Version: " ${FFTW_VERSION})
endif()
include(LibFindMacros)
libfind_pkg_check_modules(FFTW3_PKGCONF fftw3>=3.2)
find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
HINTS ${FFTW3_PKGCONF_INCLUDE_DIRS} ${FFTW3_PKGCONF_INCLUDEDIR}
PATH_SUFFIXES fftw3
)
find_library(FFTW3_LIBRARY
NAMES fftw3
HINTS ${FFTW3_PKGCONF_LIBRARY_DIRS} ${FFTW3_PKGCONF_LIBDIR}
)
set(FFTW3_PROCESS_LIBS FFTW3_LIBRARY)
set(FFTW3_PROCESS_INCLUDES FFTW3_INCLUDE_DIR)
libfind_process(FFTW3)
if(FFTW3_FOUND)
message(STATUS "FFTW Found Version: " ${FFTW_VERSION})
endif()
else()
# TODO: Maybe use fftw3/FFTW3Config.cmake?
# TODO: Maybe use fftw3/FFTW3Config.cmake?
find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
)
find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
)
find_library(
FFTW3_LIBRARY
NAMES libfftw3 libfftw3-3 libfftw3f-3 libfftw3l-3
DOC "Libraries to link against for FFT Support")
find_library(
FFTW3_LIBRARY
NAMES libfftw3 libfftw3-3 libfftw3f-3 libfftw3l-3
DOC "Libraries to link against for FFT Support")
if (FFTW3_LIBRARY)
set(FFTW3_LIBRARY_DIR ${FFTW3_LIBRARY})
endif()
if (FFTW3_LIBRARY)
set(FFTW3_LIBRARY_DIR ${FFTW3_LIBRARY})
endif()
set (FFTW3_LIBRARIES ${FFTW3_LIBRARY})
set (FFTW3_LIBRARIES ${FFTW3_LIBRARY})
if(FFTW3_INCLUDE_DIR AND FFTW3_LIBRARY_DIR)
set (FFTW3_FOUND true)
message(STATUS "Correctly found FFTW3")
else()
message(STATUS "Could not find FFTW3")
endif()
if(FFTW3_INCLUDE_DIR AND FFTW3_LIBRARY_DIR)
set (FFTW3_FOUND true)
message(STATUS "Correctly found FFTW3")
else()
message(STATUS "Could not find FFTW3")
endif()
endif()
# - Try to find the libheif library
# Once done this will define
#
# HEIF_FOUND - system has heif
# HEIF_INCLUDE_DIRS - the heif include directories
# HEIF_LIBRARIES - the libraries needed to use heif
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (NOT WIN32)
include(LibFindMacros)
libfind_pkg_check_modules(HEIF_PKGCONF libheif)
find_path(HEIF_INCLUDE_DIR
NAMES libheif/heif.h
HINTS ${HEIF_PKGCONF_INCLUDE_DIRS} ${HEIF_PKGCONF_INCLUDEDIR}
PATH_SUFFIXES heif
)
find_library(HEIF_LIBRARY
NAMES heif
HINTS ${HEIF_PKGCONF_LIBRARY_DIRS} ${HEIF_PKGCONF_LIBDIR}
)
set(HEIF_PROCESS_LIBS HEIF_LIBRARY)
set(HEIF_PROCESS_INCLUDES HEIF_INCLUDE_DIR)
libfind_process(HEIF)
else()
find_path(HEIF_INCLUDE_DIR
NAMES heif.h
)
find_library (
HEIF_LIBRARY
NAMES libheif libheif
DOC "Libraries to link against for HEIF Support"
)
if (HEIF_LIBRARY)
set(HEIF_LIBRARY_DIR ${HEIF_LIBRARY})
endif()
set (HEIF_LIBRARIES ${HEIF_LIBRARY})
if(HEIF_INCLUDE_DIR AND HEIF_LIBRARY_DIR)
set (HEIF_FOUND true)
endif()
endif()
......@@ -49,8 +49,6 @@ if (GIF_FOUND)
add_subdirectory(gif)
endif()
#
# Look for libheif; needs a findHeif.cmake module
# if (HEIF_FOUND)
if (HEIF_FOUND)
add_subdirectory(heif)
# endif()
endif()
pkg_check_modules (HEIF libheif)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HEIF_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HEIF_CFLAGS}")
add_definitions(${HEIF_DEFINITIONS})
set(kritaheifimport_SOURCES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment