blob: 7a346e6e6b5df4c18984c5f503f67e68379926be (
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
|
T.gcc_linking = { }
local suite = T.gcc_linking
local staticPrj
local linksToStaticProj
local sln
function suite.setup()
_ACTION = "gmake"
sln = solution "MySolution"
configurations { "Debug" }
platforms {}
staticPrj = project "staticPrj"
targetdir 'bar'
language 'C++'
kind "StaticLib"
linksToStaticProj = project "linksToStaticProj"
language 'C++'
kind 'ConsoleApp'
links{'staticPrj'}
end
function suite.teardown()
staticPrj = nil
linksToStaticProj = nil
sln = nil
end
local get_buffer = function(projectName)
io.capture()
premake.bake.buildconfigs()
local cfg = premake.getconfig(projectName, 'Debug', 'Native')
premake.gmake_cpp_config(cfg, premake.gcc)
local buffer = io.endcapture()
return buffer
end
function suite.projectLinksToStaticPremakeMadeLibrary_linksUsingTheFormat_pathNameExtension()
local buffer = get_buffer(linksToStaticProj)
local format_exspected = 'LIBS %+%= bar/libstaticPrj.a'
test.string_contains(buffer,format_exspected)
end
T.link_suite= { }
local firstProject = nil
local linksToFirstProject = nil
function T.link_suite.setup()
_ACTION = "gmake"
solution('dontCareSolution')
configurations{'Debug'}
end
function T.link_suite.teardown()
_ACTION = nil
firstProject = nil
linksToFirstProject = nil
end
function T.link_suite.projectLinksToSharedPremakeMadeLibrary_linksUsingFormat_dashLName()
firstProject = project 'firstProject'
kind 'SharedLib'
language 'C'
linksToFirstProject = project 'linksToFirstProject'
kind 'ConsoleApp'
language 'C'
links{'firstProject'}
local buffer = get_buffer(linksToFirstProject)
local format_exspected = 'LIBS %+%= %-lfirstProject'
test.string_contains(buffer,format_exspected)
end
function T.link_suite.projectLinksToPremakeMadeConsoleApp_doesNotLinkToConsoleApp()
firstProject = project 'firstProject'
kind 'ConsoleApp'
language 'C'
linksToFirstProject = project 'linksToFirstProject'
kind 'ConsoleApp'
language 'C'
links{'firstProject'}
local buffer = get_buffer(linksToFirstProject)
local format_exspected = 'LIBS %+%=%s+\n'
test.string_contains(buffer,format_exspected)
end
function T.link_suite.projectLinksToStaticPremakeMadeLibrary_projectDifferInDirectoryHeights_linksUsingCorrectRelativePath()
firstProject = project 'firstProject'
kind 'StaticLib'
language 'C'
linksToFirstProject = project 'linksToFirstProject'
kind 'ConsoleApp'
language 'C'
links{'firstProject'}
location './foo/bar'
local buffer = get_buffer(linksToFirstProject)
local format_exspected = 'LIBS %+%= ../../libfirstProject.a'
test.string_contains(buffer,format_exspected)
end
|