rscons/build_tests/simple/standard_build.rb
Josh Holtrop f8e6666a2c Add 'build' DSL method.
Disallow processing Environments until configuration is performed.
2018-12-17 22:14:35 -05:00

20 lines
576 B
Ruby

build do
class MyCommand < Rscons::Builder
def run(target, sources, cache, env, vars)
vars = vars.merge({
"_TARGET" => target,
"_SOURCES" => sources,
})
command = env.build_command("${CMD}", vars)
cmd_desc = vars["CMD_DESC"] || "MyCommand"
standard_build("#{cmd_desc} #{target}", target, command, sources, env, cache)
end
end
Rscons::Environment.new do |env|
env.add_builder(MyCommand.new)
command = %w[gcc -c -o ${_TARGET} ${_SOURCES}]
env.MyCommand("simple.o", "simple.c", "CMD" => command)
end
end