blob: cf73449bb548b0b13cfdebdfae734b32036978a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
rule("cppfront")
set_extensions(".cpp2")
on_load(function (target)
local rule = target:rule("c++.build"):clone()
rule:add("deps", "cppfront", {order = true})
target:rule_add(rule)
end)
on_build_file(function (target, sourcefile, opt)
print("build cppfront file")
local objectfile = target:objectfile(sourcefile:gsub("cpp2", "cpp"))
assert(not os.isfile(objectfile), "invalid rule order!")
end)
target("test")
set_kind("binary")
add_rules("cppfront")
add_files("src/*.cpp")
add_files("src/*.cpp2")
before_build_file(function (target, sourcefile, opt)
local objectfile = target:objectfile(sourcefile)
os.tryrm(objectfile)
end)
|