From b981e67e89f363288134dfbcab2a68aef1d80295 Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Mon, 9 Apr 2018 17:23:10 +0200 Subject: [PATCH] Add structmemberalign API + implement for vstudio --- .../tests/vc2010/test_compile_settings.lua | 17 +++++++++++++++++ modules/vstudio/vs2010_vcxproj.lua | 6 ++++++ src/_premake_init.lua | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/modules/vstudio/tests/vc2010/test_compile_settings.lua b/modules/vstudio/tests/vc2010/test_compile_settings.lua index bbffd42c..8c070981 100644 --- a/modules/vstudio/tests/vc2010/test_compile_settings.lua +++ b/modules/vstudio/tests/vc2010/test_compile_settings.lua @@ -1238,3 +1238,20 @@ ]] end + +-- +-- Check StructMemberAlignment +-- + + function suite.structMemberAlignment() + structmemberalign "1Byte" + prepare() + test.capture [[ + + NotUsing + Level3 + Disabled + 1Byte + + ]] + end diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index ce0f79e4..c52d4a30 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -347,6 +347,7 @@ m.compileAs, m.callingConvention, m.languageStandard, + m.structMemberAlignment, } if cfg.kind == p.STATICLIB then @@ -1269,6 +1270,11 @@ end end + function m.structMemberAlignment(cfg) + if cfg.structmemberalign then + m.element("StructMemberAlignment", nil, cfg.structmemberalign) + end + end function m.additionalCompileOptions(cfg, condition) local opts = cfg.buildoptions diff --git a/src/_premake_init.lua b/src/_premake_init.lua index bcb445ed..f20206d5 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1336,6 +1336,19 @@ } } + p.api.register { + name = "structmemberalign", + scope = "config", + kind = "string", + allowed = { + "1Byte", + "2Bytes", + "4Bytes", + "8Bytes", + "16Bytes", + } + } + ----------------------------------------------------------------------------- -- -- Field name aliases for backward compatibility