Update build script

pull/1132/head
Levin Li 2021-10-09 17:16:07 +08:00
parent a45425c374
commit 7a91ba9311
3 changed files with 64 additions and 0 deletions

View File

@ -212,6 +212,10 @@ find_package(JPEG REQUIRED) # -DJPEG_LIBRARY=...
include_directories(${JPEG_INCLUDE_DIRS})
link_libraries(${JPEG_LIBRARIES})
find_package(Libavif REQUIRED)
link_libraries(libavif::libavif)
include_directories(${LIBAVIF_INCLUDE_DIR})
if(ENABLE_CELX)
add_definitions(-DCELX)

View File

@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindLibavif
# --------
#
# Find the avif headers and libraries.
#
# This module reports information about the avif
# installation in several variables. General variables::
#
# LIBAVIF_FOUND - true if the avif headers and libraries were found
# LIBAVIF_INCLUDE_DIRS - the directory containing the avif headers
# LIBAVIF_LIBRARIES - avif libraries to be linked
#
# The following cache variables may also be set::
#
# LIBAVIF_INCLUDE_DIR - the directory containing the avif headers
# LIBAVIF_LIBRARY - the avif library (if any)
# Find include directory
# TODO: use pkgconfig
find_path(LIBAVIF_INCLUDE_DIR
NAMES avif/avif.h
HINTS LIBAVIF_DIR
DOC "avif headers")
mark_as_advanced(LIBAVIF_INCLUDE_DIR)
find_library(LIBAVIF_LIBRARY
NAMES avif
HINTS LIBAVIF_DIR
DOC "avif libraries")
mark_as_advanced(LIBAVIF_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libavif
FOUND_VAR LIBAVIF_FOUND
REQUIRED_VARS LIBAVIF_INCLUDE_DIR LIBAVIF_LIBRARY
FAIL_MESSAGE "Failed to find avif")
if(LIBAVIF_FOUND)
set(LIBAVIF_INCLUDE_DIRS "${LIBAVIF_INCLUDE_DIR}")
if(LIBAVIF_LIBRARY)
set(LIBAVIF_LIBRARIES "${LIBAVIF_LIBRARY}")
else()
unset(LIBAVIF_LIBRARIES)
endif()
if(NOT TARGET libavif::libavif)
add_library(libavif::libavif UNKNOWN IMPORTED)
set_target_properties(libavif::libavif PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBAVIF_INCLUDE_DIRS}")
set_target_properties(libavif::libavif PROPERTIES
IMPORTED_LOCATION "${LIBAVIF_LIBRARY}")
endif()
endif()

View File

@ -1,4 +1,5 @@
set(CELIMAGE_SOURCES
avif.cpp
bmp.cpp
dds.cpp
dds_decompress.cpp