| 1 |
# CMake build for libtiff |
| 2 |
# |
| 3 |
# Copyright © 2015 Open Microscopy Environment / University of Dundee |
| 4 |
# Written by Roger Leigh <[email protected]> |
| 5 |
# |
| 6 |
# Permission to use, copy, modify, distribute, and sell this software and |
| 7 |
# its documentation for any purpose is hereby granted without fee, provided |
| 8 |
# that (i) the above copyright notices and this permission notice appear in |
| 9 |
# all copies of the software and related documentation, and (ii) the names of |
| 10 |
# Sam Leffler and Silicon Graphics may not be used in any advertising or |
| 11 |
# publicity relating to the software without the specific, prior written |
| 12 |
# permission of Sam Leffler and Silicon Graphics. |
| 13 |
# |
| 14 |
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, |
| 15 |
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY |
| 16 |
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
| 17 |
# |
| 18 |
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR |
| 19 |
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, |
| 20 |
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
| 21 |
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF |
| 22 |
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
| 23 |
# OF THIS SOFTWARE. |
| 24 |
|
| 25 |
# Windows specific resource preparation |
| 26 |
if (WIN32) |
| 27 |
message(STATUS "Include resource version information for TOOLS") |
| 28 |
set(MSVC_RESOURCE_FILE tif_tools_versioninfo.rc) |
| 29 |
source_group("Resource Files" FILES tif_tools_versioninfo.rc) |
| 30 |
endif () |
| 31 |
|
| 32 |
|
| 33 |
add_executable(fax2ps ../placeholder.h) |
| 34 |
target_sources(fax2ps PRIVATE fax2ps.c ${MSVC_RESOURCE_FILE}) |
| 35 |
target_link_libraries(fax2ps PRIVATE tiff tiff_port) |
| 36 |
|
| 37 |
add_executable(fax2tiff ../placeholder.h) |
| 38 |
target_sources(fax2tiff PRIVATE fax2tiff.c ${MSVC_RESOURCE_FILE}) |
| 39 |
target_link_libraries(fax2tiff PRIVATE tiff tiff_port) |
| 40 |
|
| 41 |
add_executable(pal2rgb ../placeholder.h) |
| 42 |
target_sources(pal2rgb PRIVATE pal2rgb.c ${MSVC_RESOURCE_FILE}) |
| 43 |
target_link_libraries(pal2rgb PRIVATE tiff tiff_port) |
| 44 |
|
| 45 |
add_executable(ppm2tiff ../placeholder.h) |
| 46 |
target_sources(ppm2tiff PRIVATE ppm2tiff.c ${MSVC_RESOURCE_FILE}) |
| 47 |
target_link_libraries(ppm2tiff PRIVATE tiff tiff_port) |
| 48 |
|
| 49 |
add_executable(raw2tiff ../placeholder.h) |
| 50 |
target_sources(raw2tiff PRIVATE raw2tiff.c ${MSVC_RESOURCE_FILE}) |
| 51 |
target_link_libraries(raw2tiff PRIVATE tiff tiff_port CMath::CMath) |
| 52 |
|
| 53 |
add_executable(rgb2ycbcr ../placeholder.h) |
| 54 |
target_sources(rgb2ycbcr PRIVATE rgb2ycbcr.c ${MSVC_RESOURCE_FILE}) |
| 55 |
target_link_libraries(rgb2ycbcr PRIVATE tiff tiff_port) |
| 56 |
|
| 57 |
add_executable(thumbnail ../placeholder.h) |
| 58 |
target_sources(thumbnail PRIVATE thumbnail.c ${MSVC_RESOURCE_FILE}) |
| 59 |
target_link_libraries(thumbnail PRIVATE tiff tiff_port CMath::CMath) |
| 60 |
|
| 61 |
add_executable(tiff2bw ../placeholder.h) |
| 62 |
target_sources(tiff2bw PRIVATE tiff2bw.c ${MSVC_RESOURCE_FILE}) |
| 63 |
target_link_libraries(tiff2bw PRIVATE tiff tiff_port) |
| 64 |
|
| 65 |
add_executable(tiff2pdf ../placeholder.h) |
| 66 |
target_sources(tiff2pdf PRIVATE tiff2pdf.c ${MSVC_RESOURCE_FILE}) |
| 67 |
target_link_libraries(tiff2pdf PRIVATE tiff tiff_port) |
| 68 |
|
| 69 |
add_executable(tiff2ps ../placeholder.h) |
| 70 |
target_sources(tiff2ps PRIVATE tiff2ps.c ${MSVC_RESOURCE_FILE}) |
| 71 |
target_link_libraries(tiff2ps PRIVATE tiff tiff_port CMath::CMath) |
| 72 |
|
| 73 |
add_executable(tiff2rgba ../placeholder.h) |
| 74 |
target_sources(tiff2rgba PRIVATE tiff2rgba.c ${MSVC_RESOURCE_FILE}) |
| 75 |
target_link_libraries(tiff2rgba PRIVATE tiff tiff_port) |
| 76 |
|
| 77 |
add_executable(tiffcmp ../placeholder.h) |
| 78 |
target_sources(tiffcmp PRIVATE tiffcmp.c ${MSVC_RESOURCE_FILE}) |
| 79 |
target_link_libraries(tiffcmp PRIVATE tiff tiff_port) |
| 80 |
|
| 81 |
add_executable(tiffcp ../placeholder.h) |
| 82 |
target_sources(tiffcp PRIVATE tiffcp.c ${MSVC_RESOURCE_FILE}) |
| 83 |
target_link_libraries(tiffcp PRIVATE tiff tiff_port) |
| 84 |
|
| 85 |
add_executable(tiffcrop ../placeholder.h) |
| 86 |
target_sources(tiffcrop PRIVATE tiffcrop.c ${MSVC_RESOURCE_FILE}) |
| 87 |
target_link_libraries(tiffcrop PRIVATE tiff tiff_port CMath::CMath) |
| 88 |
|
| 89 |
add_executable(tiffdither ../placeholder.h) |
| 90 |
target_sources(tiffdither PRIVATE tiffdither.c ${MSVC_RESOURCE_FILE}) |
| 91 |
target_link_libraries(tiffdither PRIVATE tiff tiff_port) |
| 92 |
|
| 93 |
add_executable(tiffdump ../placeholder.h) |
| 94 |
target_sources(tiffdump PRIVATE tiffdump.c ${MSVC_RESOURCE_FILE}) |
| 95 |
target_link_libraries(tiffdump PRIVATE tiff tiff_port) |
| 96 |
|
| 97 |
add_executable(tiffinfo ../placeholder.h) |
| 98 |
target_sources(tiffinfo PRIVATE tiffinfo.c ${MSVC_RESOURCE_FILE}) |
| 99 |
target_link_libraries(tiffinfo PRIVATE tiff tiff_port) |
| 100 |
|
| 101 |
add_executable(tiffmedian ../placeholder.h) |
| 102 |
target_sources(tiffmedian PRIVATE tiffmedian.c ${MSVC_RESOURCE_FILE}) |
| 103 |
target_link_libraries(tiffmedian PRIVATE tiff tiff_port) |
| 104 |
|
| 105 |
add_executable(tiffset ../placeholder.h) |
| 106 |
target_sources(tiffset PRIVATE tiffset.c ${MSVC_RESOURCE_FILE}) |
| 107 |
target_link_libraries(tiffset PRIVATE tiff tiff_port) |
| 108 |
|
| 109 |
add_executable(tiffsplit ../placeholder.h) |
| 110 |
target_sources(tiffsplit PRIVATE tiffsplit.c ${MSVC_RESOURCE_FILE}) |
| 111 |
target_link_libraries(tiffsplit PRIVATE tiff tiff_port) |
| 112 |
|
| 113 |
# rgb2ycbcr and thumbnail are intended to *NOT* be installed. They are for |
| 114 |
# testing purposes only. |
| 115 |
install(TARGETS fax2ps |
| 116 |
fax2tiff |
| 117 |
pal2rgb |
| 118 |
ppm2tiff |
| 119 |
raw2tiff |
| 120 |
tiff2bw |
| 121 |
tiff2pdf |
| 122 |
tiff2ps |
| 123 |
tiff2rgba |
| 124 |
tiffcmp |
| 125 |
tiffcp |
| 126 |
tiffcrop |
| 127 |
tiffdither |
| 128 |
tiffdump |
| 129 |
tiffinfo |
| 130 |
tiffmedian |
| 131 |
tiffset |
| 132 |
tiffsplit |
| 133 |
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
| 134 |
|
| 135 |
if(OPENGL_SUPPORT) |
| 136 |
add_executable(tiffgt ../placeholder.h) |
| 137 |
target_sources(tiffgt PRIVATE tiffgt.c) |
| 138 |
target_link_libraries(tiffgt PRIVATE tiff tiff_port) |
| 139 |
target_link_libraries(tiffgt PRIVATE OpenGL::GL GLUT::GLUT) |
| 140 |
|
| 141 |
install(TARGETS tiffgt |
| 142 |
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
| 143 |
endif() |
| 144 |
|
| 145 |
if(WEBP_SUPPORT AND EMSCRIPTEN) |
| 146 |
# Emscripten is pretty finnicky about linker flags. |
| 147 |
# It needs --shared-memory if and only if atomics or bulk-memory is used. |
| 148 |
foreach(target fax2ps |
| 149 |
fax2tiff |
| 150 |
pal2rgb |
| 151 |
ppm2tiff |
| 152 |
raw2tiff |
| 153 |
rgb2ycbcr |
| 154 |
thumbnail |
| 155 |
tiff2bw |
| 156 |
tiff2pdf |
| 157 |
tiff2ps |
| 158 |
tiff2rgba |
| 159 |
tiffcmp |
| 160 |
tiffcp |
| 161 |
tiffcrop |
| 162 |
tiffdither |
| 163 |
tiffdump |
| 164 |
tiffinfo |
| 165 |
tiffmedian |
| 166 |
tiffset |
| 167 |
tiffsplit) |
| 168 |
target_link_options(${target} PUBLIC "-Wl,--shared-memory") |
| 169 |
endforeach() |
| 170 |
endif() |