summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2019-09-06 00:13:31 +0800
committerruki <[email protected]>2019-09-05 19:21:07 +0800
commit5f3ad152caf5509dd6e8a8249872c8969be1d49f (patch)
tree7bf28a9ce47129605e7b7c52e90e284106adad89 /tests/projects/c++/modules
parenta8061f2bed770641ea7137e6211aea50bbe6abd9 (diff)
add cppmodule rules and tests
Diffstat (limited to 'tests/projects/c++/modules')
-rw-r--r--tests/projects/c++/modules/hello/src/hello.mpp10
-rw-r--r--tests/projects/c++/modules/hello/src/main.cpp6
-rw-r--r--tests/projects/c++/modules/hello/xmake.lua6
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/hello/src/hello.mpp b/tests/projects/c++/modules/hello/src/hello.mpp
new file mode 100644
index 000000000..fbd7fd6ad
--- /dev/null
+++ b/tests/projects/c++/modules/hello/src/hello.mpp
@@ -0,0 +1,10 @@
+// module;
+#include <cstdio>
+export module hello;
+using namespace std;
+
+export namespace hello {
+ void say(const char* str) {
+ printf("%s\n", str);
+ }
+} \ No newline at end of file
diff --git a/tests/projects/c++/modules/hello/src/main.cpp b/tests/projects/c++/modules/hello/src/main.cpp
new file mode 100644
index 000000000..175b4d348
--- /dev/null
+++ b/tests/projects/c++/modules/hello/src/main.cpp
@@ -0,0 +1,6 @@
+import hello;
+
+int main() {
+ hello::say("hello module!");
+ return 0;
+} \ No newline at end of file
diff --git a/tests/projects/c++/modules/hello/xmake.lua b/tests/projects/c++/modules/hello/xmake.lua
new file mode 100644
index 000000000..5d94b5d15
--- /dev/null
+++ b/tests/projects/c++/modules/hello/xmake.lua
@@ -0,0 +1,6 @@
+target("hello")
+ set_kind("binary")
+ add_rules("c++.build.modules")
+ add_files("src/*.cpp", "src/*.mpp")
+
+