forked from HeliumProject/Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TBB.lua
189 lines (157 loc) · 9.58 KB
/
TBB.lua
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
require "Helium"
--[[
NOTE:
We set cwd to be the location of make because gmake on windows (or mingw) will auto-complete the path to make to a full path
if this full path has spaces then tbb's make logic will fail. -C will cwd to the tbb root before it starts processing
This is mainly to support building from user folders in XP -Geoff
--]]
function FlipSlashes( cmd )
return string.gsub(cmd, "/", "\\")
end
function CallMake( arch, cmd )
local path = os.getenv("TMP") .. os.tmpname() .. ".bat";
print( "Creating temp bat file for make.exe: " .. path )
local bat = io.open( path, "w+")
bat.write( bat, "@call \"%VCINSTALLDIR%\"\\vcvarsall.bat " .. arch .. "\n" )
bat.write( bat, "@" .. FlipSlashes( os.getcwd() ) .. "\\..\\..\\Utilities\\Win32\\make.exe " .. cmd .. "\n" )
io.close( bat )
local result = os.execute( "cmd.exe /c \"call \"" .. path .. "\"" )
--os.execute( "cmd.exe /c \"del " .. path .. "\"" )
return result
end
Helium.BuildTBB = function()
local cwd = os.getcwd()
if os.get() == "windows" then
if not os.getenv("VCINSTALLDIR") then
print("VCINSTALLDIR is not detected in your environment")
os.exit(1)
end
os.chdir( "Dependencies/tbb" )
local result
if Helium.Build32Bit() then
result = CallMake( "x86", "tbb arch=ia32" )
if result ~= 0 then os.exit( 1 ) end
end
if Helium.Build64Bit() then
result = CallMake( "x86_amd64", "tbb arch=intel64" )
if result ~= 0 then os.exit( 1 ) end
end
elseif os.get() == "macosx" then
os.chdir( "Dependencies/tbb" )
local result
if Helium.Build32Bit() then
result = os.execute( "make tbb arch=ia32" )
if result ~= 0 then os.exit( 1 ) end
end
if Helium.Build64Bit() then
result = os.execute( "make tbb arch=intel64" )
if result ~= 0 then os.exit( 1 ) end
end
else
print("Implement support for " .. os.get() .. " to BuildTBB()")
os.exit(1)
end
os.chdir( cwd )
end
Helium.CleanTBB = function()
local cwd = os.getcwd()
local files = {}
if os.get() == "windows" then
if not os.getenv("VCINSTALLDIR") then
print("VCINSTALLDIR is not detected in your environment")
os.exit(1)
end
os.chdir( "Dependencies/tbb" )
local result
if Helium.Build32Bit() then
result = CallMake( "x86", "clean arch=ia32" )
if result ~= 0 then os.exit( 1 ) end
end
if Helium.Build64Bit() then
result = CallMake( "x86_amd64", "clean arch=intel64" )
if result ~= 0 then os.exit( 1 ) end
end
elseif os.get() == "macosx" then
os.chdir( "Dependencies/tbb" )
if Helium.Build32Bit() then
local result
result = os.execute( "make clean arch=ia32" )
if result ~= 0 then os.exit( 1 ) end
end
if Helium.Build64Bit() then
result = os.execute( "make clean arch=intel64" )
if result ~= 0 then os.exit( 1 ) end
end
else
print("Implement support for " .. os.get() .. " to CleanTBB()")
os.exit(1)
end
os.chdir( cwd )
end
Helium.PublishTBB = function( bin )
local files = {}
if os.get() == "windows" then
if _ACTION == "vs2008" then
if Helium.Build32Bit() then
table.insert( files, { file="tbb_debug.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc9_debug", target=bin .. "/x32/Debug" } )
table.insert( files, { file="tbb_debug.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc9_debug", target=bin .. "/x32/Debug" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Intermediate" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Intermediate" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Profile" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Profile" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Release" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc9_release", target=bin .. "/x32/Release" } )
end
if Helium.Build64Bit() then
table.insert( files, { file="tbb_debug.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc9_debug", target=bin .. "/x64/Debug" } )
table.insert( files, { file="tbb_debug.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc9_debug", target=bin .. "/x64/Debug" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Intermediate" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Intermediate" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Profile" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Profile" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Release" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc9_release", target=bin .. "/x64/Release" } )
end
elseif _ACTION == "vs2010" then
if Helium.Build32Bit() then
table.insert( files, { file="tbb_debug.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc10_debug", target=bin .. "/x32/Debug" } )
table.insert( files, { file="tbb_debug.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc10_debug", target=bin .. "/x32/Debug" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Intermediate" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Intermediate" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Profile" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Profile" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Release" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_ia32_cl_vc10_release", target=bin .. "/x32/Release" } )
end
if Helium.Build64Bit() then
table.insert( files, { file="tbb_debug.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc10_debug", target=bin .. "/x64/Debug" } )
table.insert( files, { file="tbb_debug.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc10_debug", target=bin .. "/x64/Debug" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Intermediate" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Intermediate" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Profile" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Profile" } )
table.insert( files, { file="tbb.dll", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Release" } )
table.insert( files, { file="tbb.pdb", source="Dependencies/tbb/build/windows_intel64_cl_vc10_release", target=bin .. "/x64/Release" } )
end
end
elseif os.get() == "macosx" then
local ver = os.getversion()
local str = string.format("%d.%d.%d", ver.majorversion, ver.minorversion, ver.revision)
if Helium.Build32Bit() then
table.insert( files, { file="libtbb_debug.dylib", source="Dependencies/tbb/build/macos_ia32_gcc_cc4.2.1_os" .. str .. "_debug", target=bin .. "/x32/Debug" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_ia32_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x32/Intermediate" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_ia32_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x32/Profile" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_ia32_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x32/Release" } )
end
if Helium.Build64Bit() then
table.insert( files, { file="libtbb_debug.dylib", source="Dependencies/tbb/build/macos_intel64_gcc_cc4.2.1_os" .. str .. "_debug", target=bin .. "/x64/Debug" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_intel64_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x64/Intermediate" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_intel64_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x64/Profile" } )
table.insert( files, { file="libtbb.dylib", source="Dependencies/tbb/build/macos_intel64_gcc_cc4.2.1_os" .. str .. "_release", target=bin .. "/x64/Release" } )
end
else
print("Implement support for " .. os.get() .. " to CleanWxWidgets()")
os.exit(1)
end
Helium.Publish( files )
end