summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2017-09-28 23:44:36 +0800
committerruki <[email protected]>2017-09-28 16:27:39 +0800
commitb0c6c6c058dfe7fe21f42da4da8c8f03fbdb8951 (patch)
tree158a4a65af66c79a3c550393eeb4d12ee3aed206 /tests/projects
parent603ecaeb969342384e55b1fe92ed6d55d8ea970c (diff)
fix compile error with space path
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/static library c/s r c/interface.c6
-rw-r--r--tests/projects/static library c/s r c/interface.h8
-rw-r--r--tests/projects/static library c/s r c/test.c8
-rw-r--r--tests/projects/static library c/test.lua9
-rw-r--r--tests/projects/static library c/xmake.lua45
5 files changed, 76 insertions, 0 deletions
diff --git a/tests/projects/static library c/s r c/interface.c b/tests/projects/static library c/s r c/interface.c
new file mode 100644
index 000000000..598d07560
--- /dev/null
+++ b/tests/projects/static library c/s r c/interface.c
@@ -0,0 +1,6 @@
+#include "interface.h"
+
+int add(int a, int b)
+{
+ return a + b;
+}
diff --git a/tests/projects/static library c/s r c/interface.h b/tests/projects/static library c/s r c/interface.h
new file mode 100644
index 000000000..10ec0f856
--- /dev/null
+++ b/tests/projects/static library c/s r c/interface.h
@@ -0,0 +1,8 @@
+/*! calculate add(a, b)
+ *
+ * @param a the first argument
+ * @param b the second argument
+ *
+ * @return the result
+ */
+int add(int a, int b);
diff --git a/tests/projects/static library c/s r c/test.c b/tests/projects/static library c/s r c/test.c
new file mode 100644
index 000000000..9505a2f75
--- /dev/null
+++ b/tests/projects/static library c/s r c/test.c
@@ -0,0 +1,8 @@
+#include "interface.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/static library c/test.lua b/tests/projects/static library c/test.lua
new file mode 100644
index 000000000..1ff9219ba
--- /dev/null
+++ b/tests/projects/static library c/test.lua
@@ -0,0 +1,9 @@
+-- imports
+import("..build")
+
+-- main entry
+function main()
+
+ -- build project
+ build()
+end
diff --git a/tests/projects/static library c/xmake.lua b/tests/projects/static library c/xmake.lua
new file mode 100644
index 000000000..318c286ee
--- /dev/null
+++ b/tests/projects/static library c/xmake.lua
@@ -0,0 +1,45 @@
+-- the debug mode
+if is_mode("debug") then
+
+ -- enable the debug symbols
+ set_symbols("debug")
+
+ -- disable optimization
+ set_optimize("none")
+end
+
+-- the release mode
+if is_mode("release") then
+
+ -- set the symbols visibility: hidden
+ set_symbols("hidden")
+
+ -- enable fastest optimization
+ set_optimize("fastest")
+
+ -- strip all symbols
+ set_strip("all")
+end
+
+-- add target
+target("static_library_c")
+
+ -- set kind
+ set_kind("static")
+
+ -- add files
+ add_files("s r c/interface.c")
+
+-- add target
+target("test")
+
+ -- set kind
+ set_kind("binary")
+
+ -- add deps
+ add_deps("static_library_c")
+
+ -- add files
+ add_files("s r c/test.c")
+
+