diff options
| author | ruki <[email protected]> | 2024-07-15 23:18:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-07-15 23:18:06 +0800 |
| commit | 0dc0148b8bd4d48bec1b6aefdd59761c31361a93 (patch) | |
| tree | 91ded58ee5060849d020d70b3441883ee02b9dd3 | |
| parent | 1cf160a75f0f03e114c09af4f78416762663b904 (diff) | |
add install test
| -rw-r--r-- | tests/actions/install/.gitignore | 8 | ||||
| -rw-r--r-- | tests/actions/install/src/foo.cpp | 5 | ||||
| -rw-r--r-- | tests/actions/install/src/foo.h | 17 | ||||
| -rw-r--r-- | tests/actions/install/src/main.cpp | 7 | ||||
| -rw-r--r-- | tests/actions/install/xmake.lua | 22 |
5 files changed, 59 insertions, 0 deletions
diff --git a/tests/actions/install/.gitignore b/tests/actions/install/.gitignore new file mode 100644 index 000000000..152105761 --- /dev/null +++ b/tests/actions/install/.gitignore @@ -0,0 +1,8 @@ +# Xmake cache +.xmake/ +build/ + +# MacOS Cache +.DS_Store + + diff --git a/tests/actions/install/src/foo.cpp b/tests/actions/install/src/foo.cpp new file mode 100644 index 000000000..1a1fb3425 --- /dev/null +++ b/tests/actions/install/src/foo.cpp @@ -0,0 +1,5 @@ +#include "foo.h" + +int add(int a, int b) { + return a + b; +} diff --git a/tests/actions/install/src/foo.h b/tests/actions/install/src/foo.h new file mode 100644 index 000000000..20df0baa4 --- /dev/null +++ b/tests/actions/install/src/foo.h @@ -0,0 +1,17 @@ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) +# define __export __declspec(dllexport) +#elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) +# define __export __attribute__((visibility("default"))) +#else +# define __export +#endif + +__export int add(int a, int b); + +#ifdef __cplusplus +} +#endif diff --git a/tests/actions/install/src/main.cpp b/tests/actions/install/src/main.cpp new file mode 100644 index 000000000..d55d4d342 --- /dev/null +++ b/tests/actions/install/src/main.cpp @@ -0,0 +1,7 @@ +#include "foo.h" +#include <iostream> + +int main(int argc, char** argv) { + std::cout << "add(1, 2) = " << add(1, 2) << std::endl; + return 0; +} diff --git a/tests/actions/install/xmake.lua b/tests/actions/install/xmake.lua new file mode 100644 index 000000000..d8a37ad48 --- /dev/null +++ b/tests/actions/install/xmake.lua @@ -0,0 +1,22 @@ +add_rules("mode.debug", "mode.release") + +set_version("1.0.1", {soname = true}) + +add_requires("libplist", {system = false, configs = {shared = true}}) + +target("foo") + set_kind("shared") + add_files("src/foo.cpp") + add_packages("libplist", {public = true}) + +target("test5") + set_kind("binary") + add_deps("foo") + add_files("src/main.cpp") + +includes("@builtin/xpack") + +xpack("test") + add_targets("test5") + set_formats("zip") + |
