diff options
| author | ruki <[email protected]> | 2025-12-29 11:22:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-29 11:22:53 +0800 |
| commit | 7c06c581c3f99a3eda87d88a334e42802175ddfd (patch) | |
| tree | bb6e90071765465d8fb5e6e87fe2a3d94158f0bf /xmake/modules | |
| parent | 399988ff7a79d7d9ee994c8911bf6e69588dd7c5 (diff) | |
| parent | 34c820992ce4dd7a11ed644f7ab253a98466c54d (diff) | |
Merge pull request #7172 from xmake-io/modules
prepare test targets in compile_commands
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/utils/target.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/target.lua b/xmake/modules/private/utils/target.lua index d06f1293c..728bd6016 100644 --- a/xmake/modules/private/utils/target.lua +++ b/xmake/modules/private/utils/target.lua @@ -50,6 +50,7 @@ end -- @see https://github.com/xmake-io/xmake/issues/3022 -- -- e.g. +-- -- for all: add_cxxflags("-g") -- only for clang: add_cxxflags("clang::-stdlib=libc++") -- only for clang and multiple flags: add_cxxflags("-stdlib=libc++", "-DFOO", {tools = "clang"}) @@ -104,6 +105,7 @@ function translate_flags_in_tool(target, flagkind, flags) -- @see https://github.com/xmake-io/xmake/issues/3022 -- -- e.g. + -- -- for all: add_cxxflags("-g") -- only for clang: add_cxxflags("clang::-stdlib=libc++") -- only for clang and multiple flags: add_cxxflags("-stdlib=libc++", "-DFOO", {tools = "clang"}) @@ -165,3 +167,40 @@ function check_target_toolchains() end end +-- config target +function 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 + +-- config targets +function config_targets(opt) + opt = opt or {} + for _, target in ipairs(table.wrap(project.ordertargets())) do + if target:is_enabled() then + config_target(target, opt) + end + end +end |
