source: gs2-extensions/xpdf-tools/trunk/src/packages/CMakeLists.txt.static1_notworking@ 32230

Last change on this file since 32230 was 32228, checked in by ak19, 6 years ago

Tried to compile xpdf-tools up statically with CMake, but still not successful. For now committing modifications necessary (including the new additional packages) for compiling xpdf-tools agains dynamically linked libs of libpng and zlib and freetype. Although these 3 packages have been introduced and are successfully compiled up (and I can even get the CMake configure stage of xpdf-tools to 'see' them), the xpdftools binaries upon successful compilation are shown by ldd to still refer to system versions of zlib, libpng and freetype. Some modifications to a single file in the xpdftools src package were necessary to get things to compile again with these changes, so recommitting the xpdftools src package with modications using the usual gs- prefix and a readme.

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