summaryrefslogtreecommitdiff
path: root/tests/projects/c++
diff options
context:
space:
mode:
Diffstat (limited to 'tests/projects/c++')
-rw-r--r--tests/projects/c++/modules/xmake_tests4/.gitignore4
-rw-r--r--tests/projects/c++/modules/xmake_tests4/src/main.cpp5
-rw-r--r--tests/projects/c++/modules/xmake_tests4/src/work.mpp14
-rw-r--r--tests/projects/c++/modules/xmake_tests4/test.lua1
-rw-r--r--tests/projects/c++/modules/xmake_tests4/test/test.cpp5
-rw-r--r--tests/projects/c++/modules/xmake_tests4/xmake.lua10
6 files changed, 39 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..25ca8a7a3
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests4/test.lua
@@ -0,0 +1 @@
+inherit(".test_xmake_test")
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..63a01661e
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests4/xmake.lua
@@ -0,0 +1,10 @@
+add_rules("mode.debug", "mode.release")
+set_languages("c++23")
+set_encodings("utf-8")
+--add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode"})
+
+target("llvm")
+ set_kind("binary")
+ set_runtimes("c++_shared")
+ add_files("src/*.cpp", "src/*.mpp")
+ add_tests("test", { files = "test/test.cpp", remove_files = "src/main.cpp" })