summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-02 22:54:27 +0800
committerruki <[email protected]>2021-06-02 22:54:27 +0800
commit8dda67ba52ed67cc3e6897849658872c2ef4ddcc (patch)
treea6f1b6681af1d2958409e117acc39edaa6ea4e6a /tests
parent16919177c72aa5934113d37932e0b60c8d4a52df (diff)
add deps for localpackages
Diffstat (limited to 'tests')
-rw-r--r--tests/actions/package/localpkg/bar/src/main.cpp4
-rw-r--r--tests/actions/package/localpkg/libfoo/src/add.cpp (renamed from tests/actions/package/localpkg/libfoo/src/interface.cpp)2
-rw-r--r--tests/actions/package/localpkg/libfoo/src/add.h (renamed from tests/actions/package/localpkg/libfoo/src/interface.h)0
-rw-r--r--tests/actions/package/localpkg/libfoo/src/foo.cpp8
-rw-r--r--tests/actions/package/localpkg/libfoo/src/foo.h16
-rw-r--r--tests/actions/package/localpkg/libfoo/src/sub.cpp6
-rw-r--r--tests/actions/package/localpkg/libfoo/src/sub.h16
-rw-r--r--tests/actions/package/localpkg/libfoo/xmake.lua16
8 files changed, 62 insertions, 6 deletions
diff --git a/tests/actions/package/localpkg/bar/src/main.cpp b/tests/actions/package/localpkg/bar/src/main.cpp
index 1bee1b2ad..0102fba75 100644
--- a/tests/actions/package/localpkg/bar/src/main.cpp
+++ b/tests/actions/package/localpkg/bar/src/main.cpp
@@ -1,10 +1,10 @@
-#include "interface.h"
+#include "foo.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
- cout << "add(1, 2) = " << add(1, 2) << endl;
+ cout << "foo(1, 2) = " << foo(1, 2) << endl;
return 0;
}
diff --git a/tests/actions/package/localpkg/libfoo/src/interface.cpp b/tests/actions/package/localpkg/libfoo/src/add.cpp
index 598d07560..e73473e0f 100644
--- a/tests/actions/package/localpkg/libfoo/src/interface.cpp
+++ b/tests/actions/package/localpkg/libfoo/src/add.cpp
@@ -1,4 +1,4 @@
-#include "interface.h"
+#include "add.h"
int add(int a, int b)
{
diff --git a/tests/actions/package/localpkg/libfoo/src/interface.h b/tests/actions/package/localpkg/libfoo/src/add.h
index 62a39427c..62a39427c 100644
--- a/tests/actions/package/localpkg/libfoo/src/interface.h
+++ b/tests/actions/package/localpkg/libfoo/src/add.h
diff --git a/tests/actions/package/localpkg/libfoo/src/foo.cpp b/tests/actions/package/localpkg/libfoo/src/foo.cpp
new file mode 100644
index 000000000..b13e8e761
--- /dev/null
+++ b/tests/actions/package/localpkg/libfoo/src/foo.cpp
@@ -0,0 +1,8 @@
+#include "add.h"
+#include "sub.h"
+#include "foo.h"
+
+int foo(int a, int b)
+{
+ return add(sub(a, b), sub(b, a));
+}
diff --git a/tests/actions/package/localpkg/libfoo/src/foo.h b/tests/actions/package/localpkg/libfoo/src/foo.h
new file mode 100644
index 000000000..d53be3150
--- /dev/null
+++ b/tests/actions/package/localpkg/libfoo/src/foo.h
@@ -0,0 +1,16 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! calculate foo(a, b)
+ *
+ * @param a the first argument
+ * @param b the second argument
+ *
+ * @return the result
+ */
+int foo(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/actions/package/localpkg/libfoo/src/sub.cpp b/tests/actions/package/localpkg/libfoo/src/sub.cpp
new file mode 100644
index 000000000..a65acd40f
--- /dev/null
+++ b/tests/actions/package/localpkg/libfoo/src/sub.cpp
@@ -0,0 +1,6 @@
+#include "sub.h"
+
+int sub(int a, int b)
+{
+ return a - b;
+}
diff --git a/tests/actions/package/localpkg/libfoo/src/sub.h b/tests/actions/package/localpkg/libfoo/src/sub.h
new file mode 100644
index 000000000..1bda92bc5
--- /dev/null
+++ b/tests/actions/package/localpkg/libfoo/src/sub.h
@@ -0,0 +1,16 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! calculate sub(a, b)
+ *
+ * @param a the first argument
+ * @param b the second argument
+ *
+ * @return the result
+ */
+int sub(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/actions/package/localpkg/libfoo/xmake.lua b/tests/actions/package/localpkg/libfoo/xmake.lua
index 01419c241..1b1dd5a41 100644
--- a/tests/actions/package/localpkg/libfoo/xmake.lua
+++ b/tests/actions/package/localpkg/libfoo/xmake.lua
@@ -1,8 +1,18 @@
add_rules("mode.debug", "mode.release")
-target("foo")
+target("sub")
+ set_kind("static")
+ add_files("src/sub.cpp")
+ add_headerfiles("src/sub.h")
+
+target("add")
set_kind("static")
- add_files("src/interface.cpp")
- add_headerfiles("src/*.h")
+ add_files("src/add.cpp")
+ add_headerfiles("src/add.h")
+target("foo")
+ add_deps("add", "sub")
+ set_kind("static")
+ add_files("src/foo.cpp")
+ add_headerfiles("src/foo.h")