summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-06-27 22:43:33 +0800
committerruki <[email protected]>2025-06-27 10:22:06 +0800
commit0720b2309a011c26e341dafb50877622e7bb8f17 (patch)
tree47faff05bff6f7993620b39c6498110c6348d37a
parente2c60ab5bc58d4e0a769591b1ad58285d638ccca (diff)
add object only test
-rw-r--r--tests/projects/other/object_only/.gitignore8
-rw-r--r--tests/projects/other/object_only/src/foo.cpp5
-rw-r--r--tests/projects/other/object_only/src/foo.h9
-rw-r--r--tests/projects/other/object_only/src/main.cpp7
-rw-r--r--tests/projects/other/object_only/test.lua3
-rw-r--r--tests/projects/other/object_only/xmake.lua15
6 files changed, 47 insertions, 0 deletions
diff --git a/tests/projects/other/object_only/.gitignore b/tests/projects/other/object_only/.gitignore
new file mode 100644
index 000000000..152105761
--- /dev/null
+++ b/tests/projects/other/object_only/.gitignore
@@ -0,0 +1,8 @@
+# Xmake cache
+.xmake/
+build/
+
+# MacOS Cache
+.DS_Store
+
+
diff --git a/tests/projects/other/object_only/src/foo.cpp b/tests/projects/other/object_only/src/foo.cpp
new file mode 100644
index 000000000..1a1fb3425
--- /dev/null
+++ b/tests/projects/other/object_only/src/foo.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/projects/other/object_only/src/foo.h b/tests/projects/other/object_only/src/foo.h
new file mode 100644
index 000000000..d2506bca9
--- /dev/null
+++ b/tests/projects/other/object_only/src/foo.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/projects/other/object_only/src/main.cpp b/tests/projects/other/object_only/src/main.cpp
new file mode 100644
index 000000000..d55d4d342
--- /dev/null
+++ b/tests/projects/other/object_only/src/main.cpp
@@ -0,0 +1,7 @@
+#include "foo.h"
+#include <iostream>
+
+int main(int argc, char** argv) {
+ std::cout << "add(1, 2) = " << add(1, 2) << std::endl;
+ return 0;
+}
diff --git a/tests/projects/other/object_only/test.lua b/tests/projects/other/object_only/test.lua
new file mode 100644
index 000000000..b57362078
--- /dev/null
+++ b/tests/projects/other/object_only/test.lua
@@ -0,0 +1,3 @@
+function main(t)
+ t:build()
+end
diff --git a/tests/projects/other/object_only/xmake.lua b/tests/projects/other/object_only/xmake.lua
new file mode 100644
index 000000000..5d6f52045
--- /dev/null
+++ b/tests/projects/other/object_only/xmake.lua
@@ -0,0 +1,15 @@
+add_rules("mode.debug", "mode.release")
+
+target("bar")
+ set_kind("object")
+ add_files("src/foo.cpp")
+
+target("foo")
+ set_kind("static")
+ add_deps("bar")
+
+target("object_only")
+ set_kind("binary")
+ add_deps("foo")
+ add_files("src/main.cpp")
+