From 90786f2a568f3063907f4566d910da1ceae74194 Mon Sep 17 00:00:00 2001 From: 夕伽 Date: Sun, 2 Sep 2018 20:00:16 +0800 Subject: vsporject add some configs 1.suport vsproject mfc mode target(xxx) -- for make vsproject on mfcmode set_values("mfc",true) -- for unicode mode add_defines("UNICODE") -- use MT or MD switch RuntimeLibrary, (debug use MTd,MDd) add_cxflags("-MT") 2.subsystem switch support target(xxx) -- change subsystem to windows, default console add_ldflags("/SUBSYSTEM:WINDOWS",{force=true}) --- .../plugins/project/vstudio/impl/vs200x_vcproj.lua | 61 ++++++++++++++++++++-- xmake/plugins/project/vstudio/impl/vs201x.lua | 19 ++++++- .../project/vstudio/impl/vs201x_vcxproj.lua | 17 ++++-- 3 files changed, 88 insertions(+), 9 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index d1dd0d06e..91c287c08 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -180,10 +180,22 @@ end -- WarningLevel="3" -- DebugInformationFormat="4" -- /> -function _make_VCCLCompilerTool(vcprojfile, vsinfo, target) +function _make_VCCLCompilerTool(vcprojfile, vsinfo, target, compflags) vcprojfile:enter("") end @@ -219,15 +231,22 @@ function _make_VCLinkerTool(vcprojfile, vsinfo, target, vcprojdir) end end + -- subsystem, console: 1, windows: 2 + local subsystem = 1 + local flags = _make_linkflags(target, vcprojdir) + if string.lower(flags):find("[%-/]subsystem:windows") then + subsystem = 2 + end + -- make it vcprojfile:enter("") end @@ -243,6 +262,37 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) , static = 4 } + -- save compiler flags + local compflags=nil + for sourcekind, sourcebatch in pairs(target:sourcebatches()) do + if not sourcebatch.rulename then + for _, sourcefile in ipairs(sourcebatch.sourcefiles) do + local flags = compiler.compflags(sourcefile, {target = target}) + if sourcekind == "cc" or sourcekind == "cxx" then + compflags = flags + break + end + end + end + if compflags then + break + end + end + + -- set default mfc, not used: 0, static:1, dynamic:2 + local mfc = ifelse(target:values("mfc"), 2, 0) + -- set unicode and mfc + local unicode = false + for _, flag in pairs(compflags) do + if flag:find("-DUNICODE") then + unicode = true + elseif flag:find("[%-|/]MT") then + mfc = ifelse(mfc ~= 0, 1, 0) + elseif flag:find("[%-|/]MD") then + mfc = ifelse(mfc ~= 0, 2, 0) + end + end + -- enter configurations vcprojfile:enter("") @@ -252,7 +302,8 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) vcprojfile:print("OutputDirectory=\"%s\"", path.relative(path.absolute(target:targetdir()), vcprojdir)) vcprojfile:print("IntermediateDirectory=\"%s\"", path.relative(path.absolute(target:objectdir()), vcprojdir)) vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:get("kind")])) - vcprojfile:print("CharacterSet=\"2\"") -- mbc: 2, wcs: 1 + vcprojfile:print("CharacterSet=\"%d\"", ifelse(unicode, 1, 2)) -- mbc: 2, wcs: 1 + vcprojfile:print("UseOfMFC=\"%d\"", mfc) vcprojfile:print(">") -- make VCPreBuildEventTool @@ -281,7 +332,7 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) vcprojfile:leave("/>") -- make VCCLCompilerTool - _make_VCCLCompilerTool(vcprojfile, vsinfo, target) + _make_VCCLCompilerTool(vcprojfile, vsinfo, target, compflags) -- make VCManagedResourceCompilerTool vcprojfile:enter("", targetinfo.mode, targetinfo.arch) vcxprojfile:print("%s", assert(configuration_types[target.kind])) vcxprojfile:print("v%s", assert(toolset_versions["vs" .. vsinfo.vstudio_version])) - vcxprojfile:print("MultiByte") + vcxprojfile:print("%s", ifelse(targetinfo.unicode, "Unicode", "MultiByte")) + if targetinfo.mfc then + vcxprojfile:print("%s", targetinfo.mfc) + end vcxprojfile:leave("") end @@ -328,12 +331,20 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo, vcxprojdir) -- for linker? vcxprojfile:enter("<%s>", linkerkinds[targetinfo.targetkind]) + -- save subsystem + local subsystem = "Console" + -- make linker flags local flags = {} for _, flag in ipairs(_make_linkflags(targetinfo, vcxprojdir)) do + local flag_lower = string.lower(flag) + + -- remove "-subsystem:windows" + if flag_lower:find("[%-/]subsystem:windows") then + subsystem = "Windows" -- remove "-machine:[x86|x64]", "-pdb:*.pdb" and "-debug" - if not flag:find("[%-/]machine:%w+") and not flag:find("[%-/]pdb:.+%.pdb") and not flag:find("[%-/]debug") then + elseif not flag_lower:find("[%-/]machine:%w+") and not flag_lower:find("[%-/]pdb:.+%.pdb") and not flag_lower:find("[%-/]debug") then table.insert(flags, flag) end end @@ -358,7 +369,7 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo, vcxprojdir) -- make SubSystem if targetinfo.targetkind == "binary" then - vcxprojfile:print("Console") + vcxprojfile:print("%s", subsystem) end -- make TargetMachine -- cgit v1.3.1 From 8e286dbab27c3f592f8379185c43ca0cc930d34f Mon Sep 17 00:00:00 2001 From: 夕伽 Date: Mon, 3 Sep 2018 08:26:50 +0800 Subject: 1 string.lower(xxx) -> xxx:lower() 2 -DUNICODE -> [%-|/]DUNICODE --- xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua | 4 ++-- xmake/plugins/project/vstudio/impl/vs201x.lua | 2 +- xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index 91c287c08..e907f0599 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -234,7 +234,7 @@ function _make_VCLinkerTool(vcprojfile, vsinfo, target, vcprojdir) -- subsystem, console: 1, windows: 2 local subsystem = 1 local flags = _make_linkflags(target, vcprojdir) - if string.lower(flags):find("[%-/]subsystem:windows") then + if flags:lower():find("[%-/]subsystem:windows") then subsystem = 2 end @@ -284,7 +284,7 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) -- set unicode and mfc local unicode = false for _, flag in pairs(compflags) do - if flag:find("-DUNICODE") then + if flag:find("[%-|/]DUNICODE") then unicode = true elseif flag:find("[%-|/]MT") then mfc = ifelse(mfc ~= 0, 1, 0) diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index bcdd45ddd..8671ea508 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -97,7 +97,7 @@ function _make_targetinfo(mode, arch, target) targetinfo.mfc = ifelse(target:values("mfc"), "Dynamic", nil) -- set unicode and mfc for _, flag in pairs(firstcompflags) do - if flag:find("-DUNICODE") then + if flag:find("[%-|/]DUNICODE") then targetinfo.unicode = true elseif flag:find("[%-|/]MT") then targetinfo.mfc = ifelse(targetinfo.mfc, "Static", false) diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 4e96a4fe1..547414307 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -338,7 +338,7 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo, vcxprojdir) local flags = {} for _, flag in ipairs(_make_linkflags(targetinfo, vcxprojdir)) do - local flag_lower = string.lower(flag) + local flag_lower = flag:lower() -- remove "-subsystem:windows" if flag_lower:find("[%-/]subsystem:windows") then -- cgit v1.3.1 From c39dadaef967d5ea5e334af442ca4c8c56959a3a Mon Sep 17 00:00:00 2001 From: 夕伽 Date: Mon, 3 Sep 2018 11:02:14 +0800 Subject: add *.rc files to vsproject --- .../plugins/project/vstudio/impl/vs200x_vcproj.lua | 79 +++++++++++++++++++--- .../project/vstudio/impl/vs201x_vcxproj.lua | 25 +++++-- 2 files changed, 88 insertions(+), 16 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index e907f0599..2b6af017f 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -401,7 +401,7 @@ function _make_references(vcprojfile, vsinfo, target) vcprojfile:leave("") end --- make file +-- make cxfile -- -- .e.g -- -- -- -function _make_file(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) +function _make_cxfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) -- get the target key local key = tostring(target) @@ -457,6 +457,48 @@ function _make_file(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdi vcprojfile:leave("") end +-- make file +-- +-- .e.g +-- +-- +-- +-- +-- +function _make_rcfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) + + -- enter file + vcprojfile:enter("") + + -- add file configuration + vcprojfile:enter("") + + -- add compiling options + vcprojfile:enter("") + vcprojfile:leave("") + + -- leave file + vcprojfile:leave("") +end + -- make files -- -- .e.g @@ -492,18 +534,35 @@ function _make_files(vcprojfile, vsinfo, target, vcprojdir) -- enter files vcprojfile:enter("") - vcprojfile:enter("") - - -- add files - local objectfiles = target:objectfiles() - for idx, sourcefile in ipairs(target:sourcefiles()) do - _make_file(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) + local sourcebatches = target:sourcebatches() + -- *.rc files + vcprojfile:enter("") + for sourcekind, sourcebatch in pairs(sourcebatches) do + if sourcekind ~= "mrc" then + local objectfiles = sourcebatch.objectfiles + for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do + _make_cxfile(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) + end + end end -- leave files vcprojfile:leave("") + + -- *.rc files + vcprojfile:enter("") + for sourcekind, sourcebatch in pairs(sourcebatches) do + if sourcekind == "mrc" then + local objectfiles = sourcebatch.objectfiles + for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do + _make_rcfile(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) + end + end + end + + -- leave *.rc files + vcprojfile:leave("") + vcprojfile:leave("") end diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 547414307..575e339ae 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -416,7 +416,7 @@ function _make_common_items(vcxprojfile, vsinfo, target, vcxprojdir) local first_flags = nil targetinfo.sourceflags = {} for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as") then + if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do -- make compiler flags @@ -485,8 +485,9 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc end -- enter it + local nodename = ifelse(sourcekind == "as", "CustomBuild", ifelse(sourcekind == "mrc", "ResourceCompile", "ClCompile")) sourcefile = path.relative(path.absolute(sourcefile), vcxprojdir) - vcxprojfile:enter("<%s Include=\"%s\">", ifelse(sourcekind == "as", "CustomBuild", "ClCompile"), sourcefile) + vcxprojfile:enter("<%s Include=\"%s\">", nodename, sourcefile) -- for *.asm files if sourcekind == "as" then @@ -498,6 +499,13 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc vcxprojfile:print("%s /nologo /c %s -Fo%s %s", info.mode .. '|' .. info.arch, ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile) end + -- for *.rc files + elseif sourcekind == "mrc" then + for _, info in ipairs(sourceinfo) do + local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir) + vcxprojfile:print("%s",info.mode,info.arch,objectfile) + end + -- for *.c/cpp files else @@ -582,7 +590,7 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc end -- leave it - vcxprojfile:leave("", ifelse(sourcekind == "as", "CustomBuild", "ClCompile")) + vcxprojfile:leave("", nodename) end -- make source file for specific modes @@ -593,7 +601,8 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour for _, info in ipairs(sourceinfo) do -- enter it - vcxprojfile:enter("<%s Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s|%s\'\" Include=\"%s\">", ifelse(info.sourcekind == "as", "CustomBuild", "ClCompile"), info.mode, info.arch, sourcefile) + local nodename = ifelse(info.sourcekind == "as", "CustomBuild", ifelse(info.sourcekind == "mrc", "ResourceCompile", "ClCompile")) + vcxprojfile:enter("<%s Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s|%s\'\" Include=\"%s\">", nodename, info.mode, info.arch, sourcefile) -- for *.asm files local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir) @@ -603,6 +612,10 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour vcxprojfile:print("%s", objectfile) vcxprojfile:print("%s /nologo /c %s -Fo%s %s", ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile) + -- for *.rc files + elseif sourcekind == "mrc" then + vcxprojfile:print("%s",info.mode,info.arch,objectfile) + -- for *.c/cpp files else @@ -616,7 +629,7 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour end -- leave it - vcxprojfile:leave("", ifelse(info.sourcekind == "as", "CustomBuild", "ClCompile")) + vcxprojfile:leave("", nodename) end end @@ -658,7 +671,7 @@ function _make_source_files(vcxprojfile, vsinfo, target, vcxprojdir) local sourceinfos = {} for _, targetinfo in ipairs(target.info) do for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as") then + if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then local objectfiles = sourcebatch.objectfiles for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do local objectfile = objectfiles[idx] -- cgit v1.3.1 From 5ff368bb0b3990c1ff6d360cd27cd4d4e24da511 Mon Sep 17 00:00:00 2001 From: 夕伽 Date: Mon, 3 Sep 2018 11:13:34 +0800 Subject: 1 string.lower(xxx) -> xxx:lower() 2 -DUNICODE -> [%-|/]DUNICODE --- .../plugins/project/vstudio/impl/vs200x_vcproj.lua | 88 +++------------------- xmake/plugins/project/vstudio/impl/vs201x.lua | 8 +- .../project/vstudio/impl/vs201x_vcxproj.lua | 25 ++---- 3 files changed, 18 insertions(+), 103 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index 2b6af017f..393c3d43e 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -279,17 +279,11 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) end end - -- set default mfc, not used: 0, static:1, dynamic:2 - local mfc = ifelse(target:values("mfc"), 2, 0) - -- set unicode and mfc + -- set unicode local unicode = false for _, flag in pairs(compflags) do if flag:find("[%-|/]DUNICODE") then unicode = true - elseif flag:find("[%-|/]MT") then - mfc = ifelse(mfc ~= 0, 1, 0) - elseif flag:find("[%-|/]MD") then - mfc = ifelse(mfc ~= 0, 2, 0) end end @@ -303,7 +297,6 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) vcprojfile:print("IntermediateDirectory=\"%s\"", path.relative(path.absolute(target:objectdir()), vcprojdir)) vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:get("kind")])) vcprojfile:print("CharacterSet=\"%d\"", ifelse(unicode, 1, 2)) -- mbc: 2, wcs: 1 - vcprojfile:print("UseOfMFC=\"%d\"", mfc) vcprojfile:print(">") -- make VCPreBuildEventTool @@ -401,7 +394,7 @@ function _make_references(vcprojfile, vsinfo, target) vcprojfile:leave("") end --- make cxfile +-- make file -- -- .e.g -- -- -- -function _make_cxfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) +function _make_file(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) -- get the target key local key = tostring(target) @@ -457,48 +450,6 @@ function _make_cxfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcproj vcprojfile:leave("") end --- make file --- --- .e.g --- --- --- --- --- -function _make_rcfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) - - -- enter file - vcprojfile:enter("") - - -- add file configuration - vcprojfile:enter("") - - -- add compiling options - vcprojfile:enter("") - vcprojfile:leave("") - - -- leave file - vcprojfile:leave("") -end - -- make files -- -- .e.g @@ -534,35 +485,18 @@ function _make_files(vcprojfile, vsinfo, target, vcprojdir) -- enter files vcprojfile:enter("") - local sourcebatches = target:sourcebatches() - -- *.rc files - vcprojfile:enter("") - for sourcekind, sourcebatch in pairs(sourcebatches) do - if sourcekind ~= "mrc" then - local objectfiles = sourcebatch.objectfiles - for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do - _make_cxfile(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) - end - end - end - - -- leave files - vcprojfile:leave("") + vcprojfile:enter("") - -- *.rc files - vcprojfile:enter("") - for sourcekind, sourcebatch in pairs(sourcebatches) do - if sourcekind == "mrc" then - local objectfiles = sourcebatch.objectfiles - for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do - _make_rcfile(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) - end - end + -- add files + local objectfiles = target:objectfiles() + for idx, sourcefile in ipairs(target:sourcefiles()) do + _make_file(vcprojfile, vsinfo, target, sourcefile, objectfiles[idx], vcprojdir) end - -- leave *.rc files + -- leave files vcprojfile:leave("") - vcprojfile:leave("") end diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 8671ea508..65c4d1d2a 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -93,16 +93,10 @@ function _make_targetinfo(mode, arch, target) local linkflags = linker.linkflags(target:get("kind"), target:sourcekinds(), {target = target}) targetinfo.linkflags = linkflags - -- set default mfc - targetinfo.mfc = ifelse(target:values("mfc"), "Dynamic", nil) - -- set unicode and mfc + -- set unicode for _, flag in pairs(firstcompflags) do if flag:find("[%-|/]DUNICODE") then targetinfo.unicode = true - elseif flag:find("[%-|/]MT") then - targetinfo.mfc = ifelse(targetinfo.mfc, "Static", false) - elseif flag:find("[%-|/]MD") then - targetinfo.mfc = ifelse(targetinfo.mfc, "Dynamic", false) end end diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 575e339ae..547414307 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -416,7 +416,7 @@ function _make_common_items(vcxprojfile, vsinfo, target, vcxprojdir) local first_flags = nil targetinfo.sourceflags = {} for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then + if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as") then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do -- make compiler flags @@ -485,9 +485,8 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc end -- enter it - local nodename = ifelse(sourcekind == "as", "CustomBuild", ifelse(sourcekind == "mrc", "ResourceCompile", "ClCompile")) sourcefile = path.relative(path.absolute(sourcefile), vcxprojdir) - vcxprojfile:enter("<%s Include=\"%s\">", nodename, sourcefile) + vcxprojfile:enter("<%s Include=\"%s\">", ifelse(sourcekind == "as", "CustomBuild", "ClCompile"), sourcefile) -- for *.asm files if sourcekind == "as" then @@ -499,13 +498,6 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc vcxprojfile:print("%s /nologo /c %s -Fo%s %s", info.mode .. '|' .. info.arch, ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile) end - -- for *.rc files - elseif sourcekind == "mrc" then - for _, info in ipairs(sourceinfo) do - local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir) - vcxprojfile:print("%s",info.mode,info.arch,objectfile) - end - -- for *.c/cpp files else @@ -590,7 +582,7 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc end -- leave it - vcxprojfile:leave("", nodename) + vcxprojfile:leave("", ifelse(sourcekind == "as", "CustomBuild", "ClCompile")) end -- make source file for specific modes @@ -601,8 +593,7 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour for _, info in ipairs(sourceinfo) do -- enter it - local nodename = ifelse(info.sourcekind == "as", "CustomBuild", ifelse(info.sourcekind == "mrc", "ResourceCompile", "ClCompile")) - vcxprojfile:enter("<%s Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s|%s\'\" Include=\"%s\">", nodename, info.mode, info.arch, sourcefile) + vcxprojfile:enter("<%s Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s|%s\'\" Include=\"%s\">", ifelse(info.sourcekind == "as", "CustomBuild", "ClCompile"), info.mode, info.arch, sourcefile) -- for *.asm files local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir) @@ -612,10 +603,6 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour vcxprojfile:print("%s", objectfile) vcxprojfile:print("%s /nologo /c %s -Fo%s %s", ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile) - -- for *.rc files - elseif sourcekind == "mrc" then - vcxprojfile:print("%s",info.mode,info.arch,objectfile) - -- for *.c/cpp files else @@ -629,7 +616,7 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour end -- leave it - vcxprojfile:leave("", nodename) + vcxprojfile:leave("", ifelse(info.sourcekind == "as", "CustomBuild", "ClCompile")) end end @@ -671,7 +658,7 @@ function _make_source_files(vcxprojfile, vsinfo, target, vcxprojdir) local sourceinfos = {} for _, targetinfo in ipairs(target.info) do for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then + if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as") then local objectfiles = sourcebatch.objectfiles for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do local objectfile = objectfiles[idx] -- cgit v1.3.1 From 9ee12112e49db451a49a66d77dd2990d9f6ddab9 Mon Sep 17 00:00:00 2001 From: 夕伽 Date: Mon, 3 Sep 2018 11:15:59 +0800 Subject: remove mfc about --- xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 547414307..a7f151abd 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -173,9 +173,6 @@ function _make_configurations(vcxprojfile, vsinfo, target, vcxprojdir) vcxprojfile:print("%s", assert(configuration_types[target.kind])) vcxprojfile:print("v%s", assert(toolset_versions["vs" .. vsinfo.vstudio_version])) vcxprojfile:print("%s", ifelse(targetinfo.unicode, "Unicode", "MultiByte")) - if targetinfo.mfc then - vcxprojfile:print("%s", targetinfo.mfc) - end vcxprojfile:leave("") end -- cgit v1.3.1