scons脚本示例
import os def list_dir(dir): all_dirs = [] for root, dirs, files in os.walk('./', True): for name in dirs: cur_dir = os.path.join(root,name) if cur_dir.find(".svn") < 0: all_dirs.append(cur_dir) return all_dirs CPLUS_INCLUDE = os.getenv('CPLUS_INCLUDE') CPLUS_LIB =os.getenv('CPLUS_LIB') env = Environment(ENV=os.environ) inc_flags = {'CPPPATH' : [CPLUS_INCLUDE, ‘…’]} env.MergeFlags(inc_flags) cc_flags = {'CCFLAGS' : ['-D_LINUX', '-D_DEBUG', '-ggdb', '-rdynamic']} env.MergeFlags(cc_flags) lib0 = File('../../library/lib/libidip.a') …
lib15 = File(CPLUS_LIB + '/libleveldb.a') obj = Glob('./*.cpp') all_dirs = list_dir('./') for dir in all_dirs: obj += Glob(dir + '/*.cpp') env.Program('game_d', list(obj), LIBS=[lib0, lib1,lib2,lib3,lib4,lib5,lib6,lib7,lib8,lib9,lib10,lib11,lib12,lib13,lib14,lib15,'pthread','iconv','rt'])
需要修改…部分,一个是lib、还有一个是include,此脚本作为工作笔记,以后用到可以参照