diff options
| author | ruki <[email protected]> | 2024-02-06 11:04:20 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-06 11:04:20 +0800 |
| commit | c2d5a4a059d88134ef426cb58499994ef02508b2 (patch) | |
| tree | 7bb3a5531812a41ac48895a076e1d14e65ea7ea1 /tests | |
| parent | 8c92537300242e1705e522fe0e6a8087fe1f685c (diff) | |
| parent | b74097ad5fa27dd871ef4cdc6e342342eaca6192 (diff) | |
Merge pull request #4704 from xmake-io/cosmocc
Add cosmocc toolchain support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/projects/c/cosmocc/console/src/main.c | 6 | ||||
| -rw-r--r-- | tests/projects/c/cosmocc/console/xmake.lua | 9 | ||||
| -rw-r--r-- | tests/projects/c/cosmocc/static_library/src/foo.c | 5 | ||||
| -rw-r--r-- | tests/projects/c/cosmocc/static_library/src/foo.h | 2 | ||||
| -rw-r--r-- | tests/projects/c/cosmocc/static_library/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/c/cosmocc/static_library/xmake.lua | 15 |
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") + + |
