summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-06-05 22:39:05 +0800
committerruki <[email protected]>2023-06-05 22:39:05 +0800
commit0d6a2436f46d20208dc95b218e68d2a6ff827169 (patch)
tree13fc6572ee4b637bd57d97a4d8de95f1686f3459
parent9d86054a09b6697b5490cd373848f030e6194eb0 (diff)
add cxflags for vsxmake generator #3807
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua5
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.props1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.targets3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)3
4 files changed, 12 insertions, 0 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 9f32fccbb..16ba9d3f5 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -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..7a29d286a 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>
+ <AditionalOptions>%(AditionalOptions);$(XmakeCFlags);$(XmakeCXFlags);$(XmakeCXXFlags)</AditionalOptions>
<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>