游戏开发

本类阅读TOP10

·初学者的福音:游戏开发新手入门指南
·《学VC、编游戏》重点算法解疑·快一点
·Windows的消息机制与消息重定向技术
·《学VC、编游戏》重点算法解疑·再快一点
·Rogue Guide
·《学VC、编游戏》重点算法解疑·狩猎谋生
·通向天才之路 : 把模块塞到动态连接库里去
·完成端口的深入理解及一种变态用法
·DirectX 9.0 SDK 开发包下载(April 2005)
·在OpenGL中实现多纹理混合(Multi-texture Blending)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
build a tool in scons, then using it

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

from ::URL::http://www.scons.org/cgi-bin/wiki/UsingCodeGenerators

==

One fairly common requirement in builds is to create some tool from source code, and then use that tool as part of the build to generate other files. This example shows how to do that, with thanks to Gary Oberbrunner. The tool to be generated is named mk_vds, and is built from the source file mk_vds.c. Then .txt input files are used by mk_vds to generate .vds files. 

# SConstruct file 
env=Environment() 
 
# Create the mk_vds generator tool 
mk_vds_tool = env.Program(target= 'mk_vds', source = 'mk_vds.c') 
 
# This emitter will be used later by a Builder, and has an explcit dependency on the mk_vds tool 
def mk_vds_emitter(target, source, env): 
    env.Depends(target, mk_vds_tool) 
    return (target, source) 
 
# Create a builder (that uses the emitter) to build .vds files from .txt files 
# The use of abspath is so that mk_vds's directory doesn't have to be added to the shell path. 
bld = Builder(action = mk_vds[0].abspath + ' < $SOURCE > $TARGET', 
              emitter = mk_vds_emitter, 
              suffix = '.vds', src_suffix = '.txt') 
 
# Add the new Builder to the list of builders 
env['BUILDERS']['MK_VDS'] = bld 
 
# Generate foo.vds from foo.txt using mk_vds 
env.MK_VDS('foo.txt') 

If you look at the resulting dependency tree you can see it works: 

% scons --debug=tree foo.vds 
+-foo.vds 
  +-foo.txt 
  +-mk_vds 
    +-mk_vds.o 
      +-mk_vds.c 




相关文章

相关软件