[Scons-users] Generating a source file that changes
Carsten Fuchs
carsten.fuchs at cafu.de
Tue Oct 30 07:00:36 EDT 2012
Hi Francis,
thank you very much for your reply!
Am 30.10.2012 02:29, schrieb Francis Bolduc:
> def ValueFileBuilder(env, target, source):
> '''
> Ensure that target file contains source value.
> If source value changes, target file is rebuilt.
> Use this to specify dependency between source value and target file.
> '''
> f = file(str(target[0]), 'wb')
> f.write(source[0].get_contents())
> f.close()
>
> env['BUILDERS']['ValueFile'] = env.Builder(action = env.Action(ValueFileBuilder))
>
> Then you use it thus:
>
> app = env.Program('Ca3DE/Cafu',
> Glob("Ca3DE/*.cpp") + env.ValueFile('Ca3DE/auto-gen/AppCafu_GenList.cpp', generateCode))
I notice that you use source[0].get_contents() in the builder... but it makes me wonder what
generateCode() is supposed to return:
Should it write the contents to another temporary/intermediate file and return its filename,
or should it return the contents *as* the filename??
Best regards,
Carsten
--
Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
Learn more at http://www.cafu.de
More information about the Scons-users
mailing list