main shrub/rvb / examples / c / plan.rvb
 1const c = import "../../buildc.rv"
 2
 3#we can list the directory and glob for .c to find our sources automatically.
 4const sources = {}
 5for entry in fs.readdir("."):unwrap() do
 6  if (entry.kind == :file and entry.name:ends_with?(".c"))
 7    sources:push(entry.name)
 8end
 9table.sort(sources)
10
11# global C settings.
12c.configure({
13  flags = {"-std=c99", "-Wall", "-Wextra", "-Werror", "-O2"},
14  deps = {"calc.h"},
15})
16
17const app = c.executable("calculator", {
18  sources = sources,
19  cc = {"cc"}}  # we can also override settings only for specific outputs
20)
21
22c.build({app})
23c.compile_commands()