diff options
| author | ruki <[email protected]> | 2021-02-03 22:40:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-03 22:40:22 +0800 |
| commit | 7dcf5af6dfde93b1380ea9f5e6d1a7eb83c6b34d (patch) | |
| tree | fc3abd570f0c79c4b976cddabdf3bf50a6ae846e | |
| parent | 659b1d101aa05cff29f36b01d5d9f192edb30997 (diff) | |
add toolchain for llvm-mingw tests
| -rw-r--r-- | tests/projects/package/toolchain_llvm_mingw/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/package/toolchain_llvm_mingw/xmake.lua | 7 | ||||
| -rw-r--r-- | xmake/toolchains/mingw/check.lua | 11 |
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/projects/package/toolchain_llvm_mingw/src/main.c b/tests/projects/package/toolchain_llvm_mingw/src/main.c new file mode 100644 index 000000000..9ae580511 --- /dev/null +++ b/tests/projects/package/toolchain_llvm_mingw/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/toolchain_llvm_mingw/xmake.lua b/tests/projects/package/toolchain_llvm_mingw/xmake.lua new file mode 100644 index 000000000..0cb0d01b9 --- /dev/null +++ b/tests/projects/package/toolchain_llvm_mingw/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.debug", "mode.release") +add_requires("llvm-mingw") + +target("test") + set_kind("binary") + add_files("src/*.c") + set_toolchains("mingw", {packages = "llvm-mingw"}) diff --git a/xmake/toolchains/mingw/check.lua b/xmake/toolchains/mingw/check.lua index 7800315c1..9500341ca 100644 --- a/xmake/toolchains/mingw/check.lua +++ b/xmake/toolchains/mingw/check.lua @@ -25,6 +25,17 @@ import("detect.sdks.find_mingw") -- check the mingw toolchain function main(toolchain) local mingw = find_mingw(config.get("mingw"), {verbose = true, bindir = config.get("bin"), cross = config.get("cross")}) + if not mingw then + for _, package in ipairs(toolchain:packages()) do + local installdir = package:installdir() + if installdir and os.isdir(installdir) then + mingw = find_mingw(installdir, {verbose = true, cross = config.get("cross")}) + if mingw then + break + end + end + end + end if mingw then config.set("mingw", mingw.sdkdir, {force = true, readonly = true}) config.set("cross", mingw.cross, {readonly = true, force = true}) |
