Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_vs2010_flags.lua « vstudio « actions « tests - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c09776c8988d5cfbdc70e32969b74425b5d8b3c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377

T.vs2010_flags = { }
local vs10_flags = T.vs2010_flags
local sln, prj

function vs10_flags.setup()
	_ACTION = "vs2010"

	sln = solution "MySolution"
	configurations { "Debug" }
	platforms {}
	
	prj = project "MyProject"
	language "C++"
	kind "ConsoleApp"
	uuid "AE61726D-187C-E440-BD07-2556188A6565"		
	includedirs{"foo/bar"}	
end

function vs10_flags.teardown()
	sln = nil
	prj = nil
end

local function get_buffer()
	io.capture()
	premake.bake.buildconfigs()
	sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
	prj = premake.solution.getproject(sln, 1)
	premake.vs2010_vcxproj(prj)
	local buffer = io.endcapture()
	return buffer
end


function vs10_flags.sseSet()
	flags  {"EnableSSE"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
end

function vs10_flags.sse2Set()
	flags  {"EnableSSE2"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
end

function vs10_flags.extraWarningNotSet_warningLevelIsThree()
	local buffer = get_buffer()
	test.string_contains(buffer,'<WarningLevel>Level3</WarningLevel>')
end

function vs10_flags.extraWarning_warningLevelIsFour()
	flags  {"ExtraWarnings"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<WarningLevel>Level4</WarningLevel>')
end

function vs10_flags.extraWarning_treatWarningsAsError_setToTrue()
	flags  {"FatalWarnings"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<TreatWarningAsError>true</TreatWarningAsError>')
end

function vs10_flags.floatFast_floatingPointModel_setToFast()
	flags  {"FloatFast"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<FloatingPointModel>Fast</FloatingPointModel>')
end

function vs10_flags.floatStrict_floatingPointModel_setToStrict()
	flags  {"FloatStrict"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<FloatingPointModel>Strict</FloatingPointModel>')
end

function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToTrue()
	flags  {"NativeWChar"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
end

function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToFalse()
	flags  {"NoNativeWChar"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
end

function vs10_flags.noExceptions_exceptionHandling_setToFalse()
	flags  {"NoExceptions"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<ExceptionHandling>false</ExceptionHandling>')
end

function vs10_flags.structuredExceptions_exceptionHandling_setToAsync()
	flags  {"SEH"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<ExceptionHandling>Async</ExceptionHandling>')
end

function vs10_flags.noFramePointer_omitFramePointers_setToTrue()
	flags  {"NoFramePointer"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<OmitFramePointers>true</OmitFramePointers>')
end


function vs10_flags.noRTTI_runtimeTypeInfo_setToFalse()
	flags  {"NoRTTI"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
end

function vs10_flags.optimizeSize_optimization_setToMinSpace()
	flags  {"OptimizeSize"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<Optimization>MinSpace</Optimization>')
end

function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
	flags  {"OptimizeSpeed"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<Optimization>MaxSpeed</Optimization>')
end
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
	flags  {"Optimize"}
		
	local buffer = get_buffer()
	test.string_contains(buffer,'<Optimization>Full</Optimization>')
end


local debug_string = "Symbols"
local release_string = "Optimize"
function vs10_flags.debugHasNoStaticRuntime_runtimeLibrary_setToMultiThreadedDebugDLL()
	flags {debug_string}
	local buffer = get_buffer()
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
end

function vs10_flags.debugAndStaticRuntime_runtimeLibrary_setToMultiThreadedDebug()
	flags {debug_string,"StaticRuntime"}
	local buffer = get_buffer()
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>')
end

function vs10_flags.releaseHasNoStaticRuntime_runtimeLibrary_setToMultiThreadedDLL()
	flags {release_string}
	local buffer = get_buffer()
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')
end

function vs10_flags.releaseAndStaticRuntime_runtimeLibrary_setToMultiThreaded()
	flags {release_string,"StaticRuntime"}
	local buffer = get_buffer()
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreaded</RuntimeLibrary>')
end

function vs10_flags.noCharacterSetDefine_characterSet_setToMultiByte()
	local buffer = get_buffer()
	test.string_contains(buffer,'<CharacterSet>MultiByte</CharacterSet>')
end

function vs10_flags.unicode_characterSet_setToUnicode()
	flags {"Unicode"}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<CharacterSet>Unicode</CharacterSet>')
end



function vs10_flags.debugAndNoMinimalRebuildAndSymbols_minimalRebuild_setToFalse()
	flags {debug_string,"NoMinimalRebuild"}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end

function vs10_flags.debugYetNotMinimalRebuild_minimalRebuild_setToTrue()
	flags {debug_string}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<MinimalRebuild>true</MinimalRebuild>')
end

function vs10_flags.release_minimalRebuild_setToFalse()
	flags {release_string}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end

function vs10_flags.mfc_useOfMfc_setToStatic()
    flags{"MFC"}
    
    local buffer = get_buffer()
    test.string_contains(buffer,'<UseOfMfc>Dynamic</UseOfMfc>')
end

--there is not an option for /Z7 OldStyle
--/ZI is not compatible with /clr or x64_64
--minimal Rebuild requires /Zi in x86_64

function vs10_flags.symbols_32BitBuild_DebugInformationFormat_setToEditAndContinue()
	flags{"Symbols"}
	platforms{'x32'}
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
end

function vs10_flags.symbols_64BitBuild_DebugInformationFormat_setToProgramDatabase()
	flags{"Symbols"}
	platforms{"x64"}
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end

function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_setToProgramDatabase()
	flags{"Symbols","NoEditAndContinue"}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end

function vs10_flags.symbolsAndRelease_DebugInformationFormat_setToProgramDatabase()
	flags{"Symbols",release_string}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end

function vs10_flags.symbolsManaged_DebugInformationFormat_setToProgramDatabase()
	flags{"Symbols","Managed"}
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end

function vs10_flags.noSymbols_DebugInformationFormat_blockIsEmpty()
	local buffer = get_buffer()
	test.string_contains(buffer,'<DebugInformationFormat></DebugInformationFormat>')
end

function vs10_flags.noManifest_GenerateManifest_setToFalse()
	flags{"NoManifest"}
	
	local buffer = get_buffer()
	test.string_contains(buffer,'<GenerateManifest Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">false</GenerateManifest>')
end

function vs10_flags.noSymbols_bufferDoesNotContainprogramDataBaseFile()
	local buffer = get_buffer()
	test.string_does_not_contain(buffer,'<Link>.*<ProgramDataBaseFileName>.*</Link>')
end
function vs10_flags.symbols_bufferContainsprogramDataBaseFile()
	flags{"Symbols"}
	local buffer = get_buffer()
	test.string_contains(buffer,'<ClCompile>.*<ProgramDataBaseFileName>%$%(OutDir%)MyProject%.pdb</ProgramDataBaseFileName>.*</ClCompile>')
end


function vs10_flags.WithOutManaged_bufferContainsKeywordWin32Proj()
	local buffer = get_buffer()
	test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<Keyword>Win32Proj</Keyword>.*</PropertyGroup>')
end

function vs10_flags.WithOutManaged_bufferDoesNotContainKeywordManagedCProj()
	local buffer = get_buffer()
	test.string_does_not_contain(buffer,'<PropertyGroup Label="Globals">.*<Keyword>ManagedCProj</Keyword>.*</PropertyGroup>')
end

T.vs2010_managedFlag = { }
local vs10_managedFlag = T.vs2010_managedFlag

local function vs10_managedFlag_setOnProject()
		local sln = solution "Sol"
		configurations { "Debug" }
		language "C++"
		kind "ConsoleApp"

		local prj = project "Prj"
			flags {"Managed"}

		return sln,prj
end


local function get_managed_buffer(sln,prj)
	io.capture()
	premake.bake.buildconfigs()
	sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
	prj = premake.solution.getproject(sln, 1)
	premake.vs2010_vcxproj(prj)
	local buffer = io.endcapture()
	return buffer
end

function vs10_managedFlag.setup()
end

function vs10_managedFlag.managedSetOnProject_CLRSupport_setToTrue()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)

	test.string_contains(buffer,
			'<PropertyGroup Condition=".*" Label="Configuration">'
				..'.*<CLRSupport>true</CLRSupport>'
			..'.*</PropertyGroup>')
end

function vs10_managedFlag.globals_bufferContainsKeywordManagedCProj()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)
	test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<Keyword>ManagedCProj</Keyword>.*</PropertyGroup>')
end


function vs10_managedFlag.globals_bufferDoesNotContainKeywordWin32Proj()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)
	test.string_does_not_contain(buffer,'<PropertyGroup Label="Globals">.*<Keyword>Win32Proj</Keyword>.*</PropertyGroup>')
end


function vs10_managedFlag.globals_FrameworkVersion_setToV4()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)
	test.string_contains(buffer,'<PropertyGroup Label="Globals">.*<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>.*</PropertyGroup>')
end


function vs10_managedFlag.withFloatFast_FloatingPointModelNotFoundInBuffer()
	local sln, prj = vs10_managedFlag_setOnProject()
	flags {"FloatStrict"}
	local buffer = get_managed_buffer(sln,prj)
	test.string_does_not_contain(buffer,'<FloatingPointModel>.*</FloatingPointModel>')
end

function vs10_managedFlag.debugWithStaticRuntime_flagIgnoredAndRuntimeSetToMDd()
	local sln, prj = vs10_managedFlag_setOnProject()
	flags {"Symbols","StaticRuntime"}
	local buffer = get_managed_buffer(sln,prj)
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
end

function vs10_managedFlag.notDebugWithStaticRuntime_flagIgnoredAndRuntimeSetToMD()
	local sln, prj = vs10_managedFlag_setOnProject()
	flags {"StaticRuntime"}
	local buffer = get_managed_buffer(sln,prj)
	test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')
end

function vs10_managedFlag.noOptimisationFlag_basicRuntimeChecksNotFoundInBuffer()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)
	test.string_does_not_contain(buffer,'<BasicRuntimeChecks>.*</BasicRuntimeChecks>')
end

function vs10_managedFlag.applictionWithOutWinMain_EntryPointSymbolNotFoundInBuffer()
	local sln, prj = vs10_managedFlag_setOnProject()
	local buffer = get_managed_buffer(sln,prj)
	test.string_does_not_contain(buffer,'<EntryPointSymbol>.*</EntryPointSymbol>')
end