scons: only apply HAS_CAIRO & HAS_PYCAIRO flags to cairo related files

This commit is contained in:
Dane Springmeyer 2010-07-14 22:46:37 +00:00
parent b8b2b726fe
commit d75fb586d0
4 changed files with 20 additions and 12 deletions

View file

@ -778,7 +778,6 @@ if not preconfigured:
env.Append(CXXFLAGS = '-DHAVE_LIBXML2')
if env['CAIRO'] and conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('cairomm-1.0'):
env.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
env['HAS_CAIRO'] = True
else:
env['SKIPPED_DEPS'].extend(['cairo','cairomm'])
@ -922,7 +921,6 @@ if not preconfigured:
env['MISSING_DEPS'].append('boost python')
if env['CAIRO'] and conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
env.ParseConfig('pkg-config --cflags pycairo')
env['HAS_PYCAIRO'] = True
else:
env['SKIPPED_DEPS'].extend(['pycairo'])

View file

@ -49,7 +49,8 @@ if env['PLATFORM'] == 'Darwin':
if env['THREADING'] == 'multi':
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
if env['HAS_CAIRO']:
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
libraries.append('cairomm-1.0')
libraries.append('cairo')
##### Python linking on OS X is tricky ###
# Confounding problems are:
@ -141,14 +142,19 @@ if env['SVN_REVISION']:
sources.remove('mapnik_python.cpp')
env2 = env.Clone()
env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
if env['HAS_CAIRO']:
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
if env['HAS_PYCAIRO']:
env2.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
if env['HAS_CAIRO']:
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
if env['HAS_PYCAIRO']:
env2.ParseConfig('pkg-config --cflags pycairo')
env2.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
env2 = env.Clone()
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
fixup = ['mapnik_image.cpp','python_cairo.cpp']
for cpp in fixup:
if cpp in sources:
@ -160,6 +166,6 @@ if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
for cpp in fixup:
sources.insert(0,env2.SharedObject(cpp))
_mapnik = env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik2',_mapnik)
_mapnik = env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik',_mapnik)
env.Alias(target='install',source=pymapniklib)

View file

@ -38,7 +38,8 @@ libraries = [boost_thread,'mapnik']
if env['HAS_CAIRO'] in env['CXXFLAGS']:
# add cairo and cairomm-1.0 to libs
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
libraries.append('cairomm-1.0')
libraries.append('cairo')
if env['PLATFORM'] == 'Darwin':
libraries.append(env['ICU_LIB_NAME'])

View file

@ -40,7 +40,8 @@ libraries = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'
if env['HAS_CAIRO']:
# add cairo and cairomm-1.0 to libs
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
libraries.append('cairomm-1.0')
libraries.append('cairo')
if env['XMLPARSER'] == 'libxml2':
libraries.append('xml2')
@ -110,9 +111,10 @@ source = Split(
"""
)
if 'cairo' in env['LIBS']:
if env['HAS_CAIRO']:
env2 = env.Clone()
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
for cpp in fixup:
if cpp in source:
@ -120,6 +122,7 @@ if 'cairo' in env['LIBS']:
for cpp in fixup:
source.insert(0,env2.SharedObject(cpp))
if env['XMLPARSER'] == 'tinyxml':
source += Split(
"""