summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-28 19:20:39 +0800
committerruki <[email protected]>2025-12-29 00:09:39 +0800
commitefbe455bd1bbbd320174d36af99e95fb1628dfa5 (patch)
tree46d95304a896556706b2711ccf592003d57edb3e
parent75918ae8a4bd81fa99f649089a8284b5a9d560fc (diff)
add more c++modules test
-rw-r--r--tests/projects/c++/modules/xmake_tests3/src/foo.cppm7
-rw-r--r--tests/projects/c++/modules/xmake_tests3/src/main.cpp8
-rw-r--r--tests/projects/c++/modules/xmake_tests3/test.lua1
-rw-r--r--tests/projects/c++/modules/xmake_tests3/xmake.lua12
4 files changed, 28 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/xmake_tests3/src/foo.cppm b/tests/projects/c++/modules/xmake_tests3/src/foo.cppm
new file mode 100644
index 000000000..dee531b45
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests3/src/foo.cppm
@@ -0,0 +1,7 @@
+export module Foo;
+
+import std;
+
+export void foo() {
+ std::printf("Hello from Foo\n");
+}
diff --git a/tests/projects/c++/modules/xmake_tests3/src/main.cpp b/tests/projects/c++/modules/xmake_tests3/src/main.cpp
new file mode 100644
index 000000000..4e2bb9b57
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests3/src/main.cpp
@@ -0,0 +1,8 @@
+import std;
+import Foo;
+
+int main() {
+ foo();
+ std::printf("Hello from main\n");
+ return 0;
+}
diff --git a/tests/projects/c++/modules/xmake_tests3/test.lua b/tests/projects/c++/modules/xmake_tests3/test.lua
new file mode 100644
index 000000000..25ca8a7a3
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests3/test.lua
@@ -0,0 +1 @@
+inherit(".test_xmake_test")
diff --git a/tests/projects/c++/modules/xmake_tests3/xmake.lua b/tests/projects/c++/modules/xmake_tests3/xmake.lua
new file mode 100644
index 000000000..67021fcd9
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests3/xmake.lua
@@ -0,0 +1,12 @@
+add_rules("mode.debug", "mode.release")
+set_languages("c++23")
+
+target("module_dep")
+ set_kind("moduleonly")
+ add_files("src/*.cppm")
+
+target("module_target1")
+ set_kind("moduleonly")
+ add_files("src/*.cppm")
+ add_deps("module_dep")
+ add_tests("tests", {kind = "binary", files = "src/main.cpp", build_should_pass = true, run_should_pass = true})