Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imrpove meson with clang toolchain #4987

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions xmake/modules/package/tools/meson.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,21 @@ function _get_configs_file(package, opt)
file:print("c=['%s']", executable_path(cc))
end
local cxx = package:build_getenv("cxx")
if cxx then
-- 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
end
file:print("cpp=['%s']", executable_path(cxx))
end
local ld = package:build_getenv("ld")
Expand Down Expand Up @@ -295,7 +309,7 @@ function _get_configs(package, configs, opt)

-- add prefix
configs = configs or {}
table.insert(configs, "--prefix=" .. package:installdir())
table.insert(configs, "--prefix=" .. (opt.prefix or package:installdir()))
table.insert(configs, "--libdir=lib")

-- set build type
Expand Down
Loading