From e7bebb2e4c03c85e801c6b7e2e7131da5dec7869 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 15 Oct 2018 23:48:25 +0800 Subject: ignore -export and improve vs201x proj --- xmake/modules/detect/tools/link/has_flags.lua | 2 +- .../project/vstudio/impl/vs201x_vcxproj.lua | 48 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/xmake/modules/detect/tools/link/has_flags.lua b/xmake/modules/detect/tools/link/has_flags.lua index ba6b8e2b8..74eae3554 100644 --- a/xmake/modules/detect/tools/link/has_flags.lua +++ b/xmake/modules/detect/tools/link/has_flags.lua @@ -115,7 +115,7 @@ end function _ignore_flags(flags) local results = {} for _, flag in ipairs(flags) do - if not flag:find("[%-/]def:.+%.def") then + if not flag:find("[%-/]def:.+%.def") and not flag:find("[%-/]export:") then table.insert(results, flag) end end diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 4275dfd8d..c93de3ad1 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -35,7 +35,7 @@ function _make_compflags(sourcefile, targetinfo, vcxprojdir) for _, flag in ipairs(targetinfo.compflags[sourcefile]) do -- -Idir or /Idir - flag = flag:gsub("[%-|/]I(.*)", function (dir) + flag = flag:gsub("[%-/]I(.*)", function (dir) dir = path.translate(dir:trim()) if not path.is_absolute(dir) then dir = path.relative(path.absolute(dir), vcxprojdir) @@ -63,7 +63,7 @@ function _make_linkflags(targetinfo, vcxprojdir) for _, flag in ipairs(targetinfo.linkflags) do -- replace -libpath:dir or /libpath:dir - flag = flag:gsub("[%-|/]libpath:(.*)", function (dir) + flag = flag:gsub("[%-/]libpath:(.*)", function (dir) dir = path.translate(dir:trim()) if not path.is_absolute(dir) then dir = path.relative(path.absolute(dir), vcxprojdir) @@ -221,68 +221,68 @@ function _make_source_options(vcxprojfile, flags, condition) local flagstr = os.args(flags) -- make Optimization - if flagstr:find("[%-|/]Os") or flagstr:find("[%-|/]O1") then + if flagstr:find("[%-/]Os") or flagstr:find("[%-/]O1") then vcxprojfile:print("MinSpace", condition) - elseif flagstr:find("[%-|/]O2") or flagstr:find("[%-|/]Ot") then + elseif flagstr:find("[%-/]O2") or flagstr:find("[%-/]Ot") then vcxprojfile:print("MaxSpeed", condition) - elseif flagstr:find("[%-|/]Ox") then + elseif flagstr:find("[%-/]Ox") then vcxprojfile:print("Full", condition) else vcxprojfile:print("Disabled", condition) end -- make FloatingPointModel - if flagstr:find("[%-|/]fp:fast") then + if flagstr:find("[%-/]fp:fast") then vcxprojfile:print("Fast", condition) - elseif flagstr:find("[%-|/]fp:strict") then + elseif flagstr:find("[%-/]fp:strict") then vcxprojfile:print("Strict", condition) - elseif flagstr:find("[%-|/]fp:precise") then + elseif flagstr:find("[%-/]fp:precise") then vcxprojfile:print("Precise", condition) end -- make WarningLevel - if flagstr:find("[%-|/]W1") then + if flagstr:find("[%-/]W1") then vcxprojfile:print("Level1", condition) - elseif flagstr:find("[%-|/]W2") then + elseif flagstr:find("[%-/]W2") then vcxprojfile:print("Level2", condition) - elseif flagstr:find("[%-|/]W3") then + elseif flagstr:find("[%-/]W3") then vcxprojfile:print("Level3", condition) - elseif flagstr:find("[%-|/]Wall") then + elseif flagstr:find("[%-/]Wall") then vcxprojfile:print("EnableAllWarnings", condition) else vcxprojfile:print("TurnOffAllWarnings", condition) end - if flagstr:find("[%-|/]WX") then + if flagstr:find("[%-/]WX") then vcxprojfile:print("true", condition) end -- make DebugInformationFormat - if flagstr:find("[%-|/]Zi") then + if flagstr:find("[%-/]Zi") then vcxprojfile:print("ProgramDatabase", condition) - elseif flagstr:find("[%-|/]ZI") then + elseif flagstr:find("[%-/]ZI") then vcxprojfile:print("EditAndContinue", condition) - elseif flagstr:find("[%-|/]Z7") then + elseif flagstr:find("[%-/]Z7") then vcxprojfile:print("OldStyle", condition) else vcxprojfile:print("None", condition) end -- make RuntimeLibrary - if flagstr:find("[%-|/]MDd") then + if flagstr:find("[%-/]MDd") then vcxprojfile:print("MultiThreadedDebugDLL", condition) - elseif flagstr:find("[%-|/]MD") then + elseif flagstr:find("[%-/]MD") then vcxprojfile:print("MultiThreadedDLL", condition) - elseif flagstr:find("[%-|/]MTd") then + elseif flagstr:find("[%-/]MTd") then vcxprojfile:print("MultiThreadedDebug", condition) - elseif flagstr:find("[%-|/]MT") then + elseif flagstr:find("[%-/]MT") then vcxprojfile:print("MultiThreaded", condition) end -- make AdditionalIncludeDirectories - if flagstr:find("[%-|/]I") then + if flagstr:find("[%-/]I") then local dirs = {} for _, flag in ipairs(flags) do - flag:gsub("[%-|/]I(.*)", function (dir) table.insert(dirs, dir) end) + flag:gsub("[%-/]I(.*)", function (dir) table.insert(dirs, dir) end) end if #dirs > 0 then vcxprojfile:print("%s", condition, table.concat(dirs, ";")) @@ -290,7 +290,7 @@ function _make_source_options(vcxprojfile, flags, condition) end -- complie as c++ if exists flag: /TP - if flagstr:find("[%-|/]TP") then + if flagstr:find("[%-/]TP") then vcxprojfile:print("CompileAsCpp", condition) end @@ -300,7 +300,7 @@ function _make_source_options(vcxprojfile, flags, condition) for _, flag in ipairs(flags) do local excluded = false for _, exclude in ipairs(excludes) do - if flag:find("[%-|/]" .. exclude) then + if flag:find("[%-/]" .. exclude) then excluded = true break end -- cgit v1.3.1