summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/meson.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-31 00:41:43 +0800
committerruki <[email protected]>2024-08-31 00:41:43 +0800
commit8317c6570c5abcd0e054741f58770b7eb57ec744 (patch)
tree0d2a15628e5c283e962dad46e54b27bd6894134f /xmake/modules/package/tools/meson.lua
parenta50553989fd578547255c34616fff4e18ba84784 (diff)
remove fake_target
Diffstat (limited to 'xmake/modules/package/tools/meson.lua')
-rw-r--r--xmake/modules/package/tools/meson.lua36
1 files changed, 10 insertions, 26 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index fddf32999..641a57eb2 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -22,8 +22,6 @@
import("core.base.option")
import("core.project.config")
import("core.tool.toolchain")
-import("core.tool.linker")
-import("core.tool.compiler")
import("lib.detect.find_tool")
import("private.utils.executable_path")
import("private.utils.toolchain", {alias = "toolchain_utils"})
@@ -38,16 +36,6 @@ function _get_buildir(package, opt)
end
end
--- map compiler flags
-function _map_compflags(package, langkind, name, values)
- return compiler.map_flags(langkind, name, values, {target = package})
-end
-
--- map linker flags
-function _map_linkflags(package, targetkind, sourcekinds, name, values)
- return linker.map_flags(targetkind, sourcekinds, name, values, {target = package})
-end
-
-- get pkg-config, we need force to find it, because package install environments will be changed
function _get_pkgconfig(package)
-- meson need fullpath pkgconfig
@@ -303,13 +291,9 @@ function _get_configs_file(package, opt)
-- add runtimes flags
for _, runtime in ipairs(package:runtimes()) do
if not runtime:startswith("M") then
- local fake_target = {is_shared = function(_) return false end,
- sourcekinds = function(_) return "cxx" end}
- table.join2(cxxflags, _map_compflags(fake_target, "cxx", "runtime", {runtime}))
- table.join2(ldflags, _map_linkflags(fake_target, "binary", {"cxx"}, "runtime", {runtime}))
- fake_target = {is_shared = function(_) return true end,
- sourcekinds = function(_) return "cxx" end}
- table.join2(shflags, _map_linkflags(fake_target, "shared", {"cxx"}, "runtime", {runtime}))
+ table.join2(cxxflags, toolchain_utils.map_compflags(package, "cxx", "runtime", {runtime}))
+ table.join2(ldflags, toolchain_utils.map_linkflags(package, "binary", {"cxx"}, "runtime", {runtime}))
+ table.join2(shflags, toolchain_utils.map_linkflags(package, "shared", {"cxx"}, "runtime", {runtime}))
end
end
if #cflags > 0 then
@@ -428,13 +412,13 @@ function _get_cflags_from_packagedeps(package, opt)
local result = {}
if values then
if values.defines then
- table.join2(result, _map_compflags(package, "cxx", "define", values.defines))
+ table.join2(result, toolchain_utils.map_compflags(package, "cxx", "define", values.defines))
end
if values.includedirs then
- table.join2(result, _map_compflags(package, "cxx", "includedir", values.includedirs))
+ table.join2(result, toolchain_utils.map_compflags(package, "cxx", "includedir", values.includedirs))
end
if values.sysincludedirs then
- table.join2(result, _map_compflags(package, "cxx", "sysincludedir", values.sysincludedirs))
+ table.join2(result, toolchain_utils.map_compflags(package, "cxx", "sysincludedir", values.sysincludedirs))
end
end
return _translate_flags(package, result)
@@ -459,16 +443,16 @@ function _get_ldflags_from_packagedeps(package, opt)
local result = {}
if values then
if values.linkdirs then
- table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "linkdir", values.linkdirs))
+ table.join2(result, toolchain_utils.map_linkflags(package, "binary", {"cxx"}, "linkdir", values.linkdirs))
end
if values.links then
- table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "link", values.links))
+ table.join2(result, toolchain_utils.map_linkflags(package, "binary", {"cxx"}, "link", values.links))
end
if values.syslinks then
- table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "syslink", values.syslinks))
+ table.join2(result, toolchain_utils.map_linkflags(package, "binary", {"cxx"}, "syslink", values.syslinks))
end
if values.frameworks then
- table.join2(result, _map_linkflags(package, "binary", {"cxx"}, "framework", values.frameworks))
+ table.join2(result, toolchain_utils.map_linkflags(package, "binary", {"cxx"}, "framework", values.frameworks))
end
end
return _translate_flags(package, result)