diff options
| author | ruki <[email protected]> | 2022-03-21 12:14:28 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-21 12:14:28 +0800 |
| commit | 91eaf2fb94584daf5a38dbed6876877f7743f56a (patch) | |
| tree | 832f6a3096c199db516ce7623e80c0759f73cfa5 | |
| parent | d50435da062503617dc109d65315801d0c28c32f (diff) | |
| parent | 8e23392d97f44728c088072e734fbaf5702f6c55 (diff) | |
Merge pull request #2183 from yamashi/patch-1
Add resource files include and pre-processor defines for the VS gener…
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 0bd27177a..b00b36750 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -493,6 +493,36 @@ function _make_source_options_cl(vcxprojfile, flags, condition) end end +-- make source options for cl +function _make_resource_options_cl(vcxprojfile, flags) + + -- get flags string + local flagstr = os.args(flags) + + -- make PreprocessorDefinitions + local defstr = "" + for _, flag in ipairs(flags) do + flag:gsub("^[%-/]D(.*)", + function (def) + defstr = defstr .. vsutils.escape(def) .. ";" + end + ) + end + defstr = defstr .. "%%(PreprocessorDefinitions)" + vcxprojfile:print("<PreprocessorDefinitions>%s</PreprocessorDefinitions>", defstr) + + -- make AdditionalIncludeDirectories + if flagstr:find("[%-/]I") then + local dirs = {} + for _, flag in ipairs(flags) do + flag:gsub("^[%-/]I(.*)", function (dir) table.insert(dirs, vsutils.escape(dir)) end) + end + if #dirs > 0 then + vcxprojfile:print("<AdditionalIncludeDirectories>%s</AdditionalIncludeDirectories>", table.concat(dirs, ";")) + end + end +end + -- make source options for cuda function _make_source_options_cuda(vcxprojfile, flags, opt) @@ -877,6 +907,12 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo) vcxprojfile:leave("</ClCompile>") + vcxprojfile:enter("<ResourceCompile>") + -- make resource options + _make_resource_options_cl(vcxprojfile, targetinfo.commonflags.cl) + + vcxprojfile:leave("</ResourceCompile>") + local cuda = _check_cuda(target) if cuda then -- for CUDA linker? |
