-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
221 lines (190 loc) · 6.22 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
project(Pdf3d)
# determine compiler name
set(COMPILER_LABEL "unknown")
if(CMAKE_COMPILER_IS_GNUCC)
set(COMPILER_LABEL "gcc")
endif(CMAKE_COMPILER_IS_GNUCC)
if(MSVC)
set(COMPILER_LABEL "vc")
endif(MSVC)
# information about libharu
set(LIBHPDF_MAJOR 2)
set(LIBHPDF_MINOR 2)
set(LIBHPDF_PATCH 0)
set(LIBHPDF_VERSION ${LIBHPDF_MAJOR}.${LIBHPDF_MINOR}.${LIBHPDF_PATCH})
# we want cmake version 2.4.8 at least
cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR)
# Location where the haru cmake build system first looks for cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/libharu/cmake/modules)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif(MSVC)
# =======================================================================
# look for headers and libraries
# =======================================================================
# check zlib availibility
find_package(ZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
set(ADDITIONAL_LIBRARIES ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)
# check png availibility
find_package(PNG)
if(PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
add_definitions(${PNG_DEFINITIONS})
set(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} ${PNG_LIBRARIES})
endif(PNG_FOUND)
# =======================================================================
# configure header files, add compiler flags
# =======================================================================
# add definitions and directories to include
#if(CMAKE_COMPILER_IS_GNUCC)
# add_definitions("-Wall")
#endif(CMAKE_COMPILER_IS_GNUCC)
if(MSVC_VERSION GREATER 1399)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC_VERSION GREATER 1399)
include_directories(${CMAKE_SOURCE_DIR}/libharu/include)
# these are options
option (LIBHPDF_DEBUG "Enable HPDF Debug")
option (LIBHPDF_DEBUG_TRACE "Enable HPDF Debug trace")
# Just set to 1, we'll assume they are always available.
# If not, then someone will have to add some tests in here to correctly determine
# the headers existance.
set (LIBHPDF_STDC_HEADERS 1)
# support all of the different variations of LIBPNG defines in HARU
set (LIBHPDF_HAVE_LIBPNG ${PNG_FOUND})
if (NOT PNG_FOUND)
set (LIBHPDF_HAVE_NOPNGLIB 1)
set (HPDF_NOPNGLIB 1)
endif (NOT PNG_FOUND)
# support different zlib defines
set (LIBHPDF_HAVE_LIBZ ${ZLIB_FOUND})
if (NOT ZLIB_FOUND)
set (LIBHPDF_HAVE_NOZLIB 1)
endif (NOT ZLIB_FOUND)
# create hpdf_config.h
configure_file(
${CMAKE_SOURCE_DIR}/libharu/include/hpdf_config.h.cmake
${CMAKE_BINARY_DIR}/include/hpdf_config.h
)
include_directories(${CMAKE_BINARY_DIR}/include)
# =======================================================================
# libharu source files
# =======================================================================
set(
LIBHPDF_SRCS
libharu/src/hpdf_annotation.c
libharu/src/hpdf_array.c
libharu/src/hpdf_binary.c
libharu/src/hpdf_boolean.c
libharu/src/hpdf_catalog.c
libharu/src/hpdf_destination.c
libharu/src/hpdf_dict.c
libharu/src/hpdf_doc_png.c
libharu/src/hpdf_doc.c
libharu/src/hpdf_encoder_cns.c
libharu/src/hpdf_encoder_cnt.c
libharu/src/hpdf_encoder_jp.c
libharu/src/hpdf_encoder_kr.c
libharu/src/hpdf_encoder.c
libharu/src/hpdf_encrypt.c
libharu/src/hpdf_encryptdict.c
libharu/src/hpdf_error.c
libharu/src/hpdf_ext_gstate.c
libharu/src/hpdf_font_cid.c
libharu/src/hpdf_font_tt.c
libharu/src/hpdf_font_type1.c
libharu/src/hpdf_font.c
libharu/src/hpdf_fontdef_base14.c
libharu/src/hpdf_fontdef_cid.c
libharu/src/hpdf_fontdef_cns.c
libharu/src/hpdf_fontdef_cnt.c
libharu/src/hpdf_fontdef_jp.c
libharu/src/hpdf_fontdef_kr.c
libharu/src/hpdf_fontdef_tt.c
libharu/src/hpdf_fontdef_type1.c
libharu/src/hpdf_fontdef.c
libharu/src/hpdf_gstate.c
libharu/src/hpdf_image_ccitt.c
libharu/src/hpdf_image_png.c
libharu/src/hpdf_image.c
libharu/src/hpdf_info.c
libharu/src/hpdf_list.c
libharu/src/hpdf_mmgr.c
libharu/src/hpdf_name.c
libharu/src/hpdf_namedict.c
libharu/src/hpdf_null.c
libharu/src/hpdf_number.c
libharu/src/hpdf_objects.c
libharu/src/hpdf_outline.c
libharu/src/hpdf_page_label.c
libharu/src/hpdf_page_operator.c
libharu/src/hpdf_pages.c
libharu/src/hpdf_real.c
libharu/src/hpdf_streams.c
libharu/src/hpdf_string.c
libharu/src/hpdf_u3d.c
libharu/src/hpdf_utils.c
libharu/src/hpdf_xref.c
libharu/src/hpdf_pdfa.c
libharu/src/hpdf_3dmeasure.c
libharu/src/hpdf_exdata.c
libharu/src/hpdf_encoder_utf.c
)
# =====================================================
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/libPRC/CMakeModules ${CMAKE_MODULE_PATH} )
include( CMakeMacros )
add_definitions( -DPRC_USE_ASYMPTOTE )
if (WIN32)
add_definitions( -DPRC_STATIC )
endif()
set (
LIBPRC_SRCS
libPRC/src/libPRC/Export.h
libPRC/src/libPRC/libPRC.cpp
libPRC/src/libPRC/libPRC.h
libPRC/src/libPRC/PRCFile.cpp
libPRC/src/libPRC/PRCFile.h
libPRC/src/libPRC/PRCNode.cpp
libPRC/src/libPRC/PRCNode.h
)
set (
ASYMPTOTE_SRCS
libPRC/src/asymptote/PRC.h
libPRC/src/asymptote/PRCbitStream.cc
libPRC/src/asymptote/PRCbitStream.h
libPRC/src/asymptote/PRCdouble.cc
libPRC/src/asymptote/PRCdouble.h
libPRC/src/asymptote/oPRCFile.cc
libPRC/src/asymptote/oPRCFile.h
libPRC/src/asymptote/writePRC.cc
libPRC/src/asymptote/writePRC.h
asymptote/PRCTools/bitData.cc
asymptote/PRCTools/bitData.h
asymptote/PRCTools/describePRC.cc
asymptote/PRCTools/describePRC.h
asymptote/PRCTools/inflation.cc
asymptote/PRCTools/inflation.h
asymptote/PRCTools/iPRCFile.cc
asymptote/PRCTools/iPRCFile.h
)
# =====================================================
set (
MSHTOPDF_SRCS
${LIBHPDF_SRCS}
${LIBPRC_SRCS}
${ASYMPTOTE_SRCS}
mshtoprc/mshtoprc.cpp
mshtoprc/Stream.cpp
mshtoprc/Swap.cpp
)
include_directories(${CMAKE_SOURCE_DIR}/libPRC/src/asymptote)
include_directories(${CMAKE_SOURCE_DIR}/libPRC/src/libPRC)
include_directories(${CMAKE_SOURCE_DIR}/asymptote/PRCTools)
add_executable(mshtopdf WIN32 ${MSHTOPDF_SRCS})
target_link_libraries(mshtopdf ${ADDITIONAL_LIBRARIES})
if(MSVC)
set_target_properties(mshtopdf PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
endif(MSVC)