diff options
| author | ruki <[email protected]> | 2023-07-09 22:23:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-07-09 22:23:50 +0800 |
| commit | b7a82a2e449133752cca5cee2349180371999373 (patch) | |
| tree | 8aaafd1fa09a9d59de7d13b84f64609cfb2b0299 | |
| parent | 710f14b26f29c5d6eaccdf9af197eeca4789ae35 (diff) | |
fix find windres #3942
| -rw-r--r-- | xmake/modules/detect/tools/find_gcc.lua | 9 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_windres.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 6 |
3 files changed, 6 insertions, 14 deletions
diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua index 7f41013fb..5ec268668 100644 --- a/xmake/modules/detect/tools/find_gcc.lua +++ b/xmake/modules/detect/tools/find_gcc.lua @@ -36,20 +36,13 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options opt = opt or {} - - -- find program local program = find_program(opt.program or "gcc", opt) - - -- find program version local version = nil if program and opt.version then version = find_programver(program, opt) end - -- is clang or gcc local is_clang = false if program then local versioninfo = os.iorunv(program, {"--version"}) @@ -57,7 +50,5 @@ function main(opt) is_clang = true end end - - -- ok? return program, version, (is_clang and "clang" or "gcc") end diff --git a/xmake/modules/detect/tools/find_windres.lua b/xmake/modules/detect/tools/find_windres.lua index 36c860c16..fab820ec2 100644 --- a/xmake/modules/detect/tools/find_windres.lua +++ b/xmake/modules/detect/tools/find_windres.lua @@ -22,7 +22,8 @@ import("lib.detect.find_program") -- check -function _check(program) +function _check(program, opt) + opt = opt or {} local objectfile = os.tmpfile() .. ".o" local resourcefile = os.tmpfile() .. ".rc" io.writefile(resourcefile, [[ @@ -45,7 +46,7 @@ BEGIN END ]]) - os.runv(program, {"-i", resourcefile, "-o", objectfile}) + os.runv(program, {"-i", resourcefile, "-o", objectfile}, {envs = opt.envs}) os.rm(resourcefile) os.rm(objectfile) end diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index f25ec2ce9..e87e9f620 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -649,7 +649,7 @@ function _get_configs_for_generator(package, configs, opt) elseif package:is_plat("mingw") and is_subhost("windows") then table.insert(configs, "-G") table.insert(configs, "MinGW Makefiles") - elseif package:is_plat("windows") then + elseif package:is_plat("windows") and not package:config("toolchains") then table.insert(configs, "-G") table.insert(configs, _get_cmake_generator_for_msvc(package)) elseif package:is_plat("wasm") and is_subhost("windows") then @@ -685,7 +685,7 @@ function _get_configs(package, configs, opt) opt._configs_str = string.serialize(configs, {indent = false, strip = true}) _get_configs_for_install(package, configs, opt) _get_configs_for_generator(package, configs, opt) - if package:is_plat("windows") then + if package:is_plat("windows") and not package:config("toolchains") then _get_configs_for_windows(package, configs, opt) elseif package:is_plat("android") then _get_configs_for_android(package, configs, opt) @@ -721,7 +721,7 @@ function buildenvs(package, opt) opt = opt or {} local envs = {} if package:is_plat("windows") then - envs = _get_msvc_runenvs(package) + -- envs = _get_msvc_runenvs(package) end -- we need pass pkgconf for windows/mingw without msys2/cygwin |
