diff options
Diffstat (limited to 'tests/projects/package')
| -rw-r--r-- | tests/projects/package/basic/test.lua | 9 | ||||
| -rw-r--r-- | tests/projects/package/basic/xmake.lua | 4 | ||||
| -rwxr-xr-x | tests/projects/package/depconfigs/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/package/depconfigs/test.lua | 6 | ||||
| -rw-r--r-- | tests/projects/package/depconfigs/xmake.lua | 55 | ||||
| -rw-r--r-- | tests/projects/package/multiconfig/test.lua | 9 | ||||
| -rw-r--r-- | tests/projects/package/multiconfig/xmake.lua | 2 | ||||
| -rwxr-xr-x | tests/projects/package/rootconfigs/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/package/rootconfigs/test.lua | 6 | ||||
| -rw-r--r-- | tests/projects/package/rootconfigs/xmake.lua | 7 |
10 files changed, 99 insertions, 13 deletions
diff --git a/tests/projects/package/basic/test.lua b/tests/projects/package/basic/test.lua index a4b905689..8644a2af9 100644 --- a/tests/projects/package/basic/test.lua +++ b/tests/projects/package/basic/test.lua @@ -1,7 +1,6 @@ --- main entry function main(t) - - -- TODO - -- build project --- t:build() + -- only for x86/x64, because it will take too long time on ci with arm/mips + if os.subarch():startswith("x") or os.subarch() == "i386" then + t:build() + end end diff --git a/tests/projects/package/basic/xmake.lua b/tests/projects/package/basic/xmake.lua index b71a22c1d..f06d2a199 100644 --- a/tests/projects/package/basic/xmake.lua +++ b/tests/projects/package/basic/xmake.lua @@ -1,11 +1,11 @@ add_requires("tbox master", {debug = true}) add_requires("zlib >=1.2.11") -add_requires("pcre2", "luajit", {system = false, optional = true}) +add_requires("pcre2", {system = false, optional = true}) add_rules("mode.debug", "mode.release") target("console") set_kind("binary") add_files("src/*.c") - add_packages("tbox", "zlib", "pcre2", "luajit") + add_packages("tbox", "zlib", "pcre2") diff --git a/tests/projects/package/depconfigs/src/main.c b/tests/projects/package/depconfigs/src/main.c new file mode 100755 index 000000000..9ae580511 --- /dev/null +++ b/tests/projects/package/depconfigs/src/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char** argv) +{ + printf("hello world!\n"); + return 0; +} diff --git a/tests/projects/package/depconfigs/test.lua b/tests/projects/package/depconfigs/test.lua new file mode 100644 index 000000000..8644a2af9 --- /dev/null +++ b/tests/projects/package/depconfigs/test.lua @@ -0,0 +1,6 @@ +function main(t) + -- only for x86/x64, because it will take too long time on ci with arm/mips + if os.subarch():startswith("x") or os.subarch() == "i386" then + t:build() + end +end diff --git a/tests/projects/package/depconfigs/xmake.lua b/tests/projects/package/depconfigs/xmake.lua new file mode 100644 index 000000000..c76e92df5 --- /dev/null +++ b/tests/projects/package/depconfigs/xmake.lua @@ -0,0 +1,55 @@ +add_requires("libpng", "libtiff", {system = false, configs = {vs_runtime = "MD"}}) +add_requires("libwebp") + +add_requireconfs("libwebp", {system = false, configs = {shared = true, vs_runtime = "MD"}}) +add_requireconfs("libpng.zlib", {system = false, override = true, configs = {cxflags = "-DTEST1"}, version = "1.2.10"}) +add_requireconfs("libtiff.*|cmake", {system = false, configs = {cxflags = "-DTEST2"}}) +add_requireconfs("libwebp.**|cmake", {system = false, configs = {cxflags = "-DTEST3"}}) + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("libpng") + before_build(function (target) + if target:pkg("libpng") then + local found + for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do + if linkdir:find("zlib[/\\]1%.2%.10") then + found = true + end + end + assert(found, "package(zlib 1.2.10) not found!") + end + end) + +target("test2") + set_kind("binary") + add_files("src/*.c") + add_packages("libtiff") + before_build(function (target) + if target:pkg("libtiff") then + local found + for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do + if linkdir:find("zlib", 1, true) then + found = true + end + end + assert(found, "package(zlib) not found!") + end + end) + +target("test3") + set_kind("binary") + add_files("src/*.c") + add_packages("libwebp") + before_build(function (target) + if target:pkg("libwebp") then + local found + for _, linkdir in ipairs(target:pkg("libwebp"):get("linkdirs")) do + if linkdir:find("zlib", 1, true) then + found = true + end + end + assert(found, "package(zlib) not found!") + end + end) diff --git a/tests/projects/package/multiconfig/test.lua b/tests/projects/package/multiconfig/test.lua index a4b905689..8644a2af9 100644 --- a/tests/projects/package/multiconfig/test.lua +++ b/tests/projects/package/multiconfig/test.lua @@ -1,7 +1,6 @@ --- main entry function main(t) - - -- TODO - -- build project --- t:build() + -- only for x86/x64, because it will take too long time on ci with arm/mips + if os.subarch():startswith("x") or os.subarch() == "i386" then + t:build() + end end diff --git a/tests/projects/package/multiconfig/xmake.lua b/tests/projects/package/multiconfig/xmake.lua index 48d64da13..09121e8d2 100644 --- a/tests/projects/package/multiconfig/xmake.lua +++ b/tests/projects/package/multiconfig/xmake.lua @@ -11,7 +11,7 @@ target("test1") target("test2") set_kind("binary") add_files("src/*.c") - add_packages("zlib#debug") + add_packages("zlib~debug") target("test3") set_kind("binary") diff --git a/tests/projects/package/rootconfigs/src/main.c b/tests/projects/package/rootconfigs/src/main.c new file mode 100755 index 000000000..9ae580511 --- /dev/null +++ b/tests/projects/package/rootconfigs/src/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char** argv) +{ + printf("hello world!\n"); + return 0; +} diff --git a/tests/projects/package/rootconfigs/test.lua b/tests/projects/package/rootconfigs/test.lua new file mode 100644 index 000000000..8644a2af9 --- /dev/null +++ b/tests/projects/package/rootconfigs/test.lua @@ -0,0 +1,6 @@ +function main(t) + -- only for x86/x64, because it will take too long time on ci with arm/mips + if os.subarch():startswith("x") or os.subarch() == "i386" then + t:build() + end +end diff --git a/tests/projects/package/rootconfigs/xmake.lua b/tests/projects/package/rootconfigs/xmake.lua new file mode 100644 index 000000000..3e395ab7b --- /dev/null +++ b/tests/projects/package/rootconfigs/xmake.lua @@ -0,0 +1,7 @@ +add_requireconfs("*", {system = false, configs = {debug = false}}) +add_requires("zlib", {system = false, debug = true}) + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("zlib") |
