summaryrefslogtreecommitdiff
path: root/tests/projects/c
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-06 22:44:21 +0800
committerruki <[email protected]>2024-02-06 22:44:21 +0800
commit78a1a52f425010571eda84ab1cefeb11d78c20c8 (patch)
treed6e1a9e42a68a2e8674b96abd015800c572a5276 /tests/projects/c
parent469f941f5680273b5b734996677b055a776f0056 (diff)
add cosmoar support
Diffstat (limited to 'tests/projects/c')
-rw-r--r--tests/projects/c/cosmocc/console/src/main.c (renamed from tests/projects/c/cosmocc/src/main.c)0
-rw-r--r--tests/projects/c/cosmocc/console/test.lua (renamed from tests/projects/c/cosmocc/test.lua)0
-rw-r--r--tests/projects/c/cosmocc/console/xmake.lua (renamed from tests/projects/c/cosmocc/xmake.lua)0
-rw-r--r--tests/projects/c/cosmocc/static_library/src/foo.c5
-rw-r--r--tests/projects/c/cosmocc/static_library/src/foo.h2
-rw-r--r--tests/projects/c/cosmocc/static_library/src/main.c7
-rw-r--r--tests/projects/c/cosmocc/static_library/xmake.lua15
7 files changed, 29 insertions, 0 deletions
diff --git a/tests/projects/c/cosmocc/src/main.c b/tests/projects/c/cosmocc/console/src/main.c
index a1ce06b81..a1ce06b81 100644
--- a/tests/projects/c/cosmocc/src/main.c
+++ b/tests/projects/c/cosmocc/console/src/main.c
diff --git a/tests/projects/c/cosmocc/test.lua b/tests/projects/c/cosmocc/console/test.lua
index d6ef2e8da..d6ef2e8da 100644
--- a/tests/projects/c/cosmocc/test.lua
+++ b/tests/projects/c/cosmocc/console/test.lua
diff --git a/tests/projects/c/cosmocc/xmake.lua b/tests/projects/c/cosmocc/console/xmake.lua
index babd520a2..babd520a2 100644
--- a/tests/projects/c/cosmocc/xmake.lua
+++ b/tests/projects/c/cosmocc/console/xmake.lua
diff --git a/tests/projects/c/cosmocc/static_library/src/foo.c b/tests/projects/c/cosmocc/static_library/src/foo.c
new file mode 100644
index 000000000..1a1fb3425
--- /dev/null
+++ b/tests/projects/c/cosmocc/static_library/src/foo.c
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/projects/c/cosmocc/static_library/src/foo.h b/tests/projects/c/cosmocc/static_library/src/foo.h
new file mode 100644
index 000000000..16d451cbb
--- /dev/null
+++ b/tests/projects/c/cosmocc/static_library/src/foo.h
@@ -0,0 +1,2 @@
+int add(int a, int b);
+
diff --git a/tests/projects/c/cosmocc/static_library/src/main.c b/tests/projects/c/cosmocc/static_library/src/main.c
new file mode 100644
index 000000000..a4c769408
--- /dev/null
+++ b/tests/projects/c/cosmocc/static_library/src/main.c
@@ -0,0 +1,7 @@
+#include "foo.h"
+#include <stdio.h>
+
+int main(int argc, char** argv) {
+ printf("add(1, 2) = %d\n", add(1, 2));
+ return 0;
+}
diff --git a/tests/projects/c/cosmocc/static_library/xmake.lua b/tests/projects/c/cosmocc/static_library/xmake.lua
new file mode 100644
index 000000000..73d0a681d
--- /dev/null
+++ b/tests/projects/c/cosmocc/static_library/xmake.lua
@@ -0,0 +1,15 @@
+add_rules("mode.release", "mode.debug")
+
+add_requires("cosmocc")
+set_toolchains("@cosmocc")
+
+target("foo")
+ set_kind("static")
+ add_files("src/foo.c")
+
+target("demo")
+ set_kind("binary")
+ add_deps("foo")
+ add_files("src/main.c")
+
+