diff options
| author | ruki <[email protected]> | 2024-07-25 00:54:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-07-25 00:54:13 +0800 |
| commit | c7c412f6458f5aceeb02e9bfc292dc7aac0852d3 (patch) | |
| tree | 90fc1076e7dd5a2971d7033bee28825a80e59477 /tests/projects/other/autogen/autogen_binary_module/modules | |
| parent | 039cd576af844dc146b7517160648765b90b81b1 (diff) | |
move autogen tests
Diffstat (limited to 'tests/projects/other/autogen/autogen_binary_module/modules')
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/.gitignore b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/.gitignore new file mode 100644 index 000000000..152105761 --- /dev/null +++ b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/.gitignore @@ -0,0 +1,8 @@ +# Xmake cache +.xmake/ +build/ + +# MacOS Cache +.DS_Store + + diff --git a/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/src/main.cpp b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/src/main.cpp new file mode 100644 index 000000000..c5150cdbd --- /dev/null +++ b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/src/main.cpp @@ -0,0 +1,29 @@ +#include <iostream> +#include <fstream> +#include <vector> + +using namespace std; + +int main(int argc, char** argv) { + ifstream src_file(argv[1], ios::in | ios::binary); + if (!src_file) { + return 1; + } + vector<char> buffer(istreambuf_iterator<char>(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/autogen_binary_module/modules/autogen/foo/xmake.lua b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/xmake.lua new file mode 100644 index 000000000..677da3e2d --- /dev/null +++ b/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/xmake.lua @@ -0,0 +1,6 @@ +add_rules("mode.debug", "mode.release") + +target("generate") + add_rules("module.binary") + add_files("src/*.cpp") + set_languages("c++11") |
