scons: collect and propogate the libs used to link libmapnik

This commit is contained in:
Dane Springmeyer 2011-08-11 21:11:11 +00:00
parent 82ac99611e
commit af62ad9c27
6 changed files with 43 additions and 60 deletions

View file

@ -942,6 +942,7 @@ if not preconfigured:
env['HAS_PYCAIRO'] = False
env['HAS_LIBXML2'] = False
env['SVN_REVISION'] = None
env['LIBMAPNIK_LIBS'] = []
if env['LINKING'] == 'static':
env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik2${LIBSUFFIX}'
else:

View file

@ -34,21 +34,9 @@ demo_env = env.Clone()
headers = env['CPPPATH']
boost_regex = 'boost_regex%s' % env['BOOST_APPEND']
libraries = ['mapnik2']
if env['THREADING'] == 'multi':
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
if env['HAS_CAIRO'] in env['CXXFLAGS']:
# add cairo and cairomm-1.0 to libs
libraries.append('cairomm-1.0')
libraries.append('cairo')
if env['PLATFORM'] in ('Darwin','SunOS'):
libraries.append(boost_regex)
libraries.append(env['ICU_LIB_NAME'])
libraries = env['LIBMAPNIK_LIBS']
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries.extend([boost_program_options,'mapnik2'])
rundemo = demo_env.Program('rundemo', source, CPPPATH=headers, LIBS=libraries, LINKFLAGS=env["CUSTOM_LDFLAGS"])

View file

@ -52,27 +52,28 @@ install_prefix = env['DESTDIR'] + '/' + prefix
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
regex = 'boost_regex%s' % env['BOOST_APPEND']
libraries = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,regex]
# clear out and re-set libs for this env
lib_env['LIBS'] = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,regex]
if env['HAS_CAIRO']:
# add cairo and cairomm-1.0 to libs
libraries.append('cairomm-1.0')
libraries.append('cairo')
lib_env['LIBS'].append('cairomm-1.0')
lib_env['LIBS'].append('cairo')
if env['XMLPARSER'] == 'libxml2':
libraries.append('xml2')
lib_env['LIBS'].append('xml2')
if env['THREADING'] == 'multi':
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
if env['PLATFORM'] in ('Darwin','SunOS'):
if env['HAS_BOOST_SYSTEM']:
libraries.append('boost_system%s' % env['BOOST_APPEND'])
lib_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND'])
if env['INTERNAL_LIBAGG']:
libraries.insert(0, 'agg')
lib_env['LIBS'].insert(0, 'agg')
else:
libraries.append([lib for lib in env['LIBS'] if lib.startswith('agg')])
lib_env['LIBS'].append([lib for lib in env['LIBS'] if lib.startswith('agg')])
if env['PLATFORM'] == 'Darwin':
@ -155,7 +156,11 @@ source = Split(
if env['LIBTOOL_SUPPORTS_ADVISE']:
env3 = lib_env.Clone()
env3.Append(CXXFLAGS='-DLIBTOOL_SUPPORTS_ADVISE')
source.insert(0,env3.SharedObject('datasource_cache.cpp'))
cpp = 'datasource_cache.cpp'
if env['LINKING'] == 'static':
source.insert(0,env3.StaticObject(cpp))
else:
source.insert(0,env3.SharedObject(cpp))
else:
source.insert(0,'datasource_cache.cpp')
@ -236,7 +241,10 @@ if env['HAS_CAIRO']:
for cpp in fixup:
if cpp in source:
source.remove(cpp)
source.insert(0,env2.SharedObject(cpp))
if env['LINKING'] == 'static':
source.insert(0,env2.StaticObject(cpp))
else:
source.insert(0,env2.SharedObject(cpp))
except OSError, e:
print '\nFailed to detect cairo/cairomm configuration, please re-run "python scons/scons.py configure"'
sys.exit(1)
@ -260,20 +268,23 @@ elif env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']:
for cpp in fixup:
if cpp in source:
source.remove(cpp)
source.insert(0,env2.SharedObject(cpp))
if env['LINKING'] == 'static':
source.insert(0,env2.StaticObject(cpp))
else:
source.insert(0,env2.SharedObject(cpp))
if env['CUSTOM_LDFLAGS']:
linkflags = '%s %s' % (env['CUSTOM_LDFLAGS'], mapnik_lib_link_flag)
else:
linkflags = mapnik_lib_link_flag
if env['LIBMAPNIK_LINKFLAGS']:
linkflags = '%s %s' % (env['LIBMAPNIK_LINKFLAGS'],linkflags)
if env['LINKING'] == 'static':
mapnik = lib_env.StaticLibrary('mapnik2', source, LIBS=libraries, LINKFLAGS=linkflags)
mapnik = lib_env.StaticLibrary('mapnik2', source, LINKFLAGS=linkflags)
else:
mapnik = lib_env.SharedLibrary('mapnik2', source, LIBS=libraries, LINKFLAGS=linkflags)
mapnik = lib_env.SharedLibrary('mapnik2', source, LINKFLAGS=linkflags)
# cache libraries value for other builds to use
env['LIBMAPNIK_LIBS'] = lib_env['LIBS']
if env['PLATFORM'] != 'Darwin':
# Symlink command, only works if both files are in same directory

View file

@ -5,17 +5,9 @@ Import ('env')
headers = env['CPPPATH']
boost_filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
boost_system = 'boost_system%s' % env['BOOST_APPEND']
boost_regex = 'boost_regex%s' % env['BOOST_APPEND']
libraries = [boost_filesystem, boost_regex, 'mapnik2']
if env['PLATFORM'] == 'Darwin':
libraries.append(env['ICU_LIB_NAME'])
if env['HAS_BOOST_SYSTEM']:
libraries.append(boost_system)
libraries = env['LIBMAPNIK_LIBS']
libraries.append('mapnik2')
for cpp_test in glob.glob('*_test.cpp'):
env.Program(cpp_test.replace('.cpp',''), [cpp_test], CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
test_program = env.Program(cpp_test.replace('.cpp',''), [cpp_test], CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))

View file

@ -35,15 +35,14 @@ source = Split(
headers = ['#plugins/input/postgis'] + env['CPPPATH']
libraries = env['LIBMAPNIK_LIBS']
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries = [boost_program_options,'sqlite3','pq','mapnik2']
if env['PLATFORM'] == 'Darwin':
libraries.append(env['ICU_LIB_NAME'])
libraries.extend([boost_program_options,'sqlite3','pq','mapnik2'])
if 'uninstall' not in COMMAND_LINE_TARGETS:
pgsql2sqlite = program_env.Program('pgsql2sqlite', source, CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
Depends(pgsql2sqlite, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
env.Install(install_prefix + '/bin', pgsql2sqlite)
env.Alias('install', install_prefix + '/bin')

View file

@ -36,22 +36,14 @@ source = Split(
headers = env['CPPPATH']
libraries = env['LIBMAPNIK_LIBS']
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
boost_filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
libraries = [boost_program_options,boost_filesystem,'mapnik2']
boost_system = 'boost_system%s' % env['BOOST_APPEND']
if env['HAS_BOOST_SYSTEM']:
libraries.append(boost_system)
if env['INTERNAL_LIBAGG']:
libraries.insert(0, 'agg')
else:
libraries.append([lib for lib in env['LIBS'] if lib.startswith('agg')])
libraries.extend([boost_program_options,'mapnik2'])
svg2png = program_env.Program('svg2png', source, CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
Depends(svg2png, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
if 'uninstall' not in COMMAND_LINE_TARGETS:
env.Install(install_prefix + '/bin', svg2png)
env.Alias('install', install_prefix + '/bin')