| 1 |
# Needed to find libheif/heif_version.h while compiling the library |
| 2 |
include_directories(${libheif_BINARY_DIR} ${libheif_SOURCE_DIR}/libheif/api ${libheif_SOURCE_DIR}/libheif) |
| 3 |
|
| 4 |
add_library(heifio STATIC |
| 5 |
decoder.h |
| 6 |
decoder_y4m.cc |
| 7 |
decoder_y4m.h |
| 8 |
encoder.h |
| 9 |
encoder.cc |
| 10 |
encoder_y4m.h |
| 11 |
encoder_y4m.cc |
| 12 |
exif.h |
| 13 |
exif.cc |
| 14 |
stubs.cc) |
| 15 |
|
| 16 |
target_link_libraries(heifio PRIVATE heif) |
| 17 |
|
| 18 |
set_target_properties(heifio |
| 19 |
PROPERTIES |
| 20 |
VERSION ${PROJECT_VERSION}) |
| 21 |
|
| 22 |
|
| 23 |
target_compile_definitions(heifio |
| 24 |
PUBLIC |
| 25 |
LIBHEIF_EXPORTS |
| 26 |
HAVE_VISIBILITY) |
| 27 |
|
| 28 |
find_package(TIFF) |
| 29 |
if (TIFF_FOUND) |
| 30 |
target_sources(heifio PRIVATE decoder_tiff.cc decoder_tiff.h encoder_tiff.h encoder_tiff.cc) |
| 31 |
target_link_libraries(heifio PRIVATE TIFF::TIFF) |
| 32 |
target_compile_definitions(heifio PUBLIC HAVE_LIBTIFF=1) |
| 33 |
endif() |
| 34 |
|
| 35 |
find_package(JPEG) |
| 36 |
if (TARGET JPEG::JPEG) |
| 37 |
target_compile_definitions(heifio PUBLIC -DHAVE_LIBJPEG=1) |
| 38 |
|
| 39 |
include(CheckCXXSourceCompiles) |
| 40 |
|
| 41 |
# this is needed for CheckCXXSourceCompiles |
| 42 |
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) |
| 43 |
set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIRS}) |
| 44 |
check_cxx_source_compiles(" |
| 45 |
#include <stddef.h> |
| 46 |
#include <stdio.h> |
| 47 |
#include <jpeglib.h> |
| 48 |
|
| 49 |
int main() { |
| 50 |
jpeg_write_icc_profile(NULL, NULL, 0); |
| 51 |
return 0; |
| 52 |
} |
| 53 |
" HAVE_JPEG_WRITE_ICC_PROFILE) |
| 54 |
unset(CMAKE_REQUIRED_LIBRARIES) |
| 55 |
unset(CMAKE_REQUIRED_INCLUDES) |
| 56 |
|
| 57 |
if (HAVE_JPEG_WRITE_ICC_PROFILE) |
| 58 |
add_definitions(-DHAVE_JPEG_WRITE_ICC_PROFILE=1) |
| 59 |
endif () |
| 60 |
|
| 61 |
target_link_libraries(heifio PRIVATE JPEG::JPEG) |
| 62 |
|
| 63 |
target_sources(heifio PRIVATE encoder_jpeg.cc encoder_jpeg.h) |
| 64 |
target_sources(heifio PRIVATE decoder.h decoder_jpeg.cc decoder_jpeg.h) |
| 65 |
endif () |
| 66 |
|
| 67 |
|
| 68 |
find_package(PNG) |
| 69 |
set(PNG_FOUND ${PNG_FOUND} PARENT_SCOPE) |
| 70 |
if (TARGET PNG::PNG) |
| 71 |
target_compile_definitions(heifio PUBLIC -DHAVE_LIBPNG=1) |
| 72 |
|
| 73 |
target_link_libraries(heifio PRIVATE PNG::PNG) |
| 74 |
|
| 75 |
target_sources(heifio PRIVATE encoder_png.cc encoder_png.h) |
| 76 |
target_sources(heifio PRIVATE decoder_png.cc decoder_png.h) |
| 77 |
endif () |
| 78 |
|
| 79 |
message("") |
| 80 |
message("=== Active input formats for heif-enc ===") |
| 81 |
if (JPEG_FOUND) |
| 82 |
message("JPEG: active") |
| 83 |
else () |
| 84 |
message("JPEG: ------ (libjpeg not found)") |
| 85 |
endif () |
| 86 |
if (PNG_FOUND) |
| 87 |
message("PNG: active") |
| 88 |
else () |
| 89 |
message("PNG: ------ (libpng not found)") |
| 90 |
endif () |
| 91 |
if (TIFF_FOUND) |
| 92 |
message("TIFF: active") |
| 93 |
else () |
| 94 |
message("TIFF: ------ (libtiff not found)") |
| 95 |
endif () |
| 96 |
message("") |
| 97 |
|