diff options
| author | ruki <[email protected]> | 2024-04-11 22:34:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-04-11 22:34:44 +0800 |
| commit | 0a28b2729deb5b2568f1f4427699724e2bfd3fc7 (patch) | |
| tree | 8bccdd80c09e84bf794575ee78b787b4d3c27773 /tests/projects/other/autogen_binary_module/xmake.lua | |
| parent | b559b4c1591e448b0f3faaa5928fc79e8286b8c3 (diff) | |
add autogen shared module test
Diffstat (limited to 'tests/projects/other/autogen_binary_module/xmake.lua')
| -rw-r--r-- | tests/projects/other/autogen_binary_module/xmake.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/projects/other/autogen_binary_module/xmake.lua b/tests/projects/other/autogen_binary_module/xmake.lua new file mode 100644 index 000000000..b1617e543 --- /dev/null +++ b/tests/projects/other/autogen_binary_module/xmake.lua @@ -0,0 +1,32 @@ +add_rules("mode.debug", "mode.release") + +add_moduledirs("modules") + +rule("autogen") + set_extensions(".in") + before_build_file(function (target, sourcefile, opt) + import("utils.progress") + import("core.project.depend") + import("core.tool.compiler") + import("autogen.foo", {always_build = true}) + + local sourcefile_cx = path.join(target:autogendir(), "rules", "autogen", path.basename(sourcefile) .. ".cpp") + local objectfile = target:objectfile(sourcefile_cx) + table.insert(target:objectfiles(), objectfile) + + depend.on_changed(function () + progress.show(opt.progress, "${color.build.object}compiling.autogen %s", sourcefile) + os.mkdir(path.directory(sourcefile_cx)) + foo.generate(sourcefile, sourcefile_cx) + compiler.compile(sourcefile_cx, objectfile, {target = target}) + end, {dependfile = target:dependfile(objectfile), + files = sourcefile, + changed = target:is_rebuilt()}) + end) + +target("test") + set_kind("binary") + add_rules("autogen") + add_files("src/main.cpp") + add_files("src/*.in") + |
