Merge commit 'a0c758df9e635f8665625cc92c1e3581f2ec25d4' into harfbuzz

This commit is contained in:
Hermann Kraus 2013-03-16 15:42:21 +01:00
commit a85ce712c6
10 changed files with 74 additions and 85 deletions

View file

@ -63,8 +63,6 @@ Optional dependencies:
* Cairo - Graphics library for PDF, PS, and SVG formats
- pkg-config - Required for building with cairo support
- libsigc++ - C++ support for cairomm
- cairomm - C++ bindings for cairo
- pycairo - Python bindings for cairo
* libpq - PostgreSQL libraries (For PostGIS plugin support)
* libgdal - GDAL/OGR input (For gdal and ogr plugin support)

View file

@ -49,7 +49,7 @@ SCONF_TEMP_DIR = '.sconf_temp'
# auto-search directories for boost libs/headers
BOOST_SEARCH_PREFIXES = ['/usr/local','/opt/local','/sw','/usr',]
BOOST_MIN_VERSION = '1.47'
#CAIROMM_MIN_VERSION = '1.8.0'
#CAIRO_MIN_VERSION = '1.8.0'
DEFAULT_LINK_PRIORITY = ['internal','other','frameworks','user','system']
@ -60,8 +60,6 @@ pretty_dep_names = {
'ogr':'OGR-enabled GDAL C++ Library | configured using gdal-config program | try setting GDAL_CONFIG SCons option | more info: https://github.com/mapnik/mapnik/wiki//OGR',
'geos_c':'GEOS Simple Geometry Specification C Library | configured with GEOS_LIB & GEOS_INCLUDE | more info: https://github.com/mapnik/mapnik/wiki//GEOS',
'cairo':'Cairo C library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option',
#'cairomm':'Cairomm C++ bindings to Cairo library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option',
#'cairomm-version':'Cairomm version is too old (so cairo renderer will not be built), you need at least %s' % CAIROMM_MIN_VERSION,
'pycairo':'Python bindings to Cairo library | configured using pkg-config | try setting PKG_CONFIG_PATH SCons option',
'proj':'Proj.4 C Projections library | configure with PROJ_LIBS & PROJ_INCLUDES | more info: http://trac.osgeo.org/proj/',
'pg':'Postgres C Library requiered for PostGIS plugin | configure with pg_config program | more info: https://github.com/mapnik/mapnik/wiki//PostGIS',
@ -334,7 +332,7 @@ opts.AddVariables(
# Variables for optional dependencies
('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'),
# Note: cairo, cairomm, and pycairo all optional but configured automatically through pkg-config
# Note: cairo and and pycairo are optional but configured automatically through pkg-config
# Therefore, we use a single boolean for whether to attempt to build cairo support.
BoolVariable('CAIRO', 'Attempt to build with Cairo rendering support', 'True'),
PathVariable('CAIRO_INCLUDES', 'Search path for cairo include files', '',PathVariable.PathAccept),
@ -429,9 +427,9 @@ pickle_store = [# Scons internal variables
'EXTRA_FREETYPE_LIBS',
'LIBMAPNIK_CPPATHS',
'LIBMAPNIK_CXXFLAGS',
'CAIROMM_LIBPATHS',
'CAIROMM_LINKFLAGS',
'CAIROMM_CPPPATHS',
'CAIRO_LIBPATHS',
'CAIRO_LINKFLAGS',
'CAIRO_CPPPATHS',
'SVG_RENDERER',
'SQLITE_LINKFLAGS',
'BOOST_LIB_VERSION_FROM_HEADER',
@ -958,9 +956,9 @@ if not preconfigured:
env['MISSING_DEPS'] = []
env['SKIPPED_DEPS'] = []
env['HAS_CAIRO'] = False
env['CAIROMM_LIBPATHS'] = []
env['CAIROMM_LINKFLAGS'] = []
env['CAIROMM_CPPPATHS'] = []
env['CAIRO_LIBPATHS'] = []
env['CAIRO_LINKFLAGS'] = []
env['CAIRO_CPPPATHS'] = []
env['HAS_PYCAIRO'] = False
env['HAS_LIBXML2'] = False
env['LIBMAPNIK_LIBS'] = []
@ -1273,29 +1271,25 @@ if not preconfigured:
if env['CAIRO_LIBS'] or env['CAIRO_INCLUDES']:
c_inc = env['CAIRO_INCLUDES']
if env['CAIRO_LIBS']:
env["CAIROMM_LIBPATHS"].append(os.path.realpath(env['CAIRO_LIBS']))
env["CAIRO_LIBPATHS"].append(os.path.realpath(env['CAIRO_LIBS']))
if not env['CAIRO_INCLUDES']:
c_inc = env['CAIRO_LIBS'].replace('lib','',1)
if c_inc:
c_inc = os.path.normpath(os.path.realpath(env['CAIRO_INCLUDES']))
if c_inc.endswith('include'):
c_inc = os.path.dirname(c_inc)
env["CAIROMM_CPPPATHS"].extend(
env["CAIRO_CPPPATHS"].extend(
[
#os.path.join(c_inc,'include/cairomm-1.0'),
#os.path.join(c_inc,'lib/cairomm-1.0/include'),
os.path.join(c_inc,'include/cairo'),
#os.path.join(c_inc,'include/sigc++-2.0'),
#os.path.join(c_inc,'lib/sigc++-2.0/include'),
os.path.join(c_inc,'include/pixman-1'),
#os.path.join(c_inc,'include/freetype2'),
#os.path.join(c_inc,'include/libpng'),
]
)
env["CAIROMM_LINKFLAGS"] = ['cairo']
env["CAIRO_LINKFLAGS"] = ['cairo']
if env['RUNTIME_LINK'] == 'static':
env["CAIROMM_LINKFLAGS"].extend(
['sigc-2.0','pixman-1','expat','fontconfig','iconv']
env["CAIRO_LINKFLAGS"].extend(
['pixman-1','expat','fontconfig','iconv']
)
# todo - run actual checkLib?
env['HAS_CAIRO'] = True
@ -1304,40 +1298,32 @@ if not preconfigured:
env['HAS_CAIRO'] = False
env['SKIPPED_DEPS'].append('pkg-config')
env['SKIPPED_DEPS'].append('cairo')
#env['SKIPPED_DEPS'].append('cairomm')
elif not conf.CheckPKG('cairo'):
env['HAS_CAIRO'] = False
env['SKIPPED_DEPS'].append('cairo')
#elif not conf.CheckPKG('cairomm-1.0'):
# env['HAS_CAIRO'] = False
# env['SKIPPED_DEPS'].append('cairomm')
#elif not conf.CheckPKGVersion('cairomm-1.0',CAIROMM_MIN_VERSION):
# env['HAS_CAIRO'] = False
# env['SKIPPED_DEPS'].append('cairomm-version')
#else:
# print 'Checking for cairo/cairomm lib and include paths... ',
# cmd = 'pkg-config --libs --cflags cairomm-1.0'
# if env['RUNTIME_LINK'] == 'static':
# cmd += ' --static'
# cairo_env = env.Clone()
# try:
# cairo_env.ParseConfig(cmd)
# for lib in cairo_env['LIBS']:
# if not lib in env['LIBS']:
# env["CAIROMM_LINKFLAGS"].append(lib)
# for lpath in cairo_env['LIBPATH']:
# if not lpath in env['LIBPATH']:
# env["CAIROMM_LIBPATHS"].append(lpath)
# for inc in cairo_env['CPPPATH']:
# if not inc in env['CPPPATH']:
# env["CAIROMM_CPPPATHS"].append(inc)
# env['HAS_CAIRO'] = True
# print 'yes'
# except OSError,e:
# color_print(1,'no')
# env['SKIPPED_DEPS'].append('cairo')
# env['SKIPPED_DEPS'].append('cairomm')
# color_print(1,'pkg-config reported: %s' % e)
else:
print 'Checking for cairo lib and include paths... ',
cmd = 'pkg-config --libs --cflags cairo'
if env['RUNTIME_LINK'] == 'static':
cmd += ' --static'
cairo_env = env.Clone()
try:
cairo_env.ParseConfig(cmd)
for lib in cairo_env['LIBS']:
if not lib in env['LIBS']:
env["CAIRO_LINKFLAGS"].append(lib)
for lpath in cairo_env['LIBPATH']:
if not lpath in env['LIBPATH']:
env["CAIRO_LIBPATHS"].append(lpath)
for inc in cairo_env['CPPPATH']:
if not inc in env['CPPPATH']:
env["CAIRO_CPPPATHS"].append(inc)
env['HAS_CAIRO'] = True
print 'yes'
except OSError,e:
color_print(1,'no')
env['SKIPPED_DEPS'].append('cairo')
color_print(1,'pkg-config reported: %s' % e)
else:
color_print(4,'Not building with cairo support, pass CAIRO=True to enable')
@ -1626,8 +1612,8 @@ if not HELP_REQUESTED:
rm_path('LIBPATH')
rm_path('CPPPATH')
rm_path('CXXFLAGS')
rm_path('CAIROMM_LIBPATHS')
rm_path('CAIROMM_CPPPATHS')
rm_path('CAIRO_LIBPATHS')
rm_path('CAIRO_CPPPATHS')
if env['PATH_REPLACE']:
searches,replace = env['PATH_REPLACE'].split(':')
@ -1643,8 +1629,8 @@ if not HELP_REQUESTED:
replace_path('LIBPATH',search,replace)
replace_path('CPPPATH',search,replace)
replace_path('CXXFLAGS',search,replace)
replace_path('CAIROMM_LIBPATHS',search,replace)
replace_path('CAIROMM_CPPPATHS',search,replace)
replace_path('CAIRO_LIBPATHS',search,replace)
replace_path('CAIRO_CPPPATHS',search,replace)
# export env so it is available in build.py files
Export('env')

View file

@ -173,10 +173,10 @@ if 'install' in COMMAND_LINE_TARGETS:
if 'uninstall' not in COMMAND_LINE_TARGETS:
if env['HAS_CAIRO']:
py_env.Append(CPPPATH = env['CAIROMM_CPPPATHS'])
py_env.Append(CPPPATH = env['CAIRO_CPPPATHS'])
py_env.Append(CXXFLAGS = '-DHAVE_CAIRO')
if env['PLATFORM'] == 'Darwin':
py_env.Append(LIBS=env['CAIROMM_LINKFLAGS'])
py_env.Append(LIBS=env['CAIRO_LINKFLAGS'])
if env['HAS_PYCAIRO']:
py_env.ParseConfig('pkg-config --cflags pycairo')

View file

@ -36,7 +36,7 @@ demo_env = env.Clone()
demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
if env['HAS_CAIRO']:
demo_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS'])
demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
demo_env.Append(CXXFLAGS = '-DHAVE_CAIRO')
libraries = copy(env['LIBMAPNIK_LIBS'])

View file

@ -37,9 +37,8 @@
#include <mapnik/config_error.hpp>
#if defined(HAVE_CAIRO)
// cairo
#include <mapnik/cairo_renderer.hpp>
#include <cairomm/surface.h>
#include <mapnik/cairo_context.hpp>
#endif
#include <iostream>
@ -259,7 +258,7 @@ int main ( int argc , char** argv)
save_to_file(buf,"demo.jpg","jpeg");
save_to_file(buf,"demo.png","png");
save_to_file(buf,"demo256.png","png256");
save_to_file(buf,"demo256.png","png8");
save_to_file(buf,"demo.tif","tiff");
std::cout << "Three maps have been rendered using AGG in the current directory:\n"
@ -270,24 +269,31 @@ int main ( int argc , char** argv)
"Have a look!\n";
#if defined(HAVE_CAIRO)
Cairo::RefPtr<Cairo::ImageSurface> image_surface;
// save to pdf/svg files
save_to_cairo_file(m,"cairo-demo.pdf");
save_to_cairo_file(m,"cairo-demo.svg");
image_surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, m.width(),m.height());
cairo_renderer<Cairo::Surface> png_render(m, image_surface);
/* we could also do:
save_to_cairo_file(m,"cairo-demo.png");
but instead let's build up a surface for more flexibility
*/
cairo_surface_ptr image_surface(
cairo_image_surface_create(CAIRO_FORMAT_ARGB32,m.width(),m.height()),
cairo_surface_closer());
double scale_factor = 1.0;
cairo_ptr image_context = (create_context(image_surface));
mapnik::cairo_renderer<cairo_ptr> png_render(m,image_context,scale_factor);
png_render.apply();
image_surface->write_to_png("cairo-demo.png");
// we can now write to png with cairo functionality
cairo_surface_write_to_png(&*image_surface, "cairo-demo.png");
// but we can also benefit from quantization by converting
// to a mapnik image object and then saving that
image_32 im(image_surface);
save_to_file(im, "cairo-demo256.png","png256");
Cairo::RefPtr<Cairo::Surface> surface;
surface = Cairo::PdfSurface::create("cairo-demo.pdf", m.width(),m.height());
cairo_renderer<Cairo::Surface> pdf_render(m, surface);
pdf_render.apply();
surface = Cairo::SvgSurface::create("cairo-demo.svg", m.width(),m.height());
cairo_renderer<Cairo::Surface> svg_render(m, surface);
svg_render.apply();
save_to_file(im, "cairo-demo256.png","png8");
cairo_surface_finish(&*image_surface);
std::cout << "Three maps have been rendered using Cairo in the current directory:\n"
"- cairo-demo.png\n"

View file

@ -204,11 +204,11 @@ source = Split(
)
if env['HAS_CAIRO']:
lib_env.PrependUnique(LIBPATH=env['CAIROMM_LIBPATHS'])
lib_env.Append(LIBS=env['CAIROMM_LINKFLAGS'])
lib_env.PrependUnique(LIBPATH=env['CAIRO_LIBPATHS'])
lib_env.Append(LIBS=env['CAIRO_LINKFLAGS'])
lib_env.Append(CXXFLAGS = '-DHAVE_CAIRO')
libmapnik_cxxflags.append('-DHAVE_CAIRO')
lib_env.PrependUnique(CPPPATH=copy(env['CAIROMM_CPPPATHS']))
lib_env.PrependUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
source.insert(0,'cairo_renderer.cpp')
source.insert(0,'cairo_context.cpp')

View file

@ -218,7 +218,6 @@ namespace detail {
using namespace boost::spirit; // for traits
using namespace boost::spirit::karma; // for char_inserter
using namespace boost; // for remove_const
if ( traits::test_zero(n) ) return true; // this part added to karma
@ -226,7 +225,7 @@ namespace detail {
// generate(sink, right_align(precision, '0')[ulong], n);
// but it's spelled out to avoid inter-modular dependencies.
typename remove_const<T>::type digits =
typename boost::remove_const<T>::type digits =
(traits::test_zero(n) ? 0 : floor(log10(n))) + 1;
bool r = true;
for (/**/; r && digits < precision_; digits = digits + 1)

View file

@ -51,7 +51,7 @@ other_includes += ' '.join(config_env['LIBMAPNIK_CXXFLAGS'])
other_includes += ' '
if config_env['HAS_CAIRO']:
other_includes += ''.join([' -I%s' % i for i in env['CAIROMM_CPPPATHS'] if not i.startswith('#')])
other_includes += ''.join([' -I%s' % i for i in env['CAIRO_CPPPATHS'] if not i.startswith('#')])
ldflags = config_env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in config_env['LIBPATH'] if not i.startswith('#')])

View file

@ -38,7 +38,7 @@ source = Split(
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
if env['HAS_CAIRO']:
program_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS'])
program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
program_env.Append(CXXFLAGS = '-DHAVE_CAIRO')
program_env.PrependUnique(CPPPATH=['#plugins/input/postgis'])

View file

@ -36,7 +36,7 @@ source = Split(
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
if env['HAS_CAIRO']:
program_env.PrependUnique(CPPPATH=env['CAIROMM_CPPPATHS'])
program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
program_env.Append(CXXFLAGS = '-DHAVE_CAIRO')
libraries = copy(env['LIBMAPNIK_LIBS'])