diff options
| author | yamashi <[email protected]> | 2022-03-20 15:47:25 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-20 15:47:25 +0100 |
| commit | fba82080b4aac9cf58d67b29b51f6d70bb5bcd03 (patch) | |
| tree | 76764473e9994766e21e6f598b6c5319e5d49ac1 | |
| parent | 9e37fafc56c2a8bba0f252365840718121c0856a (diff) | |
Add resource files include and pre-processor defines for the VS generator
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 39 |
1 files changed, 39 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..473500064 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -493,6 +493,39 @@ function _make_source_options_cl(vcxprojfile, flags, condition) end end +-- make source options for cl +function _make_resource_options_cl(vcxprojfile, flags, condition) + + -- exists condition? + condition = condition or "" + + -- 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>%s</PreprocessorDefinitions>", condition, 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>%s</AdditionalIncludeDirectories>", condition, table.concat(dirs, ";")) + end + end +end + -- make source options for cuda function _make_source_options_cuda(vcxprojfile, flags, opt) @@ -877,6 +910,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? |
