| 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 |
if (MSVC) |
| 5 |
set(getopt_sources |
| 6 |
../extra/getopt.c |
| 7 |
../extra/getopt.h |
| 8 |
../extra/getopt_long.c |
| 9 |
) |
| 10 |
include_directories("../extra") |
| 11 |
endif () |
| 12 |
|
| 13 |
add_executable(heif-info ${getopt_sources} |
| 14 |
heif_info.cc |
| 15 |
common.cc |
| 16 |
common.h) |
| 17 |
target_link_libraries(heif-info heif) |
| 18 |
install(TARGETS heif-info RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 19 |
install(FILES heif-info.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
| 20 |
|
| 21 |
|
| 22 |
add_executable(heif-dec ${getopt_sources} |
| 23 |
heif_dec.cc |
| 24 |
common.cc |
| 25 |
common.h) |
| 26 |
target_link_libraries(heif-dec PRIVATE heif heifio) |
| 27 |
target_include_directories(heif-dec PRIVATE ${libheif_SOURCE_DIR}) |
| 28 |
install(TARGETS heif-dec RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 29 |
install(FILES heif-dec.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
| 30 |
|
| 31 |
# create symbolic link from the old name `heif-convert` to `heif-dec` |
| 32 |
if(NOT WIN32) |
| 33 |
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink heif-dec${CMAKE_EXECUTABLE_SUFFIX} \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/heif-convert${CMAKE_EXECUTABLE_SUFFIX})") |
| 34 |
else() |
| 35 |
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/heif-dec${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/heif-convert${CMAKE_EXECUTABLE_SUFFIX})") |
| 36 |
endif() |
| 37 |
|
| 38 |
|
| 39 |
add_executable(heif-enc ${getopt_sources} |
| 40 |
heif_enc.cc |
| 41 |
benchmark.h |
| 42 |
benchmark.cc |
| 43 |
common.cc |
| 44 |
common.h |
| 45 |
SAI_datafile.cc |
| 46 |
SAI_datafile.h) |
| 47 |
target_link_libraries(heif-enc PRIVATE heif heifio) |
| 48 |
target_include_directories(heif-enc PRIVATE ${libheif_SOURCE_DIR}) |
| 49 |
install(TARGETS heif-enc RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 50 |
install(FILES heif-enc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
| 51 |
|
| 52 |
if (WITH_HEADER_COMPRESSION) |
| 53 |
target_compile_definitions(heif-enc PRIVATE WITH_HEADER_COMPRESSION=1) |
| 54 |
endif () |
| 55 |
|
| 56 |
|
| 57 |
if (WITH_EXAMPLE_HEIF_THUMB AND PNG_FOUND) |
| 58 |
add_executable(heif-thumbnailer ${getopt_sources} |
| 59 |
heif_thumbnailer.cc |
| 60 |
common.cc |
| 61 |
common.h) |
| 62 |
target_link_libraries(heif-thumbnailer heif heifio) |
| 63 |
target_include_directories(heif-thumbnailer PRIVATE ${libheif_SOURCE_DIR}) |
| 64 |
|
| 65 |
install(TARGETS heif-thumbnailer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 66 |
install(FILES heif-thumbnailer.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
| 67 |
endif() |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
if (WITH_EXAMPLE_HEIF_VIEW) |
| 72 |
find_package(SDL2 NO_MODULE) |
| 73 |
|
| 74 |
if (SDL2_FOUND) |
| 75 |
add_executable(heif-view ${getopt_sources} |
| 76 |
heif_view.cc |
| 77 |
sdl.cc |
| 78 |
sdl.hh |
| 79 |
common.cc |
| 80 |
common.h) |
| 81 |
target_link_libraries(heif-view PRIVATE heif SDL2::SDL2main SDL2::SDL2) |
| 82 |
install(TARGETS heif-view RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 83 |
endif () |
| 84 |
endif () |
| 85 |
|
| 86 |
|
| 87 |
add_executable(heif-test ${getopt_sources} |
| 88 |
heif_test.cc |
| 89 |
common.cc |
| 90 |
common.h) |
| 91 |
target_link_libraries(heif-test heif) |