diff options
| author | ruki <[email protected]> | 2025-12-29 11:22:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-29 11:22:53 +0800 |
| commit | 7c06c581c3f99a3eda87d88a334e42802175ddfd (patch) | |
| tree | bb6e90071765465d8fb5e6e87fe2a3d94158f0bf /tests/projects/c++/modules/xmake_tests4 | |
| parent | 399988ff7a79d7d9ee994c8911bf6e69588dd7c5 (diff) | |
| parent | 34c820992ce4dd7a11ed644f7ab253a98466c54d (diff) | |
Merge pull request #7172 from xmake-io/modules
prepare test targets in compile_commands
Diffstat (limited to 'tests/projects/c++/modules/xmake_tests4')
6 files changed, 36 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/xmake_tests4/.gitignore b/tests/projects/c++/modules/xmake_tests4/.gitignore new file mode 100644 index 000000000..9d988d246 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/.gitignore @@ -0,0 +1,4 @@ +.xmake/ +.vscode/ +build/ +uselocalxmake.sh diff --git a/tests/projects/c++/modules/xmake_tests4/src/main.cpp b/tests/projects/c++/modules/xmake_tests4/src/main.cpp new file mode 100644 index 000000000..45222c241 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/src/main.cpp @@ -0,0 +1,5 @@ +import work; + +int main() { + do_work<int>(); +} diff --git a/tests/projects/c++/modules/xmake_tests4/src/work.mpp b/tests/projects/c++/modules/xmake_tests4/src/work.mpp new file mode 100644 index 000000000..27b5f2089 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/src/work.mpp @@ -0,0 +1,14 @@ +export module work; +import std; + +export +template<typename T> +void do_work() { + if constexpr (std::is_same_v<T, int>) { + std::println("Hello world!"); + } else if constexpr (std::is_same_v<T, double>) { + std::println("Hello test!"); + } else { + std::println("Hello unknown type!"); + } +} diff --git a/tests/projects/c++/modules/xmake_tests4/test.lua b/tests/projects/c++/modules/xmake_tests4/test.lua new file mode 100644 index 000000000..e36d560d9 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/test.lua @@ -0,0 +1 @@ +inherit(".test_xmake_test_stdmodules") diff --git a/tests/projects/c++/modules/xmake_tests4/test/test.cpp b/tests/projects/c++/modules/xmake_tests4/test/test.cpp new file mode 100644 index 000000000..fae906e76 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/test/test.cpp @@ -0,0 +1,5 @@ +import work; + +int main() { + do_work<double>(); +} diff --git a/tests/projects/c++/modules/xmake_tests4/xmake.lua b/tests/projects/c++/modules/xmake_tests4/xmake.lua new file mode 100644 index 000000000..43a330fe1 --- /dev/null +++ b/tests/projects/c++/modules/xmake_tests4/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.debug", "mode.release") +set_languages("c++23") + +target("llvm") + set_kind("binary") + add_files("src/*.cpp", "src/*.mpp") + add_tests("test", { files = "test/test.cpp", remove_files = "src/main.cpp" }) |
