From cc00b3574b5892f191cef90f81acd3c27b548ff8 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 21 Oct 2021 23:05:45 +0800 Subject: improve tests --- tests/projects/nim/console/xmake.lua | 2 +- tests/projects/nim/console_with_c/src/foo.c | 3 +++ tests/projects/nim/console_with_c/src/main | Bin 0 -> 92184 bytes tests/projects/nim/console_with_c/src/main.nim | 3 +++ tests/projects/nim/console_with_c/xmake.lua | 10 ++++++++++ xmake/templates/nim/console/project/xmake.lua | 4 ++-- 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/projects/nim/console_with_c/src/foo.c create mode 100755 tests/projects/nim/console_with_c/src/main create mode 100644 tests/projects/nim/console_with_c/src/main.nim create mode 100644 tests/projects/nim/console_with_c/xmake.lua diff --git a/tests/projects/nim/console/xmake.lua b/tests/projects/nim/console/xmake.lua index 35bcd3792..40459a274 100644 --- a/tests/projects/nim/console/xmake.lua +++ b/tests/projects/nim/console/xmake.lua @@ -2,4 +2,4 @@ add_rules("mode.debug", "mode.release") target("test") set_kind("binary") - add_files("src/*.nim") + add_files("src/main.nim") diff --git a/tests/projects/nim/console_with_c/src/foo.c b/tests/projects/nim/console_with_c/src/foo.c new file mode 100644 index 000000000..7e3f727d6 --- /dev/null +++ b/tests/projects/nim/console_with_c/src/foo.c @@ -0,0 +1,3 @@ +int foo(int n) { + return n; +} diff --git a/tests/projects/nim/console_with_c/src/main b/tests/projects/nim/console_with_c/src/main new file mode 100755 index 000000000..84f0819ac Binary files /dev/null and b/tests/projects/nim/console_with_c/src/main differ diff --git a/tests/projects/nim/console_with_c/src/main.nim b/tests/projects/nim/console_with_c/src/main.nim new file mode 100644 index 000000000..1be3abe69 --- /dev/null +++ b/tests/projects/nim/console_with_c/src/main.nim @@ -0,0 +1,3 @@ +proc foo(n: int): int {.cdecl, importc} + +echo foo(2) diff --git a/tests/projects/nim/console_with_c/xmake.lua b/tests/projects/nim/console_with_c/xmake.lua new file mode 100644 index 000000000..c2d067cd6 --- /dev/null +++ b/tests/projects/nim/console_with_c/xmake.lua @@ -0,0 +1,10 @@ +add_rules("mode.debug", "mode.release") + +target("foo") + set_kind("static") + add_files("src/*.c") + +target("test") + set_kind("binary") + add_deps("foo") + add_files("src/main.nim") diff --git a/xmake/templates/nim/console/project/xmake.lua b/xmake/templates/nim/console/project/xmake.lua index 1aa5639db..f41148c2f 100644 --- a/xmake/templates/nim/console/project/xmake.lua +++ b/xmake/templates/nim/console/project/xmake.lua @@ -2,6 +2,6 @@ add_rules("mode.debug", "mode.release") target("${TARGETNAME}") set_kind("binary") - add_files("src/*.nim") - + add_files("src/main.nim") + ${FAQ} -- cgit v1.3.1