mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-12 15:56:06 +00:00
7d1f56e617
Make pyrogenesis and tests depend on Collada, fixes #404. This commit includes custom modules for CxxTest and pkg-config support that can be improved upon in the future. It also includes all necessary changes to the build scripts, but the new premake5 features are not fully exploited yet. With this change, premake5 becomes the default, but CI scripts on Unix will continue using premake4 for a while, in order to avoid regressions. Includes code by zsol. Reviewed by: wraitii, leper Differential Revision: https://code.wildfiregames.com/D72 This was SVN commit r20381.
62 lines
1.3 KiB
Lua
62 lines
1.3 KiB
Lua
local m = {}
|
|
m._VERSION = "1.0.0-dev"
|
|
|
|
local function os_capture(cmd)
|
|
return io.popen(cmd, 'r'):read('*a'):gsub("\n", " ")
|
|
end
|
|
|
|
function m.add_includes(lib, alternative_cmd)
|
|
local result
|
|
if not alternative_cmd then
|
|
result = os_capture("pkg-config --cflags "..lib)
|
|
else
|
|
result = os_capture(alternative_cmd)
|
|
end
|
|
|
|
local dirs = {}
|
|
local options = {}
|
|
for w in string.gmatch(result, "[^' ']+") do
|
|
if string.sub(w,1,2) == "-I" then
|
|
table.insert(dirs, string.sub(w,3))
|
|
else
|
|
table.insert(options, w)
|
|
end
|
|
end
|
|
|
|
sysincludedirs(dirs)
|
|
buildoptions(options)
|
|
end
|
|
|
|
function m.add_links(lib, alternative_cmd)
|
|
local result
|
|
if not alternative_cmd then
|
|
result = os_capture("pkg-config --libs "..lib)
|
|
else
|
|
result = os_capture(alternative_cmd)
|
|
end
|
|
|
|
-- On OSX, wx-config outputs "-framework foo" instead of "-Wl,-framework,foo"
|
|
-- which doesn't fare well with the splitting into libs, libdirs and options
|
|
-- we perform afterwards.
|
|
result = result:gsub("%-framework +(%g+)", "-Wl,-framework,%1")
|
|
|
|
local libs = {}
|
|
local dirs = {}
|
|
local options = {}
|
|
for w in string.gmatch(result, "[^' ']+") do
|
|
if string.sub(w,1,2) == "-l" then
|
|
table.insert(libs, string.sub(w,3))
|
|
elseif string.sub(w,1,2) == "-L" then
|
|
table.insert(dirs, string.sub(w,3))
|
|
else
|
|
table.insert(options, w)
|
|
end
|
|
end
|
|
|
|
links(libs)
|
|
libdirs(dirs)
|
|
linkoptions(options)
|
|
end
|
|
|
|
return m
|