scons: conditionally add CXXFLAGS for headers needing Cairo support
This commit is contained in:
parent
ae0274cc6b
commit
4d477a47cd
4 changed files with 39 additions and 14 deletions
|
@ -331,7 +331,9 @@ pickle_store = [# Scons internal variables
|
||||||
'PYTHON_SYS_PREFIX',
|
'PYTHON_SYS_PREFIX',
|
||||||
'COLOR_PRINT',
|
'COLOR_PRINT',
|
||||||
'HAS_BOOST_SYSTEM',
|
'HAS_BOOST_SYSTEM',
|
||||||
'SVN_REVISION'
|
'SVN_REVISION',
|
||||||
|
'HAS_CAIRO',
|
||||||
|
'HAS_PYCAIRO'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add all other user configurable options to pickle pickle_store
|
# Add all other user configurable options to pickle pickle_store
|
||||||
|
@ -778,7 +780,7 @@ if not preconfigured:
|
||||||
|
|
||||||
if env['CAIRO'] and conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('cairomm-1.0'):
|
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.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
|
||||||
env.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
env['HAS_CAIRO'] = True
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['cairo','cairomm'])
|
env['SKIPPED_DEPS'].extend(['cairo','cairomm'])
|
||||||
|
|
||||||
|
@ -928,7 +930,7 @@ if not preconfigured:
|
||||||
|
|
||||||
if env['CAIRO'] and conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
|
if env['CAIRO'] and conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
|
||||||
env.ParseConfig('pkg-config --cflags pycairo')
|
env.ParseConfig('pkg-config --cflags pycairo')
|
||||||
env.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
|
env['HAS_PYCAIRO'] = True
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['pycairo'])
|
env['SKIPPED_DEPS'].extend(['pycairo'])
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ if env['PLATFORM'] == 'Darwin':
|
||||||
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
|
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
|
||||||
if env['THREADING'] == 'multi':
|
if env['THREADING'] == 'multi':
|
||||||
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
|
||||||
if '-DHAVE_CAIRO' in env['CXXFLAGS']:
|
if env['HAS_CAIRO']:
|
||||||
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
||||||
|
|
||||||
##### Python linking on OS X is tricky ###
|
##### Python linking on OS X is tricky ###
|
||||||
|
@ -139,12 +139,30 @@ env.Alias(target='install', source=ogcserver_module)
|
||||||
# install the shared object beside the module directory
|
# install the shared object beside the module directory
|
||||||
sources = glob.glob('*.cpp')
|
sources = glob.glob('*.cpp')
|
||||||
|
|
||||||
if env.get('SVN_REVISION'):
|
|
||||||
|
if env['SVN_REVISION']:
|
||||||
sources.remove('mapnik_python.cpp')
|
sources.remove('mapnik_python.cpp')
|
||||||
env2 = env.Clone();
|
env2 = env.Clone()
|
||||||
env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
|
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')
|
||||||
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
|
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
|
||||||
|
|
||||||
|
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||||
|
env2 = env.Clone()
|
||||||
|
fixup = ['mapnik_image.cpp','python_cairo.cpp']
|
||||||
|
for cpp in fixup:
|
||||||
|
if cpp in sources:
|
||||||
|
sources.remove(cpp)
|
||||||
|
if env['HAS_CAIRO']:
|
||||||
|
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
||||||
|
if env['HAS_PYCAIRO']:
|
||||||
|
env2.Append(CXXFLAGS = '-DHAVE_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)
|
_mapnik = env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
|
||||||
pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik2',_mapnik)
|
pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik2',_mapnik)
|
||||||
env.Alias(target='install',source=pymapniklib)
|
env.Alias(target='install',source=pymapniklib)
|
||||||
|
|
|
@ -37,7 +37,7 @@ boost_regex = 'boost_regex%s' % env['BOOST_APPEND']
|
||||||
|
|
||||||
libraries = [boost_thread,'mapnik2']
|
libraries = [boost_thread,'mapnik2']
|
||||||
|
|
||||||
if '-DHAVE_CAIRO' in env['CXXFLAGS']:
|
if env['HAS_CAIRO'] in env['CXXFLAGS']:
|
||||||
# add cairo and cairomm-1.0 to libs
|
# add cairo and cairomm-1.0 to libs
|
||||||
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ regex = 'boost_regex%s' % env['BOOST_APPEND']
|
||||||
|
|
||||||
libraries = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,regex]
|
libraries = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,regex]
|
||||||
|
|
||||||
if '-DHAVE_CAIRO' in env['CXXFLAGS']:
|
if env['HAS_CAIRO']:
|
||||||
# add cairo and cairomm-1.0 to libs
|
# add cairo and cairomm-1.0 to libs
|
||||||
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
libraries.append([lib for lib in env['LIBS'] if lib.startswith('cairo')])
|
||||||
|
|
||||||
|
@ -72,9 +72,9 @@ else: # Linux and others
|
||||||
|
|
||||||
source = Split(
|
source = Split(
|
||||||
"""
|
"""
|
||||||
|
color.cpp
|
||||||
datasource_cache.cpp
|
datasource_cache.cpp
|
||||||
box2d.cpp
|
box2d.cpp
|
||||||
color.cpp
|
|
||||||
expression_node.cpp
|
expression_node.cpp
|
||||||
expression_string.cpp
|
expression_string.cpp
|
||||||
filter_factory.cpp
|
filter_factory.cpp
|
||||||
|
@ -116,6 +116,7 @@ source = Split(
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if env['JPEG']:
|
if env['JPEG']:
|
||||||
source += Split(
|
source += Split(
|
||||||
"""
|
"""
|
||||||
|
@ -146,10 +147,14 @@ if True : # agg backend
|
||||||
)
|
)
|
||||||
|
|
||||||
if 'cairo' in env['LIBS']:
|
if 'cairo' in env['LIBS']:
|
||||||
source += Split(
|
env2 = env.Clone()
|
||||||
"""
|
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
||||||
cairo_renderer.cpp
|
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
|
||||||
""")
|
for cpp in fixup:
|
||||||
|
if cpp in source:
|
||||||
|
source.remove(cpp)
|
||||||
|
for cpp in fixup:
|
||||||
|
source.insert(0,env2.SharedObject(cpp))
|
||||||
|
|
||||||
if env['XMLPARSER'] == 'tinyxml':
|
if env['XMLPARSER'] == 'tinyxml':
|
||||||
source += Split(
|
source += Split(
|
||||||
|
@ -165,7 +170,6 @@ elif env['XMLPARSER'] == 'libxml2':
|
||||||
libxml2_loader.cpp
|
libxml2_loader.cpp
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
mapnik = env.SharedLibrary('mapnik2', source, LIBS=libraries, LINKFLAGS=linkflags)
|
mapnik = env.SharedLibrary('mapnik2', source, LIBS=libraries, LINKFLAGS=linkflags)
|
||||||
if env['PLATFORM'] != 'Darwin':
|
if env['PLATFORM'] != 'Darwin':
|
||||||
# Symlink command, only works if both files are in same directory
|
# Symlink command, only works if both files are in same directory
|
||||||
|
@ -193,4 +197,5 @@ else:
|
||||||
env.Alias(target='install', source=env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'], mapnik))
|
env.Alias(target='install', source=env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'], mapnik))
|
||||||
|
|
||||||
includes = glob.glob('../include/mapnik/*.hpp')
|
includes = glob.glob('../include/mapnik/*.hpp')
|
||||||
|
|
||||||
env.Alias(target='install', source=env.Install(install_prefix+'/include/mapnik', includes))
|
env.Alias(target='install', source=env.Install(install_prefix+'/include/mapnik', includes))
|
||||||
|
|
Loading…
Reference in a new issue