scons: better handling of PYTHON_INCLUDES and HAVE_LIBXML2
This commit is contained in:
parent
d549cfe30a
commit
08e96be4a1
6 changed files with 40 additions and 13 deletions
15
SConstruct
15
SConstruct
|
@ -333,7 +333,8 @@ pickle_store = [# Scons internal variables
|
||||||
'HAS_BOOST_SYSTEM',
|
'HAS_BOOST_SYSTEM',
|
||||||
'SVN_REVISION',
|
'SVN_REVISION',
|
||||||
'HAS_CAIRO',
|
'HAS_CAIRO',
|
||||||
'HAS_PYCAIRO'
|
'HAS_PYCAIRO',
|
||||||
|
'HAS_LIBXML2'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add all other user configurable options to pickle pickle_store
|
# Add all other user configurable options to pickle pickle_store
|
||||||
|
@ -726,6 +727,7 @@ if not preconfigured:
|
||||||
env['SKIPPED_DEPS'] = []
|
env['SKIPPED_DEPS'] = []
|
||||||
env['HAS_CAIRO'] = False
|
env['HAS_CAIRO'] = False
|
||||||
env['HAS_PYCAIRO'] = False
|
env['HAS_PYCAIRO'] = False
|
||||||
|
env['HAS_LIBXML2'] = False
|
||||||
|
|
||||||
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
||||||
env['PLUGINS'] = PLUGINS
|
env['PLUGINS'] = PLUGINS
|
||||||
|
@ -778,7 +780,7 @@ if not preconfigured:
|
||||||
env.Append(CXXFLAGS = '-DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
|
env.Append(CXXFLAGS = '-DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
|
||||||
elif env['XMLPARSER'] == 'libxml2':
|
elif env['XMLPARSER'] == 'libxml2':
|
||||||
if conf.parse_config('XML2_CONFIG'):
|
if conf.parse_config('XML2_CONFIG'):
|
||||||
env.Append(CXXFLAGS = '-DHAVE_LIBXML2')
|
env['HAS_LIBXML2'] = True
|
||||||
|
|
||||||
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['HAS_CAIRO'] = True
|
env['HAS_CAIRO'] = True
|
||||||
|
@ -1084,11 +1086,18 @@ if not preconfigured:
|
||||||
|
|
||||||
majver, minver = env['PYTHON_VERSION'].split('.')
|
majver, minver = env['PYTHON_VERSION'].split('.')
|
||||||
|
|
||||||
# TODO - this needs to be moved up...
|
# we don't want the includes it in the main environment...
|
||||||
|
# as they are later set in the python SConscript
|
||||||
|
# ugly hack needed until we have env specific conf
|
||||||
|
backup = env.Clone().Dictionary()
|
||||||
env.AppendUnique(CPPPATH = env['PYTHON_INCLUDES'])
|
env.AppendUnique(CPPPATH = env['PYTHON_INCLUDES'])
|
||||||
|
|
||||||
if not conf.CheckHeader(header='Python.h',language='C'):
|
if not conf.CheckHeader(header='Python.h',language='C'):
|
||||||
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
|
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
|
||||||
|
env.Replace(**backup)
|
||||||
env['MISSING_DEPS'].append('python %s development headers' % env['PYTHON_VERSION'])
|
env['MISSING_DEPS'].append('python %s development headers' % env['PYTHON_VERSION'])
|
||||||
|
else:
|
||||||
|
env.Replace(**backup)
|
||||||
|
|
||||||
if (int(majver), int(minver)) < (2, 2):
|
if (int(majver), int(minver)) < (2, 2):
|
||||||
color_print(1,"Python version 2.2 or greater required")
|
color_print(1,"Python version 2.2 or greater required")
|
||||||
|
|
|
@ -21,7 +21,9 @@ import glob
|
||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
|
|
||||||
|
agg_env = env.Clone()
|
||||||
|
|
||||||
if env['PLATFORM'] == 'SunOS':
|
if env['PLATFORM'] == 'SunOS':
|
||||||
env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CPPPATH='./include', CXXFLAGS='-O -KPIC -DNDEBUG')
|
agg_env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CPPPATH='./include', CXXFLAGS='-O -KPIC -DNDEBUG')
|
||||||
else:
|
else:
|
||||||
env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CPPPATH='./include', CXXFLAGS='-O%s -fPIC -DNDEBUG' % env['OPTIMIZATION'])
|
agg_env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CPPPATH='./include', CXXFLAGS='-O%s -fPIC -DNDEBUG' % env['OPTIMIZATION'])
|
||||||
|
|
|
@ -30,7 +30,6 @@ install_prefix = env['DESTDIR'] + '/' + prefix
|
||||||
|
|
||||||
linkflags = ''
|
linkflags = ''
|
||||||
libraries = ['mapnik2','png','jpeg']
|
libraries = ['mapnik2','png','jpeg']
|
||||||
headers = [env['PYTHON_INCLUDES']] + env['CPPPATH']
|
|
||||||
|
|
||||||
if env['BOOST_PYTHON_LIB']:
|
if env['BOOST_PYTHON_LIB']:
|
||||||
if os.path.sep in env['BOOST_PYTHON_LIB']:
|
if os.path.sep in env['BOOST_PYTHON_LIB']:
|
||||||
|
@ -141,9 +140,12 @@ env.Alias(target='install', source=ogcserver_module)
|
||||||
sources = glob.glob('*.cpp')
|
sources = glob.glob('*.cpp')
|
||||||
|
|
||||||
|
|
||||||
|
py_env = env.Clone()
|
||||||
|
py_env.Append(CPPPATH = env['PYTHON_INCLUDES'])
|
||||||
|
|
||||||
if env['SVN_REVISION']:
|
if env['SVN_REVISION']:
|
||||||
sources.remove('mapnik_python.cpp')
|
sources.remove('mapnik_python.cpp')
|
||||||
env2 = env.Clone()
|
env2 = py_env.Clone()
|
||||||
env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
|
env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
|
||||||
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||||
if env['HAS_CAIRO']:
|
if env['HAS_CAIRO']:
|
||||||
|
@ -155,7 +157,7 @@ if env['SVN_REVISION']:
|
||||||
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
|
sources.insert(0,env2.SharedObject('mapnik_python.cpp'))
|
||||||
|
|
||||||
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||||
env2 = env.Clone()
|
env2 = py_env.Clone()
|
||||||
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
|
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
|
||||||
fixup = ['mapnik_image.cpp','python_cairo.cpp']
|
fixup = ['mapnik_image.cpp','python_cairo.cpp']
|
||||||
for cpp in fixup:
|
for cpp in fixup:
|
||||||
|
@ -168,6 +170,8 @@ if env['HAS_CAIRO'] or env['HAS_PYCAIRO']:
|
||||||
for cpp in fixup:
|
for cpp in fixup:
|
||||||
sources.insert(0,env2.SharedObject(cpp))
|
sources.insert(0,env2.SharedObject(cpp))
|
||||||
|
|
||||||
_mapnik = env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
|
|
||||||
|
_mapnik = py_env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',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)
|
py_env.Alias(target='install',source=pymapniklib)
|
||||||
|
|
|
@ -150,12 +150,11 @@ if True : # agg backend
|
||||||
if env['HAS_CAIRO']:
|
if env['HAS_CAIRO']:
|
||||||
env2 = env.Clone()
|
env2 = env.Clone()
|
||||||
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
env2.Append(CXXFLAGS = '-DHAVE_CAIRO')
|
||||||
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
|
env2.ParseConfig('pkg-config --libs --cflags cairomm-1.0')
|
||||||
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
|
fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp']
|
||||||
for cpp in fixup:
|
for cpp in fixup:
|
||||||
if cpp in source:
|
if cpp in source:
|
||||||
source.remove(cpp)
|
source.remove(cpp)
|
||||||
for cpp in fixup:
|
|
||||||
source.insert(0,env2.SharedObject(cpp))
|
source.insert(0,env2.SharedObject(cpp))
|
||||||
|
|
||||||
if env['XMLPARSER'] == 'tinyxml':
|
if env['XMLPARSER'] == 'tinyxml':
|
||||||
|
@ -166,11 +165,18 @@ if env['XMLPARSER'] == 'tinyxml':
|
||||||
../tinyxml/tinyxmlerror.cpp
|
../tinyxml/tinyxmlerror.cpp
|
||||||
../tinyxml/tinyxmlparser.cpp
|
../tinyxml/tinyxmlparser.cpp
|
||||||
""")
|
""")
|
||||||
elif env['XMLPARSER'] == 'libxml2':
|
elif env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']:
|
||||||
source += Split(
|
source += Split(
|
||||||
"""
|
"""
|
||||||
libxml2_loader.cpp
|
libxml2_loader.cpp
|
||||||
""")
|
""")
|
||||||
|
env2 = env.Clone()
|
||||||
|
env2.Append(CXXFLAGS = '-DHAVE_LIBXML2')
|
||||||
|
fixup = ['load_map.cpp','libxml2_loader.cpp']
|
||||||
|
for cpp in fixup:
|
||||||
|
if cpp in source:
|
||||||
|
source.remove(cpp)
|
||||||
|
source.insert(0,env2.SharedObject(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':
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBXML2
|
||||||
|
|
||||||
#include <mapnik/libxml2_loader.hpp>
|
#include <mapnik/libxml2_loader.hpp>
|
||||||
|
|
||||||
#include <mapnik/config_error.hpp>
|
#include <mapnik/config_error.hpp>
|
||||||
|
@ -222,3 +224,5 @@ void read_xml2_string( std::string const & str, boost::property_tree::ptree & pt
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace mapnik
|
} // end of namespace mapnik
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include <mapnik/font_set.hpp>
|
#include <mapnik/font_set.hpp>
|
||||||
|
|
||||||
#include <mapnik/ptree_helpers.hpp>
|
#include <mapnik/ptree_helpers.hpp>
|
||||||
|
#ifdef HAVE_LIBXML2
|
||||||
#include <mapnik/libxml2_loader.hpp>
|
#include <mapnik/libxml2_loader.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <mapnik/filter_factory.hpp>
|
#include <mapnik/filter_factory.hpp>
|
||||||
#include <mapnik/parse_path.hpp>
|
#include <mapnik/parse_path.hpp>
|
||||||
|
|
Loading…
Reference in a new issue