@@ -33,7 +33,9 @@ endif (APPLE)
33
33
34
34
35
35
macro (ms_link_libraries)
36
- target_link_libraries (mapserver ${ARGV} )
36
+ if (BUILD_DYNAMIC)
37
+ target_link_libraries (mapserver ${ARGV} )
38
+ endif (BUILD_DYNAMIC)
37
39
if (BUILD_STATIC)
38
40
target_link_libraries (mapserver_static ${ARGV} )
39
41
endif (BUILD_STATIC)
@@ -59,9 +61,10 @@ macro( report_dependency_error component dependency)
59
61
endmacro ()
60
62
61
63
SET (CMAKE_REQUIRED_INCLUDES "math.h" )
62
- if (CMAKE_COMPILER_IS_GNUCXX)
63
- SET (CMAKE_REQUIRED_LIBRARIES "m" )
64
- endif (CMAKE_COMPILER_IS_GNUCXX)
64
+ if (NOT (WIN32 ))
65
+ SET (CMAKE_REQUIRED_LIBRARIES "m" )
66
+ endif (NOT (WIN32 ))
67
+
65
68
check_function_exists("strrstr" HAVE_STRRSTR)
66
69
check_function_exists("strcasecmp" HAVE_STRCASECMP)
67
70
check_function_exists("strcasestr" HAVE_STRCASESTR)
@@ -93,8 +96,8 @@ option(WITH_PROJ "Choose if reprojection support should be built in" ON)
93
96
option (WITH_KML "Enable native KML output support (requires libxml2 support)" OFF )
94
97
option (WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF )
95
98
option (WITH_WMS "Enable WMS Server support (requires proj support)" ON )
96
- option (WITH_GD "Choose if (old) GD support should be built in" OFF )
97
- option (WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages )" ON )
99
+ option (WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages) (requires HARFBUZZ)" ON )
100
+ option (WITH_HARFBUZZ "Choose if Harfbuzz complex text layout should be included (needed for e.g. arabic and hindi) (requires FRIBIDI )" ON )
98
101
option (WITH_ICONV "Choose if Iconv Internationalization support should be built in" ON )
99
102
option (WITH_CAIRO "Choose if CAIRO rendering support should be built in (required for SVG and PDF output)" ON )
100
103
option (WITH_SVGCAIRO "Choose if SVG symbology support (via libsvgcairo) should be built in (requires cairo, libsvg, libsvg-cairo. Incompatible with librsvg)" OFF )
@@ -138,7 +141,7 @@ option(WITH_GENERIC_NINT "generic rounding" OFF)
138
141
# PERLV_ld_DETECT?
139
142
140
143
# Add compiler flags for warnings
141
- if (CMAKE_COMPILER_IS_GNUCXX)
144
+ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC )
142
145
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement" )
143
146
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
144
147
endif ()
@@ -148,8 +151,10 @@ SET(CMAKE_MACOSX_RPATH ON)
148
151
149
152
if (LINK_STATIC_LIBMAPSERVER)
150
153
set (BUILD_STATIC 1)
154
+ set (BUILD_DYNAMIC 0)
151
155
set (MAPSERVER_LIBMAPSERVER mapserver_static)
152
156
else (LINK_STATIC_LIBMAPSERVER)
157
+ set (BUILD_DYNAMIC 1)
153
158
set (MAPSERVER_LIBMAPSERVER mapserver)
154
159
endif (LINK_STATIC_LIBMAPSERVER)
155
160
@@ -166,7 +171,7 @@ renderers/agg/src/agg_line_aa_basics.cpp
166
171
renderers/agg/src/clipper.cpp
167
172
)
168
173
include_directories (renderers/agg/include )
169
-
174
+ #add_definitions(-DHASH_DEBUG=1)
170
175
if (WIN32 )
171
176
set (REGEX_SOURCES ${REGEX_DIR} /regex .c)
172
177
include_directories (${REGEX_DIR} )
@@ -179,7 +184,7 @@ else(WIN32)
179
184
set (REGEX_SOURCES "" )
180
185
endif (WIN32 )
181
186
182
- set (mapserver_SOURCES
187
+ set (mapserver_SOURCES fontcache.c
183
188
cgiutil.c mapgeos.c maporaclespatial.c mapsearch.c mapwms.c classobject.c
184
189
mapgml.c mapoutput.c mapwmslayer.c layerobject.c mapgraticule.c mapows.c
185
190
mapservutil.c mapxbase.c maphash.c mapowscommon.c mapshape.c mapxml.c mapbits.c
@@ -192,17 +197,20 @@ mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
192
197
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
193
198
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
194
199
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
195
- mapogcfiltercommon.c maprendering.c mapwcs20.c mapgd.c mapogcsld.c
200
+ mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c
196
201
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c
197
202
mapgeomtransform.c mapogroutput.c mapsde.c mapwfslayer.c mapagg.cpp mapkml.cpp
198
- mapgeomutil.cpp mapkmlrenderer.cpp
203
+ mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c
199
204
mapogr.cpp mapcontour.c mapsmoothing.c ${REGEX_SOURCES} )
200
205
201
- add_library (mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES} )
202
- set_target_properties ( mapserver PROPERTIES
203
- VERSION ${MapServer_VERSION_STRING}
204
- SOVERSION 1
206
+ if (BUILD_DYNAMIC)
207
+ add_library (mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES} )
208
+ set_target_properties ( mapserver PROPERTIES
209
+ VERSION ${MapServer_VERSION_STRING}
210
+ SOVERSION 1
205
211
)
212
+ endif (BUILD_DYNAMIC)
213
+
206
214
if (BUILD_STATIC)
207
215
add_library (mapserver_static STATIC ${mapserver_SOURCES} ${agg_SOURCES} )
208
216
set_target_properties ( mapserver_static PROPERTIES
@@ -240,6 +248,10 @@ add_executable(shptreetst shptreetst.c)
240
248
target_link_libraries (shptreetst ${MAPSERVER_LIBMAPSERVER} )
241
249
242
250
251
+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
252
+ set (USE_EXTENDED_DEBUG 1)
253
+ endif (CMAKE_BUILD_TYPE STREQUAL "Debug" )
254
+
243
255
find_package (PNG)
244
256
if (PNG_FOUND)
245
257
include_directories (${PNG_INCLUDE_DIR} )
@@ -285,30 +297,6 @@ if(WITH_WMS)
285
297
endif (USE_PROJ)
286
298
endif (WITH_WMS)
287
299
288
-
289
- if (WITH_GD)
290
- find_package (GD)
291
- if (NOT GD_FOUND)
292
- report_optional_not_found(GD)
293
- else (NOT GD_FOUND)
294
- include_directories (${GD_INCLUDE_DIR} )
295
- ms_link_libraries( ${GD_LIBRARY} )
296
- set (USE_GD 1)
297
- if (GD_SUPPORTS_PNG)
298
- set (USE_GD_PNG 1)
299
- endif (GD_SUPPORTS_PNG)
300
- if (GD_SUPPORTS_GIF)
301
- set (USE_GD_GIF 1)
302
- endif (GD_SUPPORTS_GIF)
303
- if (GD_SUPPORTS_JPEG)
304
- set (USE_GD_JPEG 1)
305
- endif (GD_SUPPORTS_JPEG)
306
- if (GD_SUPPORTS_FREETYPE)
307
- set (USE_GD_FREETYPE 1)
308
- endif (GD_SUPPORTS_FREETYPE)
309
- endif (NOT GD_FOUND)
310
- endif (WITH_GD)
311
-
312
300
if (WITH_FRIBIDI)
313
301
find_package (FriBiDi)
314
302
if (NOT FRIBIDI_FOUND)
@@ -323,6 +311,25 @@ if(WITH_FRIBIDI)
323
311
endif (NOT FRIBIDI_FOUND)
324
312
endif (WITH_FRIBIDI)
325
313
314
+ if (WITH_HARFBUZZ)
315
+ find_package (HarfBuzz)
316
+ if (NOT HARFBUZZ_FOUND)
317
+ report_optional_not_found(HARFBUZZ)
318
+ else (NOT HARFBUZZ_FOUND)
319
+ include_directories (${HARFBUZZ_INCLUDE_DIR} )
320
+ ms_link_libraries( ${HARFBUZZ_LIBRARY} )
321
+ set (USE_HARFBUZZ 1)
322
+ endif (NOT HARFBUZZ_FOUND)
323
+ endif (WITH_HARFBUZZ)
324
+
325
+ if ( USE_HARFBUZZ AND NOT (USE_FRIBIDI) )
326
+ report_dependency_error(HARFBUZZ FRIBIDI)
327
+ endif ( USE_HARFBUZZ AND NOT (USE_FRIBIDI) )
328
+ if ( USE_FRIBIDI AND NOT (USE_HARFBUZZ) )
329
+ report_dependency_error(FRIBIDI HARFBUZZ)
330
+ endif ( USE_FRIBIDI AND NOT (USE_HARFBUZZ) )
331
+
332
+
326
333
if (WITH_ICONV)
327
334
find_package (ICONV)
328
335
if (ICONV_FOUND)
@@ -719,6 +726,8 @@ if(WITH_EXEMPI)
719
726
endif (LIBEXEMPI_FOUND)
720
727
endif (WITH_EXEMPI)
721
728
729
+ ms_link_libraries(harfbuzz)
730
+
722
731
if (WITH_PYTHON)
723
732
add_subdirectory ("mapscript/python" )
724
733
set (USE_PYTHON_MAPSCRIPT 1)
@@ -798,7 +807,6 @@ message(STATUS " * freetype: ${FREETYPE_LIBRARY}")
798
807
message (STATUS " * Optional components" )
799
808
status_optional_component("GDAL" "${USE_GDAL} " "${GDAL_LIBRARY} " )
800
809
status_optional_component("OGR" "${USE_OGR} " "${GDAL_LIBRARY} " )
801
- status_optional_component("GD" "${USE_GD} " "${GD_LIBRARY} " )
802
810
status_optional_component("GIF" "${USE_GIF} " "${GIF_LIBRARY} " )
803
811
status_optional_component("MYSQL" "${USE_MYSQL} " "${MYSQL_LIBRARY} " )
804
812
status_optional_component("FRIBIDI" "${USE_FRIBIDI} " "${FRIBIDI_LIBRARY} " )
@@ -885,8 +893,11 @@ if(USE_SDE92)
885
893
INSTALL (TARGETS msplugin_sde92 DESTINATION lib)
886
894
endif (USE_SDE92)
887
895
888
- INSTALL (TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
896
+ INSTALL (TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
889
897
if (BUILD_STATIC)
890
898
INSTALL (TARGETS mapserver_static DESTINATION lib)
891
899
endif (BUILD_STATIC)
900
+ if (BUILD_DYNAMIC)
901
+ INSTALL (TARGETS mapserver DESTINATION lib)
902
+ endif (BUILD_DYNAMIC)
892
903
0 commit comments