| 12345678910111213141516171819202122232425262728293031323334 |
- add_rules("mode.debug", "mode.release")
- rule("autogen")
- set_extensions(".in")
- before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
- local sourcefile_cx = path.join(target:autogendir(), "rules", "autogen", path.basename(sourcefile) .. ".cpp")
- local objectfile = target:objectfile(sourcefile_cx)
- table.insert(target:objectfiles(), objectfile)
- batchcmds:show_progress(opt.progress, "${color.build.object}compiling.autogen %s", sourcefile)
- batchcmds:mkdir(path.directory(sourcefile_cx))
- batchcmds:vrunv(target:dep("autogen"):targetfile(), {sourcefile, sourcefile_cx})
- batchcmds:compile(sourcefile_cx, objectfile)
- batchcmds:add_depfiles(sourcefile, target:dep("autogen"):targetfile())
- batchcmds:set_depmtime(os.mtime(objectfile))
- batchcmds:set_depcache(target:dependfile(objectfile))
- end)
- target("autogen")
- set_default(false)
- set_kind("binary")
- set_plat(os.host()) -- generate for host platform
- set_arch(os.arch())
- add_files("src/autogen.cpp")
- set_languages("c++11")
- set_policy("build.fence", true) -- disable parallel build for source files
- target("test")
- set_kind("binary")
- add_deps("autogen")
- add_rules("autogen")
- add_files("src/main.cpp")
- add_files("src/*.in")
|