summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-02 22:44:22 +0800
committerruki <[email protected]>2022-03-02 22:44:22 +0800
commitb68ec3a3564e6fa261a45e01c6d590d49219600f (patch)
tree993e4ab6a0a261d9437aa38b5d9d80a1ba30da1d /tests/projects
parenta76408793027b1aca6b8938a51e5d121bb42084b (diff)
export list
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/c/shared_library_export_all/xmake.lua2
-rw-r--r--tests/projects/c/shared_library_export_list/src/foo.c14
-rw-r--r--tests/projects/c/shared_library_export_list/src/foo.h9
-rw-r--r--tests/projects/c/shared_library_export_list/src/main.c8
-rw-r--r--tests/projects/c/shared_library_export_list/test.lua3
-rw-r--r--tests/projects/c/shared_library_export_list/xmake.lua15
6 files changed, 50 insertions, 1 deletions
diff --git a/tests/projects/c/shared_library_export_all/xmake.lua b/tests/projects/c/shared_library_export_all/xmake.lua
index 6466a16fc..2797d2024 100644
--- a/tests/projects/c/shared_library_export_all/xmake.lua
+++ b/tests/projects/c/shared_library_export_all/xmake.lua
@@ -3,7 +3,7 @@ add_rules("mode.release", "mode.debug")
target("foo")
set_kind("shared")
add_files("src/foo.c", "src/bar.cpp")
- add_rules("utils.symbols.export_all", {class = true})
+ add_rules("utils.symbols.export_all", {export_classes = true})
target("test")
set_kind("binary")
diff --git a/tests/projects/c/shared_library_export_list/src/foo.c b/tests/projects/c/shared_library_export_list/src/foo.c
new file mode 100644
index 000000000..e068c1983
--- /dev/null
+++ b/tests/projects/c/shared_library_export_list/src/foo.c
@@ -0,0 +1,14 @@
+#include "foo.h"
+#include <stdio.h>
+
+void stub() {
+ printf("stub\n");
+}
+
+int sub(int a, int b) {
+ return a - b;
+}
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/projects/c/shared_library_export_list/src/foo.h b/tests/projects/c/shared_library_export_list/src/foo.h
new file mode 100644
index 000000000..d2506bca9
--- /dev/null
+++ b/tests/projects/c/shared_library_export_list/src/foo.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/projects/c/shared_library_export_list/src/main.c b/tests/projects/c/shared_library_export_list/src/main.c
new file mode 100644
index 000000000..1e52e7a81
--- /dev/null
+++ b/tests/projects/c/shared_library_export_list/src/main.c
@@ -0,0 +1,8 @@
+#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/shared_library_export_list/test.lua b/tests/projects/c/shared_library_export_list/test.lua
new file mode 100644
index 000000000..b57362078
--- /dev/null
+++ b/tests/projects/c/shared_library_export_list/test.lua
@@ -0,0 +1,3 @@
+function main(t)
+ t:build()
+end
diff --git a/tests/projects/c/shared_library_export_list/xmake.lua b/tests/projects/c/shared_library_export_list/xmake.lua
new file mode 100644
index 000000000..7e856130f
--- /dev/null
+++ b/tests/projects/c/shared_library_export_list/xmake.lua
@@ -0,0 +1,15 @@
+add_rules("mode.release", "mode.debug")
+
+target("foo")
+ set_kind("shared")
+ add_files("src/foo.c")
+ add_rules("utils.symbols.export_list", {symbols = {
+ "add",
+ "sub"}})
+
+target("test")
+ set_kind("binary")
+ add_deps("foo")
+ add_files("src/main.c")
+
+