summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2023-04-09 22:44:37 +0800
committerruki <[email protected]>2023-04-09 22:44:37 +0800
commit5b68e4d38230e0f89a97047ab916b6a9c2bbe942 (patch)
treed62572e1c59a464ac7a0ed9d923c52da11e75731 /xmake/plugins
parentdde674a22790c9a055782baa59550b5824bccb79 (diff)
load targets to fix qt/env #3614
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua69
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua69
2 files changed, 4 insertions, 134 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index 19a9c5f7d..0b491ad65 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -495,68 +495,6 @@ function _make_vsinfo_archs()
return vsinfo_archs
end
--- config target
-function _config_target(target)
- for _, rule in ipairs(target:orderules()) do
- local on_config = rule:script("config")
- if on_config then
- on_config(target)
- end
- end
- local on_config = target:script("config")
- if on_config then
- on_config(target)
- end
-end
-
--- config targets
-function _config_targets()
- for _, target in ipairs(project.ordertargets()) do
- if target:is_enabled() then
- _config_target(target)
- end
- end
-end
-
--- load rules in the required packages for target
-function _load_package_rules_for_target(target)
- for _, rulename in ipairs(target:get("rules")) do
- local packagename = rulename:match("@(.-)/")
- if packagename then
- local pkginfo = project.required_package(packagename)
- if pkginfo then
- local r = pkginfo:rule(rulename)
- if r then
- target:rule_add(r)
- for _, dep in pairs(r:deps()) do
- target:rule_add(dep)
- end
- end
- end
- end
- end
-end
-
--- load rules in the required packages for targets
--- @see https://github.com/xmake-io/xmake/issues/2374
---
--- @code
--- add_requires("zlib", {system = false})
--- target("test")
--- set_kind("binary")
--- add_files("src/*.cpp")
--- add_packages("zlib")
--- add_rules("@zlib/test")
--- @endcode
---
-function _load_package_rules_for_targets()
- for _, target in ipairs(project.ordertargets()) do
- if target:is_enabled() then
- _load_package_rules_for_target(target)
- end
- end
-end
-
-- make vstudio project
function make(outputdir, vsinfo)
@@ -610,11 +548,8 @@ function make(outputdir, vsinfo)
-- install and update requires
install_requires()
- -- load package rules for targets
- _load_package_rules_for_targets()
-
- -- config targets
- _config_targets()
+ -- load targets
+ project.load_targets()
-- update config files
generate_configfiles()
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 3e728d931..9f32fccbb 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -306,68 +306,6 @@ function _make_vsinfo_groups()
return groups, group_deps
end
--- config target
-function _config_target(target)
- for _, rule in ipairs(target:orderules()) do
- local on_config = rule:script("config")
- if on_config then
- on_config(target)
- end
- end
- local on_config = target:script("config")
- if on_config then
- on_config(target)
- end
-end
-
--- config targets
-function _config_targets()
- for _, target in ipairs(project.ordertargets()) do
- if target:is_enabled() then
- _config_target(target)
- end
- end
-end
-
--- load rules in the required packages for target
-function _load_package_rules_for_target(target)
- for _, rulename in ipairs(target:get("rules")) do
- local packagename = rulename:match("@(.-)/")
- if packagename then
- local pkginfo = project.required_package(packagename)
- if pkginfo then
- local r = pkginfo:rule(rulename)
- if r then
- target:rule_add(r)
- for _, dep in pairs(r:deps()) do
- target:rule_add(dep)
- end
- end
- end
- end
- end
-end
-
--- load rules in the required packages for targets
--- @see https://github.com/xmake-io/xmake/issues/2374
---
--- @code
--- add_requires("zlib", {system = false})
--- target("test")
--- set_kind("binary")
--- add_files("src/*.cpp")
--- add_packages("zlib")
--- add_rules("@zlib/test")
--- @endcode
---
-function _load_package_rules_for_targets()
- for _, target in ipairs(project.ordertargets()) do
- if target:is_enabled() then
- _load_package_rules_for_target(target)
- end
- end
-end
-
-- make filter
function _make_filter(filepath, target, vcxprojdir)
local filter
@@ -508,11 +446,8 @@ function main(outputdir, vsinfo)
-- install and update requires
install_requires()
- -- load package rules for targets
- _load_package_rules_for_targets()
-
- -- config targets
- _config_targets()
+ -- load targets
+ project.load_targets()
-- update config files
generate_configfiles()