Skip to content

Commit

Permalink
fix windows cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Apr 18, 2024
1 parent dcef638 commit 4471001
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions xmake/modules/package/tools/meson.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,28 @@ function _get_configs_file(package, opt)
if cc then
file:print("c=['%s']", executable_path(cc))
end

local cxx = package:build_getenv("cxx")
-- https://github.com/xmake-io/xmake/discussions/4979
if cxx and package:has_tool("cxx", "clang", "gcc") then
local dir = path.directory(cxx)
local name = path.filename(cxx)
name = name:gsub("clang$", "clang++")
name = name:gsub("clang%-", "clang++-") -- clang-xx
name = name:gsub("clang%.", "clang++.") -- clang.exe
name = name:gsub("gcc$", "g++")
name = name:gsub("gcc%-", "g++-")
name = name:gsub("gcc%.", "g++.")
if dir and dir ~= "." then
cxx = path.join(dir, name)
else
cxx = name
if cxx then
-- https://github.com/xmake-io/xmake/discussions/4979
if package:has_tool("cxx", "clang", "gcc") then
local dir = path.directory(cxx)
local name = path.filename(cxx)
name = name:gsub("clang$", "clang++")
name = name:gsub("clang%-", "clang++-") -- clang-xx
name = name:gsub("clang%.", "clang++.") -- clang.exe
name = name:gsub("gcc$", "g++")
name = name:gsub("gcc%-", "g++-")
name = name:gsub("gcc%.", "g++.")
if dir and dir ~= "." then
cxx = path.join(dir, name)
else
cxx = name
end
end
file:print("cpp=['%s']", executable_path(cxx))
end

local ld = package:build_getenv("ld")
if ld then
file:print("ld=['%s']", executable_path(ld))
Expand Down

0 comments on commit 4471001

Please sign in to comment.