summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/projects/c/cosmocc/console/src/main.c6
-rw-r--r--tests/projects/c/cosmocc/console/xmake.lua9
-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
6 files changed, 44 insertions, 0 deletions
diff --git a/tests/projects/c/cosmocc/console/src/main.c b/tests/projects/c/cosmocc/console/src/main.c
new file mode 100644
index 000000000..a1ce06b81
--- /dev/null
+++ b/tests/projects/c/cosmocc/console/src/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(int argc, char** argv) {
+ printf("hello world\n");
+ return 0;
+}
diff --git a/tests/projects/c/cosmocc/console/xmake.lua b/tests/projects/c/cosmocc/console/xmake.lua
new file mode 100644
index 000000000..babd520a2
--- /dev/null
+++ b/tests/projects/c/cosmocc/console/xmake.lua
@@ -0,0 +1,9 @@
+add_rules("mode.debug", "mode.release")
+
+add_requires("cosmocc")
+
+target("test")
+ set_kind("binary")
+ add_files("src/*.c")
+ set_toolchains("@cosmocc")
+
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")
+
+