add "tweakers" functionality

tweakers allow the user to modify construction variables before any build is performed
This commit is contained in:
josh committed 2013-10-15 16:15:37 -04:00
1 parent 4a2997feec
commit 446fef931f
3 files changed
+46 -8

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
Rscons::Environment.new do |env|
env.append('CPPPATH' => Dir['src/**/*/'])
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
env.add_tweaker do |build_op|
if build_op[:target] =~ %r{build_one/.*\.o}
build_op[:vars]["CFLAGS"] << "-O1"
elsif build_op[:target] =~ %r{build_two/.*\.o}
build_op[:vars]["CFLAGS"] << "-O2"
end
end
env.Program('tweaker', Dir['src/**/*.c'])
end