File: test_gcc.lua

package info (click to toggle)
premake4 4.3%2Brepack1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,852 kB
  • sloc: ansic: 636; makefile: 57; sh: 2
file content (60 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download | duplicates (9)
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
--
-- tests/test_gcc.lua
-- Automated test suite for the GCC toolset interface.
-- Copyright (c) 2009 Jason Perkins and the Premake project
--

	T.gcc = { }
	local suite = T.gcc

	local cfg
	function suite.setup()
		cfg = { }
		cfg.basedir    = "."
		cfg.location   = "."
		cfg.language   = "C++"
		cfg.project    = { name = "MyProject" }
		cfg.flags      = { }
		cfg.objectsdir = "obj"
		cfg.platform   = "Native"
		cfg.links      = { }
		cfg.libdirs    = { }
		cfg.linktarget = { fullpath="libMyProject.a" }
	end


	function suite.cflags_SharedLib_Windows()
		cfg.kind = "SharedLib"
		cfg.system = "windows"
		local r = premake.gcc.getcflags(cfg)
		test.isequal('', table.concat(r,"|"))
	end


	function suite.ldflags_SharedLib_Windows()
		cfg.kind = "SharedLib"
		cfg.system = "windows"
		local r = premake.gcc.getldflags(cfg)
		test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
	end


	function suite.cflags_OnFpFast()
		cfg.flags = { "FloatFast" }
		local r = premake.gcc.getcflags(cfg)
		test.isequal('-ffast-math', table.concat(r,"|"))
	end


	function suite.cflags_OnFpStrict()
		cfg.flags = { "FloatStrict" }
		local r = premake.gcc.getcflags(cfg)
		test.isequal('-ffloat-store', table.concat(r,"|"))
	end


	function suite.linkflags_OnFrameworks()
		cfg.links = { "Cocoa.framework" }
		local r = premake.gcc.getlinkflags(cfg)
		test.isequal('-framework Cocoa', table.concat(r,"|"))
	end