2010-07-15 23:09:33 +00:00
|
|
|
import os
|
|
|
|
import glob
|
2011-08-12 21:31:28 +00:00
|
|
|
from copy import copy
|
2010-07-15 23:09:33 +00:00
|
|
|
|
|
|
|
Import ('env')
|
|
|
|
|
2011-08-12 21:31:28 +00:00
|
|
|
test_env = env.Clone()
|
|
|
|
|
2013-05-22 16:21:56 +00:00
|
|
|
if not env['CPP_TESTS']:
|
|
|
|
for cpp_test_bin in glob.glob('*-bin'):
|
|
|
|
os.unlink(cpp_test_bin)
|
|
|
|
else:
|
2014-06-09 20:55:56 +00:00
|
|
|
test_env['LIBS'] = [env['MAPNIK_NAME']]
|
2013-07-14 17:00:53 +00:00
|
|
|
test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS']))
|
2013-07-14 19:17:32 +00:00
|
|
|
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
|
|
|
|
test_env.AppendUnique(LIBS='dl')
|
2013-05-22 16:21:56 +00:00
|
|
|
test_env.AppendUnique(CXXFLAGS='-g')
|
|
|
|
test_env['CXXFLAGS'] = copy(test_env['LIBMAPNIK_CXXFLAGS'])
|
2013-07-24 00:03:00 +00:00
|
|
|
test_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
|
2013-05-22 16:21:56 +00:00
|
|
|
if test_env['HAS_CAIRO']:
|
|
|
|
test_env.PrependUnique(CPPPATH=test_env['CAIRO_CPPPATHS'])
|
|
|
|
test_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
|
|
|
for cpp_test in glob.glob('*_test.cpp'):
|
|
|
|
name = cpp_test.replace('.cpp','-bin')
|
|
|
|
source_files = [cpp_test]
|
|
|
|
test_program = None
|
|
|
|
# enable for faster compile while developing just this test
|
|
|
|
#if 'agg_blend_src_over_test' in cpp_test:
|
|
|
|
if False:
|
|
|
|
# customization here for faster compile
|
|
|
|
agg_env = Environment(ENV=os.environ)
|
|
|
|
agg_env['CXX'] = env['CXX']
|
|
|
|
agg_env['CXXFLAGS'] = env['CXXFLAGS']
|
|
|
|
if 'agg' in test_env['LIBS']:
|
|
|
|
agg_env.AppendUnique(LIBS='agg')
|
|
|
|
agg_env.Append(CPPPATH = '#deps/agg/include')
|
|
|
|
agg_env.Append(LIBPATH = '#deps/agg')
|
|
|
|
agg_env['CPPPATH'] = ['#deps/agg/include',env['BOOST_INCLUDES']]
|
2013-10-22 20:35:46 +00:00
|
|
|
test_program = agg_env.Program(name, source=source_files)
|
2013-05-22 16:21:56 +00:00
|
|
|
else:
|
|
|
|
test_env_local = test_env.Clone()
|
|
|
|
if 'csv_parse' in cpp_test:
|
|
|
|
source_files += glob.glob('../../plugins/input/csv/' + '*.cpp')
|
2013-10-22 20:35:46 +00:00
|
|
|
test_program = test_env_local.Program(name, source=source_files)
|
2013-05-22 16:21:56 +00:00
|
|
|
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
|
|
|
# build locally if installing
|
|
|
|
if 'install' in COMMAND_LINE_TARGETS:
|
|
|
|
env.Alias('install',test_program)
|