1 | #========================================================================
|
---|
2 | #
|
---|
3 | # xpdf/cmake-xpdf.txt
|
---|
4 | #
|
---|
5 | # CMake script for the Xpdf tools.
|
---|
6 | #
|
---|
7 | # Copyright 2015 Glyph & Cog, LLC
|
---|
8 | #
|
---|
9 | #========================================================================
|
---|
10 |
|
---|
11 | include_directories("${PROJECT_SOURCE_DIR}")
|
---|
12 | include_directories("${PROJECT_BINARY_DIR}")
|
---|
13 | include_directories("${PROJECT_SOURCE_DIR}/goo")
|
---|
14 | include_directories("${PROJECT_SOURCE_DIR}/fofi")
|
---|
15 | include_directories("${PROJECT_SOURCE_DIR}/splash")
|
---|
16 | if (PNG_FOUND)
|
---|
17 | message(STATUS "@@@@@@@@@@@@@@@ PNG_FOUND")
|
---|
18 | include_directories("${PNG_INCLUDE_DIRS}")
|
---|
19 | link_directories (${PNG_LIBRARY_DIRS})
|
---|
20 | link_libraries (${PNG_LIBRARIES})
|
---|
21 | add_definitions("${PNG_DEFINITIONS}")
|
---|
22 | else ()
|
---|
23 | message(STATUS "@@@@@@@@@@@@@@@ NOT PNG_FOUND")
|
---|
24 | endif ()
|
---|
25 | if (ZLIB_FOUND)
|
---|
26 | message(STATUS "@@@@@@@@@@@@@@@ ZLIB_FOUND")
|
---|
27 | include_directories("${ZLIB_INCLUDE_DIRS}")
|
---|
28 | else ()
|
---|
29 | message(STATUS "@@@@@@@@@@@@@@@ NOT ZLIB_FOUND")
|
---|
30 | endif ()
|
---|
31 | if (HAVE_LCMS)
|
---|
32 | include_directories("${LCMS_INCLUDE_DIR}")
|
---|
33 | set(COLOR_MANAGER_SOURCE "ColorManager.cc")
|
---|
34 | else ()
|
---|
35 | set(COLOR_MANAGER_SOURCE "")
|
---|
36 | endif ()
|
---|
37 |
|
---|
38 | add_library(xpdf_objs OBJECT
|
---|
39 | AcroForm.cc
|
---|
40 | Annot.cc
|
---|
41 | Array.cc
|
---|
42 | BuiltinFont.cc
|
---|
43 | BuiltinFontTables.cc
|
---|
44 | Catalog.cc
|
---|
45 | CharCodeToUnicode.cc
|
---|
46 | CMap.cc
|
---|
47 | ${COLOR_MANAGER_SOURCE}
|
---|
48 | Decrypt.cc
|
---|
49 | Dict.cc
|
---|
50 | Error.cc
|
---|
51 | FontEncodingTables.cc
|
---|
52 | Form.cc
|
---|
53 | Function.cc
|
---|
54 | Gfx.cc
|
---|
55 | GfxFont.cc
|
---|
56 | GfxState.cc
|
---|
57 | GlobalParams.cc
|
---|
58 | JArithmeticDecoder.cc
|
---|
59 | JBIG2Stream.cc
|
---|
60 | JPXStream.cc
|
---|
61 | Lexer.cc
|
---|
62 | Link.cc
|
---|
63 | NameToCharCode.cc
|
---|
64 | Object.cc
|
---|
65 | OptionalContent.cc
|
---|
66 | Outline.cc
|
---|
67 | OutputDev.cc
|
---|
68 | Page.cc
|
---|
69 | Parser.cc
|
---|
70 | PDFDoc.cc
|
---|
71 | PDFDocEncoding.cc
|
---|
72 | PSTokenizer.cc
|
---|
73 | SecurityHandler.cc
|
---|
74 | Stream.cc
|
---|
75 | TextString.cc
|
---|
76 | UnicodeMap.cc
|
---|
77 | UnicodeTypeTable.cc
|
---|
78 | UTF8.cc
|
---|
79 | XFAForm.cc
|
---|
80 | XRef.cc
|
---|
81 | Zoox.cc
|
---|
82 | )
|
---|
83 |
|
---|
84 | #--- object files needed by XpdfWidget
|
---|
85 |
|
---|
86 | if ((QT4_FOUND OR Qt5Widgets_FOUND)
|
---|
87 | AND HAVE_SPLASH AND MULTITHREADED AND USE_EXCEPTIONS)
|
---|
88 |
|
---|
89 | if (HIGHLIGHTED_REGIONS)
|
---|
90 | set(HIGHLIGHT_SRC "HighlightFile.cc")
|
---|
91 | else ()
|
---|
92 | set(HIGHLIGHT_SRC "")
|
---|
93 | endif ()
|
---|
94 |
|
---|
95 | add_library(xpdf_widget_objs OBJECT
|
---|
96 | DisplayState.cc
|
---|
97 | PDFCore.cc
|
---|
98 | PreScanOutputDev.cc
|
---|
99 | PSOutputDev.cc
|
---|
100 | SplashOutputDev.cc
|
---|
101 | TextOutputDev.cc
|
---|
102 | TileCache.cc
|
---|
103 | TileCompositor.cc
|
---|
104 | TileMap.cc
|
---|
105 | ${HIGHLIGHT_SRC}
|
---|
106 | )
|
---|
107 | endif ()
|
---|
108 |
|
---|
109 | # We want to build static xpdf-tools binaries. See
|
---|
110 | # https://stackoverflow.com/questions/24648357/compiling-a-static-executable-with-cmake
|
---|
111 | # Want to make the min number of changes for building statically, so using this way:
|
---|
112 | SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
---|
113 | SET(BUILD_SHARED_LIBS OFF)
|
---|
114 | SET(CMAKE_EXE_LINKER_FLAGS "-static")
|
---|
115 | # See https://github.com/droe/sslsplit/issues/82
|
---|
116 | # for warnings of this nature:
|
---|
117 | # ../goo/libgoo.a(gfile.cc.o): In function `getHomeDir()':
|
---|
118 | # gfile.cc:(.text+0x55): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
|
---|
119 | # gfile.cc:(.text+0x90): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
|
---|
120 | # See https://stackoverflow.com/questions/1620918/cmake-and-libpthread
|
---|
121 | # after googling cmake and "-lpthread" (pthread) after ERRORS to do with this, like:
|
---|
122 | # undefined reference to `pthread_mutex_unlock'
|
---|
123 | set(THREADS_PREFER_PTHREAD_FLAG ON)
|
---|
124 | find_package(Threads REQUIRED)
|
---|
125 |
|
---|
126 | #-- libpng
|
---|
127 | # https://stackoverflow.com/questions/36220123/undefined-reference-to-png-set-longjmp-fn-when-compiling-pcl-source-file
|
---|
128 | # https://stackoverflow.com/questions/30980383/cmake-compile-options-for-libpng
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 | #--- pdftops
|
---|
133 |
|
---|
134 | if (HAVE_SPLASH)
|
---|
135 | add_executable(pdftops
|
---|
136 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
137 | PreScanOutputDev.cc
|
---|
138 | PSOutputDev.cc
|
---|
139 | SplashOutputDev.cc
|
---|
140 | pdftops.cc
|
---|
141 | )
|
---|
142 | target_link_libraries(pdftops goo fofi splash
|
---|
143 | ${PNG_LIBRARY}
|
---|
144 | ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
|
---|
145 | ${DTYPE_LIBRARY}
|
---|
146 | ${LCMS_LIBRARY}
|
---|
147 | Threads::Threads)
|
---|
148 | else ()
|
---|
149 | add_executable(pdftops
|
---|
150 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
151 | PreScanOutputDev.cc
|
---|
152 | PSOutputDev.cc
|
---|
153 | pdftops.cc
|
---|
154 | )
|
---|
155 | target_link_libraries(pdftops goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
156 | endif ()
|
---|
157 | install(TARGETS pdftops RUNTIME DESTINATION bin)
|
---|
158 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftops.1 DESTINATION man/man1)
|
---|
159 |
|
---|
160 | #--- pdftotext
|
---|
161 |
|
---|
162 | add_executable(pdftotext
|
---|
163 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
164 | TextOutputDev.cc
|
---|
165 | pdftotext.cc
|
---|
166 | )
|
---|
167 | target_link_libraries(pdftotext goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
168 | install(TARGETS pdftotext RUNTIME DESTINATION bin)
|
---|
169 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftotext.1 DESTINATION man/man1)
|
---|
170 |
|
---|
171 | #--- pdftohtml
|
---|
172 |
|
---|
173 | if (HAVE_SPLASH AND PNG_FOUND)
|
---|
174 | add_executable(pdftohtml
|
---|
175 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
176 | HTMLGen.cc
|
---|
177 | SplashOutputDev.cc
|
---|
178 | TextOutputDev.cc
|
---|
179 | pdftohtml.cc
|
---|
180 | )
|
---|
181 | target_link_libraries(pdftohtml goo fofi splash
|
---|
182 | ${PNG_LIBRARY}
|
---|
183 | ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
|
---|
184 | ${DTYPE_LIBRARY}
|
---|
185 | ${LCMS_LIBRARY} ${PNG_LIBRARIES}
|
---|
186 | Threads::Threads)
|
---|
187 | install(TARGETS pdftohtml RUNTIME DESTINATION bin)
|
---|
188 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftohtml.1 DESTINATION man/man1)
|
---|
189 | endif ()
|
---|
190 |
|
---|
191 | #--- pdfinfo
|
---|
192 |
|
---|
193 | add_executable(pdfinfo
|
---|
194 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
195 | pdfinfo.cc
|
---|
196 | )
|
---|
197 | target_link_libraries(pdfinfo goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
198 | install(TARGETS pdfinfo RUNTIME DESTINATION bin)
|
---|
199 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfinfo.1 DESTINATION man/man1)
|
---|
200 |
|
---|
201 | #--- pdffonts
|
---|
202 |
|
---|
203 | add_executable(pdffonts
|
---|
204 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
205 | pdffonts.cc
|
---|
206 | )
|
---|
207 | target_link_libraries(pdffonts goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
208 | install(TARGETS pdffonts RUNTIME DESTINATION bin)
|
---|
209 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdffonts.1 DESTINATION man/man1)
|
---|
210 |
|
---|
211 | #--- pdfdetach
|
---|
212 |
|
---|
213 | add_executable(pdfdetach
|
---|
214 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
215 | pdfdetach.cc
|
---|
216 | )
|
---|
217 | target_link_libraries(pdfdetach goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
218 | install(TARGETS pdfdetach RUNTIME DESTINATION bin)
|
---|
219 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfdetach.1 DESTINATION man/man1)
|
---|
220 |
|
---|
221 | #--- pdftoppm
|
---|
222 |
|
---|
223 | if (HAVE_SPLASH)
|
---|
224 | add_executable(pdftoppm
|
---|
225 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
226 | SplashOutputDev.cc
|
---|
227 | pdftoppm.cc
|
---|
228 | )
|
---|
229 | target_link_libraries(pdftoppm goo fofi splash
|
---|
230 | ${PNG_LIBRARY}
|
---|
231 | ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
|
---|
232 | ${DTYPE_LIBRARY}
|
---|
233 | ${LCMS_LIBRARY}
|
---|
234 | Threads::Threads)
|
---|
235 | install(TARGETS pdftoppm RUNTIME DESTINATION bin)
|
---|
236 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftoppm.1 DESTINATION man/man1)
|
---|
237 | endif ()
|
---|
238 |
|
---|
239 | #--- pdftopng
|
---|
240 |
|
---|
241 | if (HAVE_SPLASH AND PNG_FOUND)
|
---|
242 | add_executable(pdftopng
|
---|
243 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
244 | SplashOutputDev.cc
|
---|
245 | pdftopng.cc
|
---|
246 | )
|
---|
247 | target_link_libraries(pdftopng goo fofi splash
|
---|
248 | ${PNG_LIBRARY}
|
---|
249 | ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
|
---|
250 | ${DTYPE_LIBRARY}
|
---|
251 | ${LCMS_LIBRARY} ${PNG_LIBRARIES} Threads::Threads)
|
---|
252 | install(TARGETS pdftopng RUNTIME DESTINATION bin)
|
---|
253 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftopng.1 DESTINATION man/man1)
|
---|
254 | endif ()
|
---|
255 |
|
---|
256 | #--- pdfimages
|
---|
257 |
|
---|
258 | add_executable(pdfimages
|
---|
259 | $<TARGET_OBJECTS:xpdf_objs>
|
---|
260 | ImageOutputDev.cc
|
---|
261 | pdfimages.cc
|
---|
262 | )
|
---|
263 | target_link_libraries(pdfimages goo fofi ${LCMS_LIBRARY} ${PNG_LIBRARY} Threads::Threads)
|
---|
264 | install(TARGETS pdfimages RUNTIME DESTINATION bin)
|
---|
265 | install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfimages.1 DESTINATION man/man1)
|
---|
266 |
|
---|
267 | #--- xpdfrc man page
|
---|
268 |
|
---|
269 | install(FILES ${PROJECT_SOURCE_DIR}/doc/xpdfrc.5 DESTINATION man/man5)
|
---|