diff options
| author | ruki <[email protected]> | 2025-05-09 10:23:17 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-09 10:23:17 +0800 |
| commit | accf9cdc27b899d8cbece2987408986c1e0d2378 (patch) | |
| tree | 5ef3e52d23d0e931523e58d513477fc7a74f1f74 /xmake/modules | |
| parent | 0d2657c847d01fda61cac80c5a26d02ebe70cab2 (diff) | |
| parent | 9c61177d07db0b9740833d334b80d08aac1c6e2c (diff) | |
Merge pull request #6410 from star-hengxing/llvm-dlltool
Add llvm-dlltool support
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/detect/tools/find_llvm_dlltool.lua | 50 | ||||
| -rw-r--r-- | xmake/modules/package/tools/meson.lua | 8 |
2 files changed, 57 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/find_llvm_dlltool.lua b/xmake/modules/detect/tools/find_llvm_dlltool.lua new file mode 100644 index 000000000..2933844a9 --- /dev/null +++ b/xmake/modules/detect/tools/find_llvm_dlltool.lua @@ -0,0 +1,50 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_llvm_dlltool.lua +-- + +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find llvm-dlltool +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local dlltool = find_llvm_dlltool() +-- +-- @endcode +-- +function main(opt) + opt = opt or {} + -- return with non-zero code + opt.norun = true + + -- find program + local program = find_program(opt.program or "llvm-dlltool", opt) + + -- find program version + local version = nil + if program and opt.version then + version = find_programver(program, opt) + end + return program, version +end diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index d03745b41..2e75e0459 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -256,7 +256,7 @@ function _get_configs_file(package, opt) if ranlib then file:print("ranlib=['%s']", executable_path(ranlib)) end - if package:is_plat("mingw") then + if package:is_plat("mingw", "msys", "windows") then local mrc = package:build_getenv("mrc") if mrc then file:print("windres=['%s']", executable_path(mrc)) @@ -469,6 +469,12 @@ end -- get the build environments function buildenvs(package, opt) local envs = {} + if not is_host("windows") and package:is_plat("windows") then + local msvc = package:toolchain("msvc") or package:toolchain("clang") or package:toolchain("clang-cl") + assert(msvc:check(), "msvc envs not found!") -- we need to check vs envs if it has been not checked yet + envs = os.joinenvs(msvc:runenvs()) + end + opt = opt or {} if package:is_plat(os.host()) then local cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags")) |
