scons: specialize CFLAGS for the only python cpp file that needs SVN_REVISION passed to it

This commit is contained in:
Dane Springmeyer 2010-07-14 00:48:06 +00:00
parent 13cfffd603
commit 146c13ba09
2 changed files with 16 additions and 14 deletions

View file

@ -331,6 +331,7 @@ pickle_store = [# Scons internal variables
'PYTHON_SYS_PREFIX',
'COLOR_PRINT',
'HAS_BOOST_SYSTEM',
'SVN_REVISION'
]
# Add all other user configurable options to pickle pickle_store
@ -985,19 +986,12 @@ if not preconfigured:
else :
common_cxx_flags = '-D%s ' % env['PLATFORM'].upper()
if not env['FAST']:
# if we are in SCons FAST mode then make to
# to avoid unnessary re-compiles due to changing
# CFLAGS when revision number increases
svn_version = call('svnversion')
if not svn_version == 'exported':
pattern = r'(\d+)(.*)'
try:
rev = re.match(pattern,svn_version).groups()[0]
common_cxx_flags += '-DSVN_REVISION=%s ' % rev
except: pass
svn_version = call('svnversion')
if not svn_version == 'exported':
pattern = r'(\d+)(.*)'
try:
env['SVN_REVISION'] = re.match(pattern,svn_version).groups()[0]
except: pass
# Mac OSX (Darwin) special settings
if env['PLATFORM'] == 'Darwin':

View file

@ -137,6 +137,14 @@ env.Alias(target='install', source=ogcserver_module)
# install the shared object beside the module directory
_mapnik = env.LoadableModule('mapnik/_mapnik2', glob.glob('*.cpp'), LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
sources = glob.glob('*.cpp')
if env.get('SVN_REVISION'):
sources.remove('mapnik_python.cpp')
env2 = env.Clone();
env2.Append(CCFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION'])
sources.insert(0,env2.Object('mapnik_python.cpp'))
_mapnik = env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so', CPPPATH=headers,LINKFLAGS=linkflags)
pymapniklib = env.Install(env['PYTHON_INSTALL_LOCATION'] + '/mapnik2',_mapnik)
env.Alias(target='install',source=pymapniklib)