32c76d5a5f
2.fixed include/libs in datasources 3.revived shapeindex utility (+ boost::program_options)
100 lines
3.4 KiB
Python
100 lines
3.4 KiB
Python
# This file is part of Mapnik (c++ mapping toolkit)
|
|
# Copyright (C) 2005 Artem Pavlenko
|
|
#
|
|
# Mapnik is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
#
|
|
# $Id$
|
|
|
|
import os
|
|
import SCons.Errors
|
|
import SCons.Defaults
|
|
import glob
|
|
|
|
Import('env')
|
|
|
|
#env.Append(CCFLAGS = ' -DBOOST_PYTHON_DYNAMIC_LIB')
|
|
|
|
#boost python
|
|
prefix = env['PREFIX']
|
|
boost_root = env['BOOST_ROOT']
|
|
python_root = env['PYTHON_ROOT']
|
|
python_version = env['PYTHON_VERSION']
|
|
python_headers = python_root+'/include/python'+python_version
|
|
|
|
boost_python_src_dir = boost_root + '/libs/python/src/'
|
|
|
|
boost_python_src = glob.glob(boost_python_src_dir + '*.cpp')
|
|
boost_python_src.append(glob.glob(boost_python_src_dir + 'object/*.cpp'))
|
|
boost_python_src.append(glob.glob(boost_python_src_dir + 'converter/*.cpp'))
|
|
|
|
python_cpppath = python_root+'/include/python'+python_version
|
|
lib_boost_python = env.SharedLibrary('libboost-python',boost_python_src,CPPPATH=[boost_root,python_cpppath])
|
|
|
|
env.Install(prefix + '/lib',lib_boost_python)
|
|
|
|
agg_root = env['AGG_ROOT']
|
|
agg_headers = agg_root +'/include'
|
|
freetype2_root = env['FREETYPE2_ROOT']
|
|
|
|
|
|
def createPythonExtBuilder(env):
|
|
"""This is a utility function that creates boost-python
|
|
etxension Builder in an Environment if it is not there already.
|
|
If it is already there, we return the existing one.
|
|
"""
|
|
|
|
try:
|
|
python_ext = env['BUILDERS']['PythonExtension']
|
|
except KeyError:
|
|
action_list = [ SCons.Defaults.SharedCheck,
|
|
SCons.Defaults.ShLinkAction ]
|
|
python_ext = SCons.Builder.Builder(action = action_list,
|
|
emitter = "$SHLIBEMITTER",
|
|
prefix = '',
|
|
suffix = '$SHLIBSUFFIX',
|
|
target_scanner = SCons.Defaults.ProgScan,
|
|
src_suffix = '$SHOBJSUFFIX',
|
|
src_builder = 'SharedObject')
|
|
env['BUILDERS']['PythonExtension'] = python_ext
|
|
|
|
return python_ext
|
|
|
|
createPythonExtBuilder(env)
|
|
|
|
mapnik_python_src=Split(
|
|
"""
|
|
mapnik_color.cpp
|
|
mapnik_envelope.cpp
|
|
mapnik_image.cpp
|
|
mapnik_layer.cpp
|
|
mapnik_map.cpp
|
|
mapnik_parameters.cpp
|
|
mapnik_filter.cpp
|
|
mapnik_rule.cpp
|
|
mapnik_style.cpp
|
|
mapnik_stroke.cpp
|
|
mapnik_datasource_cache.cpp
|
|
mapnik_python.cpp
|
|
"""
|
|
)
|
|
|
|
headers =[ '#include',boost_root,freetype2_root,agg_headers,python_headers]
|
|
|
|
libraries=['mapnik','agg','boost-filesystem','boost-regex','boost-python']
|
|
libpaths = [prefix+"/lib",'#agg']
|
|
|
|
mapnik_python = env.PythonExtension(target='mapnik',source=mapnik_python_src,CPPPATH=headers,LIBS=libraries,LIBPATH=libpaths)
|
|
|
|
env.Alias(target="install",source=env.Install(prefix+'/lib',mapnik_python))
|