diff options
| author | ruki <[email protected]> | 2021-05-25 22:58:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-05-25 22:58:45 +0800 |
| commit | b54871bfdd16eb87546fea49c1413068636c3ae4 (patch) | |
| tree | 533403767f6252ecfa949431636878cada53b8fb /xmake/modules/package/tools/meson.lua | |
| parent | 05c0ce2c6a9d4c2c479fe5c0b41501c733bedf6a (diff) | |
add msvc envs for meson
Diffstat (limited to 'xmake/modules/package/tools/meson.lua')
| -rw-r--r-- | xmake/modules/package/tools/meson.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index 4006bf7fb..2f64e1554 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.project.config") +import("core.tool.toolchain") import("package.tools.ninja") -- get build directory @@ -45,6 +46,18 @@ function _get_configs(package, configs, opt) return configs end +-- get msvc +function _get_msvc(package) + local msvc = toolchain.load("msvc", {plat = package:plat(), arch = package:arch()}) + assert(msvc:check(), "vs not found!") -- we need check vs envs if it has been not checked yet + return msvc +end + +-- get msvc run environments +function _get_msvc_runenvs(package) + return _get_msvc(package):runenvs() +end + -- get the build environments function buildenvs(package) local envs = {} @@ -54,6 +67,9 @@ function buildenvs(package) envs.CFLAGS = table.concat(cflags, ' ') envs.CXXFLAGS = table.concat(cxxflags, ' ') envs.ASFLAGS = table.concat(table.wrap(package:config("asflags")), ' ') + if package:is_plat("windows") then + table.join2(envs, _get_msvc_runenvs(package)) + end else local cflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cflags")) local cxxflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cxxflags")) |
