blob: d1831c9e57d1c854aaf9778e993e9c98bf7d7962 (
plain)
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
222
223
224
225
226
227
|
# $Id$
SET(PACKAGE GD)
SET(PACKAGE_NAME GD)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
PROJECT(GD)
SET(CMAKE_MODULE_PATH "${GD_SOURCE_DIR}/cmake/modules")
OPTION(ENABLE_PNG "Enable PNG support" 0)
OPTION(ENABLE_LIQ "Enable libimagequant support" 0)
OPTION(ENABLE_JPEG "Enable JPEG support" 0)
OPTION(ENABLE_TIFF "Enable TIFF support" 0)
OPTION(ENABLE_XPM "Enable XPM support" 0)
OPTION(ENABLE_FREETYPE "Enable Freetype2 support" 0)
OPTION(ENABLE_WBMP "Enable WBMP support" 0)
OPTION(ENABLE_FONTCONFIG "Enable FontConfig support" 0)
OPTION(ENABLE_WEBP "Enable WebP support" 0)
if (BUILD_TEST)
ENABLE_TESTING()
endif(BUILD_TEST)
# if you would like to pass C flags to the compiler, then just
# - specify -DCMAKE_C_FLAGS=... on invocation of cmake, or
# - specify CFLAGS=... on invocation of make
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0") # will be added to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
ENDIF(CMAKE_COMPILER_IS_GNUCC)
if (USE_EXT_GD)
message("Using GD at: ${USE_EXT_GD}")
INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
FIND_PACKAGE(GD)
if (GD_FOUND)
INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
LINK_DIRECTORIES(${GD_LIBRARIES})
SET(GD_LIB ${GD_LIBRARIES})
SET(GD_LIBS_DIR ${GD_LIBRARY})
message("GD libs #: ${GD_LIBRARIES}")
message("GD lib #: ${GD_LIBRARY}")
message("GD include: ${GD_INCLUDE_DIR}")
else (GD_FOUND)
message("No gd found")
endif (GD_FOUND)
else (USE_EXT_GD)
SET(GD_VERSION_MAJOR "2")
SET(GD_VERSION_MINOR "1")
SET(GD_VERSION_PATCH "0")
SET(GD_VERSION "${GD_VERSION_MAJOR}.${GD_VERSION_MINOR}.${GD_VERSION_PATCH}")
SET(GD_VERSION_STRING "${GD_VERSION}")
SET(GD_VERSION_INT "20100")
SET(CMAKE_REQUIRED_INCLUDES "/usr/include" "/usr/local/include")
include(CheckIncludeFiles)
include(CheckIncludeFile)
include(AC_HEADER_STDC)
include(CheckPrototypeExists)
if (ENABLE_PNG)
FIND_PACKAGE(PNG REQUIRED)
endif (ENABLE_PNG)
FIND_PACKAGE(ZLIB)
IF (ENABLE_WEBP)
FIND_PACKAGE(VPX)
ENDIF (ENABLE_WEBP)
IF (ENABLE_LIQ)
FIND_PACKAGE(LIQ)
ENDIF (ENABLE_LIQ)
IF (NOT WIN32)
FIND_PACKAGE(PTHREAD)
ENDIF (NOT WIN32)
if (ENABLE_JPEG)
FIND_PACKAGE(JPEG)
endif (ENABLE_JPEG)
if (ENABLE_TIFF)
FIND_PACKAGE(TIFF)
endif (ENABLE_TIFF)
if (ENABLE_FREETYPE)
FIND_PACKAGE(Freetype)
endif (ENABLE_FREETYPE)
if (ENABLE_XPM)
FIND_PACKAGE(XPM)
endif (ENABLE_XPM)
if (ENABLE_FONTCONFIG)
FIND_PACKAGE(FontConfig)
endif (ENABLE_FONTCONFIG)
if (FREETYPE_FOUND)
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR})
SET(HAVE_FT2BUILD_H 1)
SET(HAVE_LIBFREETYPE 1)
ENDIF(FREETYPE_FOUND)
IF(ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
SET(HAVE_LIBZ 1)
ENDIF(ZLIB_FOUND)
IF(VPX_FOUND)
INCLUDE_DIRECTORIES(${VPX_INCLUDE_DIR})
SET(HAVE_LIBVPX 1)
ENDIF(VPX_FOUND)
IF(PNG_FOUND)
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
SET(HAVE_LIBPNG 1)
ENDIF(PNG_FOUND)
IF(LIQ_FOUND)
INCLUDE_DIRECTORIES(${LIQ_INCLUDE_DIR})
SET(HAVE_LIBIMAGEQUANT_H 1)
ENDIF(LIQ_FOUND)
IF(XPM_FOUND)
INCLUDE_DIRECTORIES(${XPM_INCLUDE_DIR})
SET(HAVE_LIBXPM 1)
ENDIF(XPM_FOUND)
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
SET(HAVE_LIBJPEG 1)
ENDIF(JPEG_FOUND)
IF(TIFF_FOUND)
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
SET(HAVE_LIBTIFF 1)
ENDIF(TIFF_FOUND)
IF(FONTCONFIG_FOUND)
INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
SET(HAVE_LIBFONTCONFIG 1)
ELSE (FONTCONFIG_FOUND)
SET(FONTCONFIG_LIBRARY "")
SET(FONTCONFIG_INCLUDE_DIR "")
SET(FONTCONFIG_LIB_DIR "")
ENDIF(FONTCONFIG_FOUND)
SET(HAVE_CONFIG_H 1)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
CONFIGURE_FILE(${GD_SOURCE_DIR}/src/config.h.cmake ${CMAKE_BINARY_DIR}/config.h ESCAPE_QUOTES)
set(BUILD_SHARED_LIBS On)
if (WIN32)
SET(GD_LIB bgd)
ADD_DEFINITIONS( -DWIN32 -D_WIN32 -DBGDWIN32 -DMSWIN32 -DBGDWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0600)
if(NOT MINGW AND MSVC_VERSION GREATER 1399)
ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
endif(NOT MINGW AND MSVC_VERSION GREATER 1399)
if (MINGW OR MSYS)
ADD_DEFINITIONS("-mms-bitfields -m32")
endif (MINGW OR MSYS)
else (WIN32)
SET(GD_LIB gd)
endif (WIN32)
SET(GD_LIB_STATIC "${GD_LIB}-static")
IF(PROFILE)
add_definitions("-pg")
set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAGS} "-pg")
ENDIF(PROFILE)
SET(GD_INCLUDE_DIR "${GD_SOURCE_DIR}/src" "${GD_SOURCE_DIR}")
INCLUDE_DIRECTORIES(before ${FONTCONFIG_INCLUDE_DIR})
add_subdirectory(src)
endif (USE_EXT_GD)
add_subdirectory(tests)
add_subdirectory(examples)
add_subdirectory(docs)
SET(CPACK_PACKAGE_NAME "libgd")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libGD, powerful and easy to use graphic library")
SET(CPACK_PACKAGE_VENDOR "http://www.libgd.org")
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
if(WIN32)
set(CPACK_GENERATOR ZIP)
else(WIN32)
set(CPACK_GENERATOR TGZ)
endif(WIN32)
IF (ENABLE_LIQ AND LIQ_BUILD)
ADD_DEPENDENCIES(${GD_LIB} libimagequant)
ADD_DEPENDENCIES(${GD_LIB_STATIC} libimagequant)
ENDIF(ENABLE_LIQ AND LIQ_BUILD)
INSTALL_FILES("docs" "examples" DESTINATION "gd-docs")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_SOURCE_GENERATOR TGZ)
set(CPACK_SOURCE_IGNORE_FILES
"~$"
"\\\\.swp$"
"\\\\.hgignore$"
"\\\\.gitignore$"
"^${PROJECT_SOURCE_DIR}/debian/"
"^${PROJECT_SOURCE_DIR}/old/"
"^${PROJECT_SOURCE_DIR}/bld/"
)
install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
INCLUDE(CPack)
|