summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2019-09-04 00:33:55 +0800
committerruki <[email protected]>2019-09-03 21:23:33 +0800
commitca20eae2af926af38bd19a539bd919f4cd1439cd (patch)
tree8a1a3214043a2759a569f3fa2fd80b14c7853483 /tests
parent9f580d4e56f182c65b8402b7e4e5dd3e9c1612fd (diff)
add hybrid test project
Diffstat (limited to 'tests')
-rw-r--r--tests/projects/c/shared_library/xmake.lua35
-rw-r--r--tests/projects/c/static_library/xmake.lua35
-rw-r--r--tests/projects/hybrid/static_library/src/main.cpp10
-rw-r--r--tests/projects/hybrid/static_library/src/test.h12
-rw-r--r--tests/projects/hybrid/static_library/src/test1.c5
-rw-r--r--tests/projects/hybrid/static_library/src/test2.m5
-rw-r--r--tests/projects/hybrid/static_library/src/test3.mm5
-rw-r--r--tests/projects/hybrid/static_library/src/test4.cpp5
-rw-r--r--tests/projects/hybrid/static_library/test.lua6
-rw-r--r--tests/projects/hybrid/static_library/xmake.lua13
10 files changed, 63 insertions, 68 deletions
diff --git a/tests/projects/c/shared_library/xmake.lua b/tests/projects/c/shared_library/xmake.lua
index 50bad8879..48ccc67b3 100644
--- a/tests/projects/c/shared_library/xmake.lua
+++ b/tests/projects/c/shared_library/xmake.lua
@@ -1,45 +1,12 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
+add_rules("mode.release", "mode.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("shared_library_c")
-
- -- set kind
set_kind("shared")
-
- -- add files
add_files("src/interface.c")
--- add target
target("test")
-
- -- set kind
set_kind("binary")
-
- -- add deps
add_deps("shared_library_c")
-
- -- add files
add_files("src/test.c")
diff --git a/tests/projects/c/static_library/xmake.lua b/tests/projects/c/static_library/xmake.lua
index 842921894..c3cc56e1a 100644
--- a/tests/projects/c/static_library/xmake.lua
+++ b/tests/projects/c/static_library/xmake.lua
@@ -1,45 +1,12 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
+add_rules("mode.release", "mode.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("src/interface.c")
--- add target
target("test")
-
- -- set kind
set_kind("binary")
-
- -- add deps
add_deps("static_library_c")
-
- -- add files
add_files("src/test.c")
diff --git a/tests/projects/hybrid/static_library/src/main.cpp b/tests/projects/hybrid/static_library/src/main.cpp
new file mode 100644
index 000000000..2750fcf2c
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/main.cpp
@@ -0,0 +1,10 @@
+#include "test.h"
+
+int main(int argc, char** argv)
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ return 0;
+}
diff --git a/tests/projects/hybrid/static_library/src/test.h b/tests/projects/hybrid/static_library/src/test.h
new file mode 100644
index 000000000..3d4687d06
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/test.h
@@ -0,0 +1,12 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test1(void);
+void test2(void);
+void test3(void);
+void test4(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/projects/hybrid/static_library/src/test1.c b/tests/projects/hybrid/static_library/src/test1.c
new file mode 100644
index 000000000..8e0c1e021
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/test1.c
@@ -0,0 +1,5 @@
+#include "test.h"
+
+void test1()
+{
+}
diff --git a/tests/projects/hybrid/static_library/src/test2.m b/tests/projects/hybrid/static_library/src/test2.m
new file mode 100644
index 000000000..2164a8bf5
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/test2.m
@@ -0,0 +1,5 @@
+#include "test.h"
+
+void test2()
+{
+}
diff --git a/tests/projects/hybrid/static_library/src/test3.mm b/tests/projects/hybrid/static_library/src/test3.mm
new file mode 100644
index 000000000..ea33c33d5
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/test3.mm
@@ -0,0 +1,5 @@
+#include "test.h"
+
+void test3()
+{
+}
diff --git a/tests/projects/hybrid/static_library/src/test4.cpp b/tests/projects/hybrid/static_library/src/test4.cpp
new file mode 100644
index 000000000..3cdf598a2
--- /dev/null
+++ b/tests/projects/hybrid/static_library/src/test4.cpp
@@ -0,0 +1,5 @@
+#include "test.h"
+
+void test4()
+{
+}
diff --git a/tests/projects/hybrid/static_library/test.lua b/tests/projects/hybrid/static_library/test.lua
new file mode 100644
index 000000000..b76241be2
--- /dev/null
+++ b/tests/projects/hybrid/static_library/test.lua
@@ -0,0 +1,6 @@
+-- main entry
+function main(t)
+
+ -- build project
+ t:build()
+end
diff --git a/tests/projects/hybrid/static_library/xmake.lua b/tests/projects/hybrid/static_library/xmake.lua
new file mode 100644
index 000000000..c0222501c
--- /dev/null
+++ b/tests/projects/hybrid/static_library/xmake.lua
@@ -0,0 +1,13 @@
+add_rules("mode.release", "mode.debug")
+
+target("test")
+ set_kind("static")
+ add_files("src/*.c", "src/*.cpp")
+ add_files("src/*.m", "src/*.mm")
+
+target("demo")
+ set_kind("binary")
+ add_deps("test")
+ add_files("src/*.cpp")
+
+