From c7c412f6458f5aceeb02e9bfc292dc7aac0852d3 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 25 Jul 2024 00:54:13 +0800 Subject: move autogen tests --- .../other/autogen_binary_module/.gitignore | 8 ------ .../modules/autogen/foo/.gitignore | 8 ------ .../modules/autogen/foo/src/main.cpp | 29 -------------------- .../modules/autogen/foo/xmake.lua | 6 ---- .../other/autogen_binary_module/src/data.in | 1 - .../other/autogen_binary_module/src/main.cpp | 10 ------- .../projects/other/autogen_binary_module/test.lua | 3 -- .../projects/other/autogen_binary_module/xmake.lua | 32 ---------------------- 8 files changed, 97 deletions(-) delete mode 100644 tests/projects/other/autogen_binary_module/.gitignore delete mode 100644 tests/projects/other/autogen_binary_module/modules/autogen/foo/.gitignore delete mode 100644 tests/projects/other/autogen_binary_module/modules/autogen/foo/src/main.cpp delete mode 100644 tests/projects/other/autogen_binary_module/modules/autogen/foo/xmake.lua delete mode 100644 tests/projects/other/autogen_binary_module/src/data.in delete mode 100644 tests/projects/other/autogen_binary_module/src/main.cpp delete mode 100644 tests/projects/other/autogen_binary_module/test.lua delete mode 100644 tests/projects/other/autogen_binary_module/xmake.lua (limited to 'tests/projects/other/autogen_binary_module') diff --git a/tests/projects/other/autogen_binary_module/.gitignore b/tests/projects/other/autogen_binary_module/.gitignore deleted file mode 100644 index 152105761..000000000 --- a/tests/projects/other/autogen_binary_module/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Xmake cache -.xmake/ -build/ - -# MacOS Cache -.DS_Store - - diff --git a/tests/projects/other/autogen_binary_module/modules/autogen/foo/.gitignore b/tests/projects/other/autogen_binary_module/modules/autogen/foo/.gitignore deleted file mode 100644 index 152105761..000000000 --- a/tests/projects/other/autogen_binary_module/modules/autogen/foo/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Xmake cache -.xmake/ -build/ - -# MacOS Cache -.DS_Store - - diff --git a/tests/projects/other/autogen_binary_module/modules/autogen/foo/src/main.cpp b/tests/projects/other/autogen_binary_module/modules/autogen/foo/src/main.cpp deleted file mode 100644 index c5150cdbd..000000000 --- a/tests/projects/other/autogen_binary_module/modules/autogen/foo/src/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -using namespace std; - -int main(int argc, char** argv) { - ifstream src_file(argv[1], ios::in | ios::binary); - if (!src_file) { - return 1; - } - vector buffer(istreambuf_iterator(src_file), {}); - src_file.close(); - - ofstream dst_file(argv[2], ios::out); - if (!dst_file) { - return 1; - } - - dst_file << "unsigned char g_codegen_data[] = {"; - for (auto byte : buffer) { - dst_file << "0x" << hex << (int)(unsigned char)byte << ","; - } - dst_file << "0};" << endl; - dst_file.close(); - return 0; -} - - diff --git a/tests/projects/other/autogen_binary_module/modules/autogen/foo/xmake.lua b/tests/projects/other/autogen_binary_module/modules/autogen/foo/xmake.lua deleted file mode 100644 index 677da3e2d..000000000 --- a/tests/projects/other/autogen_binary_module/modules/autogen/foo/xmake.lua +++ /dev/null @@ -1,6 +0,0 @@ -add_rules("mode.debug", "mode.release") - -target("generate") - add_rules("module.binary") - add_files("src/*.cpp") - set_languages("c++11") diff --git a/tests/projects/other/autogen_binary_module/src/data.in b/tests/projects/other/autogen_binary_module/src/data.in deleted file mode 100644 index a04238969..000000000 --- a/tests/projects/other/autogen_binary_module/src/data.in +++ /dev/null @@ -1 +0,0 @@ -hello world! diff --git a/tests/projects/other/autogen_binary_module/src/main.cpp b/tests/projects/other/autogen_binary_module/src/main.cpp deleted file mode 100644 index 3241308f7..000000000 --- a/tests/projects/other/autogen_binary_module/src/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -using namespace std; - -extern unsigned char g_codegen_data[]; - -int main(int argc, char** argv) { - cout << (const char*)g_codegen_data << endl; - return 0; -} diff --git a/tests/projects/other/autogen_binary_module/test.lua b/tests/projects/other/autogen_binary_module/test.lua deleted file mode 100644 index b57362078..000000000 --- a/tests/projects/other/autogen_binary_module/test.lua +++ /dev/null @@ -1,3 +0,0 @@ -function main(t) - t:build() -end diff --git a/tests/projects/other/autogen_binary_module/xmake.lua b/tests/projects/other/autogen_binary_module/xmake.lua deleted file mode 100644 index b1617e543..000000000 --- a/tests/projects/other/autogen_binary_module/xmake.lua +++ /dev/null @@ -1,32 +0,0 @@ -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") - -- cgit v1.3.1