diff options
| author | 夕伽 <[email protected]> | 2018-09-03 11:13:34 +0800 |
|---|---|---|
| committer | 夕伽 <[email protected]> | 2018-09-03 11:13:34 +0800 |
| commit | 5ff368bb0b3990c1ff6d360cd27cd4d4e24da511 (patch) | |
| tree | d3c8ef59fe0894b9480e34bea3e9fb7bf519a607 /xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua | |
| parent | c39dadaef967d5ea5e334af442ca4c8c56959a3a (diff) | |
1 string.lower(xxx) -> xxx:lower()
2 -DUNICODE -> [%-|/]DUNICODE
Diffstat (limited to 'xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua')
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua | 88 |
1 files changed, 11 insertions, 77 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("</References>") end --- make cxfile +-- make file -- -- .e.g -- <File @@ -416,7 +409,7 @@ end -- /> -- </FileConfiguration> -- </File> -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("</File>") end --- make file --- --- .e.g --- <File --- RelativePath="..\..\..\src\resource.rc" --- > --- <FileConfiguration --- Name="Debug|Win32" --- > --- <Tool --- Name="VCResourceCompilerTool" --- ResourceOutputFileName="..\..\..\build\src\resource.res" --- /> --- </FileConfiguration> --- </File> -function _make_rcfile(vcprojfile, vsinfo, target, sourcefile, objectfile, vcprojdir) - - -- enter file - vcprojfile:enter("<File") - - -- add file path - vcprojfile:print("RelativePath=\"%s\"", path.relative(path.absolute(sourcefile), vcprojdir)) - vcprojfile:print(">") - - -- add file configuration - vcprojfile:enter("<FileConfiguration") - vcprojfile:print("Name=\"$(mode)|Win32\"") - vcprojfile:print(">") - - -- add compiling options - vcprojfile:enter("<Tool") - vcprojfile:print("Name=\"VCResourceCompilerTool\"") - -- fixme, maybe need - -- vcprojfile:print("AdditionalOptions=\"%s\"", flags) - vcprojfile:print("ResourceOutputFileName=\"%s\"", path.relative(path.absolute(objectfile), vcprojdir)) - vcprojfile:leave("/>") - vcprojfile:leave("</FileConfiguration>") - - -- leave file - vcprojfile:leave("</File>") -end - -- make files -- -- .e.g @@ -534,35 +485,18 @@ function _make_files(vcprojfile, vsinfo, target, vcprojdir) -- enter files vcprojfile:enter("<Files>") - local sourcebatches = target:sourcebatches() - -- *.rc files - vcprojfile:enter("<Filter Name=\"Source Files\">") - 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("</Filter>") + vcprojfile:enter("<Filter") + vcprojfile:print("Name=\"Source Files\"") + vcprojfile:print(">") - -- *.rc files - vcprojfile:enter("<Filter Name=\"Resource Files\">") - 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("</Filter>") - vcprojfile:leave("</Files>") end |
