| 1 | # This file is part of Mapnik (c++ mapping toolkit) |
|---|
| 2 | # Copyright (C) 2005 Artem Pavlenko |
|---|
| 3 | # |
|---|
| 4 | # Mapnik is free software; you can redistribute it and/or |
|---|
| 5 | # modify it under the terms of the GNU General Public License |
|---|
| 6 | # as published by the Free Software Foundation; either version 2 |
|---|
| 7 | # of the License, or any later version. |
|---|
| 8 | # |
|---|
| 9 | # This program is distributed in the hope that it will be useful, |
|---|
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | # GNU General Public License for more details. |
|---|
| 13 | # |
|---|
| 14 | # You should have received a copy of the GNU General Public License |
|---|
| 15 | # along with this program; if not, write to the Free Software |
|---|
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 17 | # |
|---|
| 18 | # $Id$ |
|---|
| 19 | |
|---|
| 20 | import os |
|---|
| 21 | |
|---|
| 22 | #edit 'settings.py' to match your system settings |
|---|
| 23 | opts = Options('settings.py') |
|---|
| 24 | |
|---|
| 25 | opts.Add('PREFIX', 'Set the install "prefix"', '/opt/mapnik') |
|---|
| 26 | opts.Add(PathOption('BOOST_ROOT','boost source root directory','/opt/boost')) |
|---|
| 27 | opts.Add(PathOption('AGG_ROOT','agg source root directory','/opt/agg23')) |
|---|
| 28 | opts.Add(PathOption('FREETYPE2_ROOT','freetype2 root directory','/opt/freetype2')) |
|---|
| 29 | opts.Add(PathOption('PYTHON_ROOT','python root directory','/opt/python')) |
|---|
| 30 | opts.Add('PYTHON_VERSION','python version','2.4') |
|---|
| 31 | opts.Add(ListOption('DATASOURCES','list of available datasources','postgis',['postgis','shape'])) |
|---|
| 32 | opts.Add('POSTGRESQL_ROOT','path to postgresql prefix','/usr/local') |
|---|
| 33 | |
|---|
| 34 | platform = ARGUMENTS.get("OS",Platform()) |
|---|
| 35 | |
|---|
| 36 | build_dir = 'build' |
|---|
| 37 | build_prefix = build_dir+'/'+str(platform) |
|---|
| 38 | |
|---|
| 39 | cxx = 'g++' |
|---|
| 40 | |
|---|
| 41 | env = Environment(CXX=cxx,ENV=os.environ, options=opts) |
|---|
| 42 | |
|---|
| 43 | cxx_debug='-Wall -ftemplate-depth-100 -O0 -fno-inline -g -pthread -DDEBUG' |
|---|
| 44 | cxx_release='-Wall -ftemplate-depth-100 -O3 -finline-functions -Wno-inline -pthread -DNDEBUG' |
|---|
| 45 | |
|---|
| 46 | release_env = env.Copy(CXXFLAGS = cxx_release) |
|---|
| 47 | debug_env = env.Copy(CXXFLAGS = cxx_debug) |
|---|
| 48 | |
|---|
| 49 | if ARGUMENTS.get('debug',0): |
|---|
| 50 | env.Append(CXXFLAGS = cxx_debug) |
|---|
| 51 | build_prefix+='/debug' |
|---|
| 52 | else: |
|---|
| 53 | env.Append(CXXFLAGS = cxx_release) |
|---|
| 54 | build_prefix+='/release' |
|---|
| 55 | |
|---|
| 56 | Help(opts.GenerateHelpText(env)) |
|---|
| 57 | |
|---|
| 58 | conf = Configure(env) |
|---|
| 59 | |
|---|
| 60 | if not conf.CheckLibWithHeader('ltdl','ltdl.h','C'): |
|---|
| 61 | print 'Could not find libltdl/headers , exiting!' |
|---|
| 62 | Exit(1) |
|---|
| 63 | |
|---|
| 64 | if not conf.CheckLib('z'): |
|---|
| 65 | print 'Could not find libz , exiting!' |
|---|
| 66 | Exit(1) |
|---|
| 67 | |
|---|
| 68 | if not conf.CheckLibWithHeader('png','png.h','C'): |
|---|
| 69 | print 'Could not find libpng/headers, exiting!' |
|---|
| 70 | Exit(1) |
|---|
| 71 | |
|---|
| 72 | if not conf.CheckLib('jpeg'): |
|---|
| 73 | print 'Could not find jpeg lib, exiting!' |
|---|
| 74 | Exit(1) |
|---|
| 75 | |
|---|
| 76 | env = conf.Finish() |
|---|
| 77 | |
|---|
| 78 | Export('env') |
|---|
| 79 | |
|---|
| 80 | #build boost libs (filesystem, regex, python) |
|---|
| 81 | env.SConscript('boost/SConscript') |
|---|
| 82 | |
|---|
| 83 | #build agg lib |
|---|
| 84 | env.SConscript('agg/SConscript') |
|---|
| 85 | |
|---|
| 86 | #main lib |
|---|
| 87 | SConscript('src/SConscript') |
|---|
| 88 | |
|---|
| 89 | #python ext |
|---|
| 90 | SConscript('python/SConscript') |
|---|
| 91 | |
|---|
| 92 | #shapeindex |
|---|
| 93 | SConscript('util/shapeindex/SConscript') |
|---|
| 94 | |
|---|
| 95 | #datasources |
|---|
| 96 | for datasource in Split(env['DATASOURCES']): |
|---|
| 97 | env.BuildDir('build/datasources/'+datasource,'src/datasources/'+datasource,duplicate=0) |
|---|
| 98 | SConscript('datasources/'+datasource+'/SConscript') |
|---|
| 99 | |
|---|
| 100 | |
|---|