summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-21 23:05:45 +0800
committerruki <[email protected]>2021-10-21 23:05:45 +0800
commitcc00b3574b5892f191cef90f81acd3c27b548ff8 (patch)
tree4dce90df31721cf6bf2559accca8d67212a5334d
parentefa63d26a7d3c5a76344141150771fe76137ef3a (diff)
improve tests
-rw-r--r--tests/projects/nim/console/xmake.lua2
-rw-r--r--tests/projects/nim/console_with_c/src/foo.c3
-rwxr-xr-xtests/projects/nim/console_with_c/src/mainbin0 -> 92184 bytes
-rw-r--r--tests/projects/nim/console_with_c/src/main.nim3
-rw-r--r--tests/projects/nim/console_with_c/xmake.lua10
-rw-r--r--xmake/templates/nim/console/project/xmake.lua4
6 files changed, 19 insertions, 3 deletions
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
--- /dev/null
+++ b/tests/projects/nim/console_with_c/src/main
Binary files 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}