From 1bb2fd157c8b14c70a1853ea60dd1849de27327d Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Fri, 25 Feb 2022 22:35:24 +0800 Subject: make excluding more precise --- xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 1bdcc215c..efb2caddb 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -118,7 +118,7 @@ function _exclude_flags(flags, excludes) 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 @@ -502,7 +502,7 @@ function _make_source_options_cuda(vcxprojfile, flags, opt) vcxprojfile:print("O1", condition) elseif flagstr:find("[%-/]O2") then vcxprojfile:print("O2", condition) - elseif flagstr:find("[%-/]Ox") then + elseif flagstr:find("[%-/]O3") or flagstr:find("[%-/]Ox") then vcxprojfile:print("O3", condition) end @@ -562,11 +562,14 @@ function _make_source_options_cuda(vcxprojfile, flags, opt) end if arch then if not code then - code = arch:gsub("sm", "compute") + code = arch + arch = arch:gsub("sm", "compute") + table.insert(gencodes, arch .. "," .. arch) end table.insert(gencodes, arch .. "," .. code) end if #gencodes > 0 then + gencodes = table.unique(gencodes) vcxprojfile:print("%s", condition, table.concat(gencodes, ";")) end end @@ -623,7 +626,7 @@ function _make_source_options_cuda(vcxprojfile, flags, opt) -- make AdditionalOptions local excludes = { - "Od", "O1", "O2", "Ox", "W1", "W2", "W3", "W4", "Wall", "I", "D", "L", "l", "m", "%-machine", "gencode", "arch", "code", "cudart", "G", "use_fast_math", "rdc", "%-keep", "%-keep%-dir" + "Od", "O1", "O2", "O3", "Ox", "W1", "W2", "W3", "W4", "Wall", "I", "D", "L", "l", "m", "%-machine", "gencode", "arch", "code", "cudart", "G", "use_fast_math", "rdc", "%-keep", "%-keep%-dir" } local additional_flags = _exclude_flags(flags, excludes) if #additional_flags > 0 then -- cgit v1.3.1