From 8a80645e856deeaa1df5ad6a2ef91a9c4d475cc8 Mon Sep 17 00:00:00 2001 From: mclee Date: Thu, 6 Dec 2018 17:57:51 +0800 Subject: improves project plugin, and preprocessor definitions could be correctly setted now. --- xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 494aeff51..2e7d1a426 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -288,6 +288,18 @@ function _make_source_options(vcxprojfile, flags, condition) if flagstr:find("[%-/]WX") then vcxprojfile:print("true", condition) end + + -- make PreprocessorDefinitions + local defstr = "" + for _, flag in ipairs(flags) do + flag:gsub("[%-/]D(.*)", + function (def) + defstr = defstr .. def .. ";" + end + ) + end + defstr = defstr .. "%%(PreprocessorDefinitions)" + vcxprojfile:print("%s", condition, defstr) -- make DebugInformationFormat if flagstr:find("[%-/]Zi") then @@ -329,7 +341,7 @@ function _make_source_options(vcxprojfile, flags, condition) -- make AdditionalOptions local additional_flags = {} - local excludes = {"Os", "O0", "O1", "O2", "Ot", "Ox", "W0", "W1", "W2", "W3", "WX", "Wall", "Zi", "ZI", "Z7", "MT", "MTd", "MD", "MDd", "TP", "Fd", "fp", "I"} + local excludes = {"Od", "Os", "O0", "O1", "O2", "Ot", "Ox", "W0", "W1", "W2", "W3", "WX", "Wall", "Zi", "ZI", "Z7", "MT", "MTd", "MD", "MDd", "TP", "Fd", "fp", "I", "D"} for _, flag in ipairs(flags) do local excluded = false for _, exclude in ipairs(excludes) do -- cgit v1.3.1