scons: ditch brittle handling of cairo flags for python bindings, moving to more dimple reading of paths used for libmapnik
This commit is contained in:
parent
3c3d449c6f
commit
d19cf41d05
1 changed files with 11 additions and 35 deletions
|
@ -42,7 +42,10 @@ def is_py3():
|
|||
prefix = env['PREFIX']
|
||||
target_path = env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2'
|
||||
|
||||
libraries = ['mapnik2','png','jpeg']
|
||||
libraries = ['mapnik2','png']
|
||||
|
||||
if env['JPEG']:
|
||||
libraries.append('jpeg')
|
||||
|
||||
if env['BOOST_PYTHON_LIB']:
|
||||
if os.path.sep in env['BOOST_PYTHON_LIB']:
|
||||
|
@ -168,46 +171,19 @@ sources = glob.glob('*.cpp')
|
|||
py_env = env.Clone()
|
||||
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
|
||||
|
||||
if env['HAS_CAIRO']:
|
||||
py_env.Append(CPPPATH = env['CAIROMM_CPPPATHS'])
|
||||
|
||||
if env['HAS_PYCAIRO']:
|
||||
py_env.ParseConfig('pkg-config --cflags pycairo')
|
||||
py_env.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
|
||||
|
||||
if env['SVN_REVISION']:
|
||||
sources.remove('mapnik_python.cpp')
|
||||
env2 = py_env.Clone()
|
||||
env2.Append(CXXFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
|
||||
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||
try:
|
||||
if env['HAS_CAIRO']:
|
||||
env2.ParseConfig('pkg-config --cflags cairomm-1.0')
|
||||
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
||||
if env['HAS_PYCAIRO']:
|
||||
env2.ParseConfig('pkg-config --cflags pycairo')
|
||||
env2.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
|
||||
except OSError, e:
|
||||
print '\nFailed to detect cairo/cairomm configuration, please re-run "python scons/scons.py configure"'
|
||||
sys.exit(1)
|
||||
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
|
||||
|
||||
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||
# attach libs to _mapnik.so linking environment
|
||||
cmd = 'pkg-config --libs cairomm-1.0'
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd += ' --static'
|
||||
py_env.ParseConfig(cmd)
|
||||
env2 = py_env.Clone()
|
||||
fixup = ['mapnik_image.cpp','python_cairo.cpp']
|
||||
if not env['SVN_REVISION']:
|
||||
fixup.append('mapnik_python.cpp')
|
||||
for cpp in fixup:
|
||||
if cpp in sources:
|
||||
sources.remove(cpp)
|
||||
if env['HAS_CAIRO']:
|
||||
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
||||
env2.ParseConfig('pkg-config --cflags cairomm-1.0')
|
||||
if env['HAS_PYCAIRO']:
|
||||
env2.ParseConfig('pkg-config --cflags pycairo')
|
||||
env2.Append(CXXFLAGS = '-DHAVE_PYCAIRO')
|
||||
for cpp in fixup:
|
||||
sources.insert(0,env2.SharedObject(cpp))
|
||||
|
||||
|
||||
_mapnik = py_env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags)
|
||||
|
||||
Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
|
Loading…
Reference in a new issue