11CheckVersion (" 0.4" )
22
3+ target_family = os.getenv (" TARGET_FAMILY" )
4+ if target_family then
5+ family = target_family
6+ end
7+ target_platform = os.getenv (" TARGET_PLATFORM" )
8+ if target_platform then
9+ platform = target_platform
10+ end
11+ target_arch = os.getenv (" TARGET_ARCH" )
12+ if target_arch then
13+ arch = target_arch
14+ end
15+
316Import (" configure.lua" )
417Import (" other/sdl/sdl.lua" )
518Import (" other/freetype/freetype.lua" )
@@ -28,7 +41,7 @@ config:Finalize("config.lua")
2841
2942-- data compiler
3043function Script (name )
31- if family == " windows" then
44+ if family == " windows" and target_family ~= " windows " then
3245 return str_replace (name , " /" , " \\ " )
3346 end
3447 return " python " .. name
@@ -67,14 +80,20 @@ DuplicateDirectoryStructure("src", "src", "objs")
6780]]
6881
6982function ResCompile (scriptfile )
83+ windres = os.getenv (" WINDRES" )
84+ if not windres then
85+ windres = " windres"
86+ end
87+
7088 scriptfile = Path (scriptfile )
7189 if config .compiler .driver == " cl" then
7290 output = PathBase (scriptfile ) .. " .res"
7391 AddJob (output , " rc " .. scriptfile , " rc /fo " .. output .. " " .. scriptfile )
7492 elseif config .compiler .driver == " gcc" then
7593 output = PathBase (scriptfile ) .. " .coff"
76- AddJob (output , " windres " .. scriptfile , " windres -i " .. scriptfile .. " -o " .. output )
94+ AddJob (output , windres .. " " .. scriptfile , windres .. " -i " .. scriptfile .. " -o " .. output )
7795 end
96+
7897 AddDependency (output , scriptfile )
7998 return output
8099end
@@ -128,36 +147,36 @@ server_sql_depends = {}
128147
129148if family == " windows" then
130149 if platform == " win32" then
131- table.insert (client_depends , CopyToDirectory (" ." , " other\\ freetype\\ lib32\\ freetype.dll" ))
132- table.insert (client_depends , CopyToDirectory (" ." , " other\\ sdl\\ lib32\\ SDL.dll" ))
133-
134- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib32\\ libcurl.dll" ))
135- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib32\\ libeay32.dll" ))
136- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib32\\ libidn-11.dll" ))
137- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib32\\ ssleay32.dll" ))
138- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib32\\ zlib1.dll" ))
139-
140- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib32\\ libgcc_s_sjlj-1.dll" ))
141- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib32\\ libogg-0.dll" ))
142- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib32\\ libopus-0.dll" ))
143- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib32\\ libopusfile-0.dll" ))
150+ table.insert (client_depends , CopyToDirectory (" ." , " other/ freetype/ lib32/ freetype.dll" ))
151+ table.insert (client_depends , CopyToDirectory (" ." , " other/ sdl/ lib32/ SDL.dll" ))
152+
153+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib32/ libcurl.dll" ))
154+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib32/ libeay32.dll" ))
155+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib32/ libidn-11.dll" ))
156+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib32/ ssleay32.dll" ))
157+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib32/ zlib1.dll" ))
158+
159+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib32/ libgcc_s_sjlj-1.dll" ))
160+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib32/ libogg-0.dll" ))
161+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib32/ libopus-0.dll" ))
162+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib32/ libopusfile-0.dll" ))
144163 else
145- table.insert (client_depends , CopyToDirectory (" ." , " other\\ freetype\\ lib64\\ freetype.dll" ))
146- table.insert (client_depends , CopyToDirectory (" ." , " other\\ sdl\\ lib64\\ SDL.dll" ))
147-
148- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib64\\ libcurl.dll" ))
149- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib64\\ libeay32.dll" ))
150- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib64\\ ssleay32.dll" ))
151- table.insert (client_depends , CopyToDirectory (" ." , " other\\ curl\\ windows\\ lib64\\ zlib1.dll" ))
152-
153- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib64\\ libwinpthread-1.dll" ))
154- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib64\\ libgcc_s_seh-1.dll" ))
155- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib64\\ libogg-0.dll" ))
156- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib64\\ libopus-0.dll" ))
157- table.insert (client_depends , CopyToDirectory (" ." , " other\\ opus\\ windows\\ lib64\\ libopusfile-0.dll" ))
164+ table.insert (client_depends , CopyToDirectory (" ." , " other/ freetype/ lib64/ freetype.dll" ))
165+ table.insert (client_depends , CopyToDirectory (" ." , " other/ sdl/ lib64/ SDL.dll" ))
166+
167+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib64/ libcurl.dll" ))
168+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib64/ libeay32.dll" ))
169+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib64/ ssleay32.dll" ))
170+ table.insert (client_depends , CopyToDirectory (" ." , " other/ curl/ windows/ lib64/ zlib1.dll" ))
171+
172+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib64/ libwinpthread-1.dll" ))
173+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib64/ libgcc_s_seh-1.dll" ))
174+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib64/ libogg-0.dll" ))
175+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib64/ libopus-0.dll" ))
176+ table.insert (client_depends , CopyToDirectory (" ." , " other/ opus/ windows/ lib64/ libopusfile-0.dll" ))
158177 end
159- table.insert (server_sql_depends , CopyToDirectory (" ." , " other\\ mysql\\ vc2005libs\\ mysqlcppconn.dll" ))
160- table.insert (server_sql_depends , CopyToDirectory (" ." , " other\\ mysql\\ vc2005libs\\ libmysql.dll" ))
178+ table.insert (server_sql_depends , CopyToDirectory (" ." , " other/ mysql/ vc2005libs/ mysqlcppconn.dll" ))
179+ table.insert (server_sql_depends , CopyToDirectory (" ." , " other/ mysql/ vc2005libs/ libmysql.dll" ))
161180
162181 if config .compiler .driver == " cl" then
163182 client_link_other = {ResCompile (" other/icons/teeworlds_cl.rc" )}
@@ -179,6 +198,16 @@ function build(settings)
179198 -- settings.objdir = Path("objs")
180199 settings .cc .Output = Intermediate_Output
181200
201+ cc = os.getenv (" CC" )
202+ if cc then
203+ settings .cc .exe_c = cc
204+ end
205+ cxx = os.getenv (" CXX" )
206+ if cxx then
207+ settings .cc .exe_cxx = cxx
208+ settings .link .exe = cxx
209+ settings .dll .exe = cxx
210+ end
182211 cflags = os.getenv (" CFLAGS" )
183212 if cflags then
184213 settings .cc .flags :Add (cflags )
0 commit comments