diff options
| author | 夕伽 <[email protected]> | 2018-09-02 20:00:16 +0800 |
|---|---|---|
| committer | 夕伽 <[email protected]> | 2018-09-02 20:00:16 +0800 |
| commit | 90786f2a568f3063907f4566d910da1ceae74194 (patch) | |
| tree | 4f11bbcafa5038d3df251d63d930a6f07447d3ec /xmake/plugins/project/vstudio/impl/vs201x.lua | |
| parent | d74715b3615e171776a6e5b9971d2ec2bff115d5 (diff) | |
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})
Diffstat (limited to 'xmake/plugins/project/vstudio/impl/vs201x.lua')
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 8ef5681d2..bcdd45ddd 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -75,11 +75,15 @@ function _make_targetinfo(mode, arch, target) targetinfo.objectdir = target:objectdir() -- save compiler flags + local firstcompflags=nil targetinfo.compflags = {} - for _, sourcebatch in pairs(target:sourcebatches()) do + for sourcekind, sourcebatch in pairs(target:sourcebatches()) do if not sourcebatch.rulename then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local compflags = compiler.compflags(sourcefile, {target = target}) + if not firstcompflags and (sourcekind == "cc" or sourcekind == "cxx") then + firstcompflags = compflags + end targetinfo.compflags[sourcefile] = compflags end end @@ -89,6 +93,19 @@ 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 + 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 + -- ok return targetinfo end |
