diff options
| author | ruki <[email protected]> | 2023-07-07 12:56:15 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-07 12:56:15 +0800 |
| commit | fc576981c1405a6b18f71901d599232729168fea (patch) | |
| tree | 70129fe9b58b9b90cbe4914c1dfabbe5adea20c7 | |
| parent | c801c64e8d272c61e5ee9967a87490ec9f51cfae (diff) | |
| parent | 6169e9b753f85f238b0a09786c1b84ac1701f547 (diff) | |
Merge pull request #3933 from xmake-io/moc
improve moc #3930
| -rw-r--r-- | xmake/rules/qt/moc/xmake.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua index ab2026d20..547c72b3b 100644 --- a/xmake/rules/qt/moc/xmake.lua +++ b/xmake/rules/qt/moc/xmake.lua @@ -58,16 +58,26 @@ rule("qt.moc") -- add commands batchcmds:show_progress(opt.progress, "${color.build.object}compiling.qt.moc %s", sourcefile) + -- get values from target + -- @see https://github.com/xmake-io/xmake/issues/3930 + local function _get_values_from_target(target, name) + local values = table.wrap(target:get(name)) + table.join2(values, target:get_from_opts(name)) + table.join2(values, target:get_from_pkgs(name)) + table.join2(values, target:get_from_deps(name, {interface = true})) + return table.unique(values) + end + -- generate c++ source file for moc local flags = {} - table.join2(flags, compiler.map_flags("cxx", "define", target:get("defines"))) + table.join2(flags, compiler.map_flags("cxx", "define", _get_values_from_target(target, "defines"))) local pathmaps = { {"includedirs", "includedir"}, {"sysincludedirs", "includedir"}, -- for now, moc process doesn't support MSVC external includes flags and will fail {"frameworkdirs", "frameworkdir"} } for _, pathmap in ipairs(pathmaps) do - for _, item in ipairs(target:get(pathmap[1])) do + for _, item in ipairs(_get_values_from_target(target, pathmap[1])) do local pathitem = path(item, function (p) local item = table.unwrap(compiler.map_flags("cxx", pathmap[2], p)) if item then |
