diff options
| author | ruki <[email protected]> | 2025-09-06 21:54:55 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-06 21:54:55 +0800 |
| commit | 8d003d54d21714a893990e640ab6d9e711a092a5 (patch) | |
| tree | b6340c6d40a3345216ba85e010bee91af5de2b04 | |
| parent | 34e28c383b48d1c4c0df70a25500fa07ea70dc99 (diff) | |
| parent | 8412d57c5c011240111820288b658f74ae8dc05e (diff) | |
Merge pull request #6776 from xmake-io/config
revert config targets #6775
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 43 | ||||
| -rw-r--r-- | xmake/rules/platform/windows/subsystem/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/qt/xmake.lua | 5 |
3 files changed, 42 insertions, 8 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index fde977b6e..4a191576c 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -126,6 +126,43 @@ function sandbox_core_project.check_options() end end +-- config target +function sandbox_core_project._config_target(target, opt) + for _, rule in ipairs(table.wrap(target:orderules())) do + local before_config = rule:script("config_before") + if before_config then + before_config(target, opt) + end + end + + for _, rule in ipairs(table.wrap(target:orderules())) do + local on_config = rule:script("config") + if on_config then + on_config(target, opt) + end + end + local on_config = target:script("config") + if on_config then + on_config(target, opt) + end + + for _, rule in ipairs(table.wrap(target:orderules())) do + local after_config = rule:script("config_after") + if after_config then + after_config(target, opt) + end + end +end + +function sandbox_core_project._config_targets(opt) + opt = opt or {} + for _, target in ipairs(table.wrap(project.ordertargets())) do + if target:is_enabled() then + sandbox_core_project._config_target(target, opt) + end + end +end + -- config targets -- -- @param opt the extra option, e.g. {recheck = false} @@ -136,7 +173,9 @@ end -- target:has_cfuncs(...) -- end -- end --- +-- TODO we need to optimize jobgraph +-- https://github.com/xmake-io/xmake/issues/6775 +--[[ function sandbox_core_project._config_targets(opt) import("private.action.build.target", {alias = "target_buildutils"}) @@ -146,7 +185,7 @@ function sandbox_core_project._config_targets(opt) -- so we can only execute single tasks for now (jobs = 1). local targets_root = target_buildutils.get_root_targets(nil, {all = true}) target_buildutils.run_targetjobs(targets_root, {job_kind = "config", target_fence = true, jobs = 1, job_opt = opt}) -end +end]] -- load rules in the required packages for target function sandbox_core_project._load_package_rules_for_target(target) diff --git a/xmake/rules/platform/windows/subsystem/xmake.lua b/xmake/rules/platform/windows/subsystem/xmake.lua index 60fa59dc4..6ee96324a 100644 --- a/xmake/rules/platform/windows/subsystem/xmake.lua +++ b/xmake/rules/platform/windows/subsystem/xmake.lua @@ -22,7 +22,7 @@ -- set any of "boot_application" "console" "efi_application" "efi_boot_service_driver" "efi_rom" "efi_runtime_driver" "native" "posix" "windows" -- with target:set_values("windows.subsystem", <your value>) and the rule will pass the proper flag to the linker rule("platform.windows.subsystem") - on_config("mingw", "windows", function(target) + after_config("mingw", "windows", function(target) local subsystems = { "BOOT_APPLICATION", "CONSOLE", "EFI_APPLICATION", "EFI_BOOT_SERVICE_DRIVER", "EFI_ROM", "EFI_RUNTIME_DRIVER", "NATIVE", "POSIX", "WINDOWS" } diff --git a/xmake/rules/qt/xmake.lua b/xmake/rules/qt/xmake.lua index 99f6c8c6e..69c8ff03a 100644 --- a/xmake/rules/qt/xmake.lua +++ b/xmake/rules/qt/xmake.lua @@ -68,7 +68,6 @@ rule("qt.shared") -- define rule: qt console rule("qt.console") add_deps("qt.qrc", "qt.ui", "qt.moc", "qt.ts") - add_orders("qt.console", "platform.windows.subsystem") -- we must set kind before target.on_load(), may we will use target in on_load() on_load(function (target) @@ -85,7 +84,6 @@ rule("qt.console") -- define rule: qt widgetapp rule("qt.widgetapp") add_deps("qt.ui", "qt.moc", "qt._wasm_app", "qt.qrc", "qt.ts") - add_orders("qt.widgetapp", "platform.windows.subsystem") -- we must set kind before target.on_load(), may we will use target in on_load() on_load(function (target) @@ -121,7 +119,6 @@ rule("qt.widgetapp") -- define rule: qt static widgetapp rule("qt.widgetapp_static") add_deps("qt.ui", "qt.moc", "qt._wasm_app", "qt.qrc", "qt.ts") - add_orders("qt.widgetapp_static", "platform.windows.subsystem") -- we must set kind before target.on_load(), may we will use target in on_load() on_load(function (target) @@ -150,7 +147,6 @@ rule("qt.widgetapp_static") -- define rule: qt quickapp rule("qt.quickapp") add_deps("qt.qrc", "qt.moc", "qt._wasm_app", "qt.ts") - add_orders("qt.quickapp", "platform.windows.subsystem") -- we must set kind before target.on_load(), may we will use target in on_load() on_load(function (target) @@ -173,7 +169,6 @@ rule("qt.quickapp") -- define rule: qt static quickapp rule("qt.quickapp_static") add_deps("qt.qrc", "qt.moc", "qt._wasm_app", "qt.ts") - add_orders("qt.quickapp_static", "platform.windows.subsystem") -- we must set kind before target.on_load(), may we will use target in on_load() on_load(function (target) |
