diff options
| author | ruki <[email protected]> | 2020-12-04 22:34:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-04 22:34:53 +0800 |
| commit | 6dc9bb8002c3f1df874fe2d2adcbf94ac22b6531 (patch) | |
| tree | e3997d117103e9d956ddb3d85c791bcd76d3160e /xmake/plugins | |
| parent | 45cf48edf8f7859d6469dd783d8ff7d298f7f1c6 (diff) | |
fix c++ language intellisense for vsxmake
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/project/vsxmake/getinfo.lua | 17 | ||||
| -rw-r--r-- | xmake/plugins/project/vsxmake/render.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) | 1 |
3 files changed, 14 insertions, 8 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index e2a1496e7..96b4e18ba 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -151,6 +151,10 @@ function _make_targetinfo(mode, arch, target) -- save defines targetinfo.defines = _make_arrs(_get_values_from_target(target, "defines")) targetinfo.languages = _make_arrs(_get_values_from_target(target, "languages")) + targetinfo.cxxlanguage = "stdcpp14" -- only for intellisense + if targetinfo.languages:find("c++17", 1, true) or targetinfo.languages:find("cxx17", 1, true) then + targetinfo.cxxlanguage = "stdcpp17" + end local configcache = cache("local.config") local flags = {} for k, v in pairs(configcache:get("options_" .. target:name())) do @@ -325,13 +329,14 @@ function main(outputdir, vsinfo) _target.kind = target:targetkind() _target.scriptdir = path.relative(target:scriptdir(), _target.vcxprojdir) _target.projectdir = path.relative(project.directory(), _target.vcxprojdir) - local tgtdir = target:get("targetdir") - if tgtdir then _target.targetdir = path.relative(tgtdir, _target.vcxprojdir) end + local targetdir = target:get("targetdir") + if targetdir then _target.targetdir = path.relative(targetdir, _target.vcxprojdir) end _target._sub = _target._sub or {} _target._sub[mode] = _target._sub[mode] or {} - local tgtinfo = _make_targetinfo(mode, arch, target) - _target._sub[mode][arch] = tgtinfo - _target.sdkver = tgtinfo.sdkver + local targetinfo = _make_targetinfo(mode, arch, target) + _target._sub[mode][arch] = targetinfo + _target.sdkver = targetinfo.sdkver + _target.cxxlanguage = targetinfo.cxxlanguage -- save all sourcefiles and headerfiles _target.sourcefiles = table.unique(table.join(_target.sourcefiles or {}, (target:sourcefiles()))) @@ -345,7 +350,7 @@ function main(outputdir, vsinfo) -- leave project directory os.cd(oldir) - for _,target in pairs(targets) do + for _, target in pairs(targets) do target._sub2 = {} local dirs = {} local root = project.directory() diff --git a/xmake/plugins/project/vsxmake/render.lua b/xmake/plugins/project/vsxmake/render.lua index 8777471e0..346eec2f0 100644 --- a/xmake/plugins/project/vsxmake/render.lua +++ b/xmake/plugins/project/vsxmake/render.lua @@ -46,7 +46,7 @@ function _expand(params) for i, p in ipairs(r) do rcopy[i] = p .. "\0" .. c end - newr= table.join(newr, rcopy) + newr = table.join(newr, rcopy) end r = newr end @@ -71,4 +71,4 @@ end function main(templatepath, pattern, paramsprovider) local opt = { pattern = pattern, paramsprovider = paramsprovider, templatedir = path.directory(templatepath) } return _render(templatepath, opt, {}) -end
\ No newline at end of file +end diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) index 92a8b031f..854d1f52f 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) @@ -1,3 +1,4 @@ <ClCompile Include="$(XmakeProjectDir)\#path#"> <CompileAs>CompileAsCpp</CompileAs> + <LanguageStandard>#cxxlanguage#</LanguageStandard> </ClCompile> |
