From: <de...@us...> - 2006-03-03 15:02:03
|
Revision: 1787 Author: dennis Date: 2006-03-03 07:01:56 -0800 (Fri, 03 Mar 2006) ViewCVS: http://svn.sourceforge.net/freeorion?rev=1787&view=rev Log Message: ----------- Rewrote inclusion of Version.cpp in a way that should get rid of SCons warnings and not result in SCons recompiling every single file when the revision changes. SCons recompiles a file every time the CPPDEFINES have changed. Modified Paths: -------------- trunk/FreeOrion/SConscript Modified: trunk/FreeOrion/SConscript =================================================================== --- trunk/FreeOrion/SConscript 2006-03-03 06:57:56 UTC (rev 1786) +++ trunk/FreeOrion/SConscript 2006-03-03 15:01:56 UTC (rev 1787) @@ -115,19 +115,20 @@ inf = popen("svn info") for i in inf: if i[:10] == "Revision: ": - # this \" madness is a workaround of what seems to be an SCons bug - # in combination with gcc. It might break on msvc, in that case, we - # need a check for msvc return r'\" [Rev ' + i[10:-1] + r']\"' except: return None objects = env.Object(common_sources) -if get_revision(env): - env.AppendUnique(CPPDEFINES = [('FREEORION_REVISION', get_revision(env))]) +# This evil line should prevent SCons from issuing a warning +# [b,a][c==d] is equivalent to C's c==d?a:b +# So what is does is defining FREEORION_REVISION if get_revision +# returned one +objects += env.Object('util/Version.cpp', CPPDEFINES = [ + [('FREEORION_REVISION', get_revision(env))], + []][get_revision(common_sources) == None] +) -objects += env.Object('util/Version.cpp') - objects += [env.Object(target = source.split(".")[0] + '-' + target, source = source, CPPDEFINES = env['CPPDEFINES'] + [env['target_define']]) |