Skip to content

Commit

Permalink
Merge pull request #3811 from xmake-io/vsxmake
Browse files Browse the repository at this point in the history
add cxflags for vsxmake generator #3807
  • Loading branch information
waruqi authored Jun 7, 2023
2 parents b705152 + e7e1768 commit 683c5ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xmake/plugins/project/vsxmake/getinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function _make_dirs(dir)
return path.joinenv(r)
end

function _make_arrs(arr)
function _make_arrs(arr, sep)
if arr == nil then
return ""
end
Expand All @@ -82,10 +82,10 @@ function _make_arrs(arr)
end
local r = {}
for k, v in ipairs(arr) do
r[k] = _make_arrs(v)
r[k] = _make_arrs(v, sep)
end
r = table.unique(r)
return table.concat(r, ";")
return table.concat(r, sep or ";")
end

-- get values from target
Expand Down Expand Up @@ -137,6 +137,11 @@ function _make_targetinfo(mode, arch, target)
-- save defines
targetinfo.defines = _make_arrs(_get_values_from_target(target, "defines"))

-- save flags
targetinfo.cflags = _make_arrs(_get_values_from_target(target, "cflags"), " ")
targetinfo.cxflags = _make_arrs(_get_values_from_target(target, "cxflags"), " ")
targetinfo.cxxflags = _make_arrs(_get_values_from_target(target, "cxxflags"), " ")

-- save languages
targetinfo.languages = _make_arrs(_get_values_from_target(target, "languages"))
if targetinfo.languages then
Expand Down
1 change: 1 addition & 0 deletions xmake/plugins/project/vsxmake/vsproj/Xmake.props
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(XmakeIncludeDirs)</AdditionalIncludeDirectories>
<AdditionalOptions>%(AdditionalOptions) $(XmakeCFlags) $(XmakeCXFlags) $(XmakeCXXFlags)</AdditionalOptions>
<LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard>
<LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard>
<LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard>
Expand Down
3 changes: 3 additions & 0 deletions xmake/plugins/project/vsxmake/vsproj/Xmake.targets
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ MSBuild Properties:
XmakeWindowsSdkVersion: $(XmakeWindowsSdkVersion)
XmakeMfcKind: $(XmakeMfcKind)
XmakeDefines: $(XmakeDefines)
XmakeCFlags: $(XmakeCFlags)
XmakeCXFlags: $(XmakeCXFlags)
XmakeCXXFlags: $(XmakeCXXFlags)
XmakeLanguages: $(XmakeLanguages)
XmakeSubSystem: $(XmakeSubSystem)
XmakeIncludeDirs: $(XmakeIncludeDirs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
<XmakeLinkDirs>#linkdirs#</XmakeLinkDirs>
<XmakeSourceDirs>#sourcedirs#</XmakeSourceDirs>
<XmakePrecompiledHeader>#pcheaderfile#</XmakePrecompiledHeader>
<XmakeCFlags>#cflags#</XmakeCFlags>
<XmakeCXFlags>#cxflags#</XmakeCXFlags>
<XmakeCXXFlags>#cxxflags#</XmakeCXXFlags>
</PropertyGroup>

0 comments on commit 683c5ce

Please sign in to comment.