diff options
| author | ruki <[email protected]> | 2023-06-07 22:59:05 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-07 22:59:05 +0800 |
| commit | 683c5ceadfbcfdb43ab82374065adc4d9881dc53 (patch) | |
| tree | c9f8c2800b7ce4fe20e08338fc3f6fbb2918302d | |
| parent | b7051526fdfbd6287842d611ef0dc2456fc09475 (diff) | |
| parent | e7e17687d3e5278e5337f0b1d5cb32bad4f14e2d (diff) | |
Merge pull request #3811 from xmake-io/vsxmake
add cxflags for vsxmake generator #3807
4 files changed, 15 insertions, 3 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 9f32fccbb..edc4a17b8 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -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 @@ -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 @@ -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 diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props index 3a9df6a4d..3e3a33298 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.props +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props @@ -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> diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets index 39b7da128..55f6b1fd2 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets @@ -139,6 +139,9 @@ MSBuild Properties: XmakeWindowsSdkVersion: $(XmakeWindowsSdkVersion) XmakeMfcKind: $(XmakeMfcKind) XmakeDefines: $(XmakeDefines) + XmakeCFlags: $(XmakeCFlags) + XmakeCXFlags: $(XmakeCXFlags) + XmakeCXXFlags: $(XmakeCXXFlags) XmakeLanguages: $(XmakeLanguages) XmakeSubSystem: $(XmakeSubSystem) XmakeIncludeDirs: $(XmakeIncludeDirs) diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) index 6d5b4165d..5fa6d0f0f 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) @@ -19,4 +19,7 @@ <XmakeLinkDirs>#linkdirs#</XmakeLinkDirs> <XmakeSourceDirs>#sourcedirs#</XmakeSourceDirs> <XmakePrecompiledHeader>#pcheaderfile#</XmakePrecompiledHeader> + <XmakeCFlags>#cflags#</XmakeCFlags> + <XmakeCXFlags>#cxflags#</XmakeCXFlags> + <XmakeCXXFlags>#cxxflags#</XmakeCXXFlags> </PropertyGroup> |
