Better support for cross-compiling by using pkg-config (instead of sdl-config and freetype-config) and trying both static linux libs

This commit is contained in:
def 2015-09-03 06:28:11 +02:00
parent f20a6a4934
commit fca4c112d4
8 changed files with 27 additions and 35 deletions

View file

@ -179,9 +179,6 @@ function build(settings)
--settings.objdir = Path("objs")
settings.cc.Output = Intermediate_Output
--settings.cc.flags:Add("-m32")
--settings.link.flags:Add("-m32")
cflags = os.getenv("CFLAGS")
if cflags then
settings.cc.flags:Add(cflags)

View file

@ -59,10 +59,9 @@ Curl = {
settings.link.libpath:Add("other/curl/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
settings.link.libpath:Add("other/curl/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
settings.link.libpath:Add("other/curl/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
settings.link.libpath:Add("other/curl/linux/lib64")
settings.link.libpath:Add("other/curl/linux/lib32")
end
end
end

View file

@ -4,13 +4,13 @@ FreeType = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.use_ftconfig = false
option.use_pkgconfig = false
option.use_winlib = 0
option.lib_path = nil
if ExecuteSilent("freetype-config") > 0 and ExecuteSilent("freetype-config --cflags") == 0 then
if ExecuteSilent("pkg-config freetype2") == 0 then
option.value = true
option.use_ftconfig = true
option.use_pkgconfig = true
end
if platform == "win32" then
@ -26,9 +26,9 @@ FreeType = {
-- include path
settings.cc.includes:Add(FreeType.basepath .. "/include")
if option.use_ftconfig == true then
settings.cc.flags:Add("`freetype-config --cflags`")
settings.link.flags:Add("`freetype-config --libs`")
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config freetype2 --cflags`")
settings.link.flags:Add("`pkg-config freetype2 --libs`")
elseif option.use_winlib > 0 then
if option.use_winlib == 32 then
@ -42,13 +42,13 @@ FreeType = {
local save = function(option, output)
output:option(option, "value")
output:option(option, "use_ftconfig")
output:option(option, "use_pkgconfig")
output:option(option, "use_winlib")
end
local display = function(option)
if option.value == true then
if option.use_ftconfig == true then return "using freetype-config" end
if option.use_pkgconfig == true then return "using pkg-config" end
if option.use_winlib == 32 then return "using supplied win32 libraries" end
if option.use_winlib == 64 then return "using supplied win64 libraries" end
return "using unknown method"

View file

@ -57,10 +57,9 @@ Mysql = {
settings.link.libpath:Add("other/mysql/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
settings.link.libpath:Add("other/mysql/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
settings.link.libpath:Add("other/mysql/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
settings.link.libpath:Add("other/mysql/linux/lib64")
settings.link.libpath:Add("other/mysql/linux/lib32")
end
end
end

View file

@ -58,10 +58,9 @@ Ogg = {
client_settings.link.libpath:Add("other/opus/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
client_settings.link.libpath:Add("other/opus/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
client_settings.link.libpath:Add("other/opus/linux/lib64")
client_settings.link.libpath:Add("other/opus/linux/lib32")
end
end
end

View file

@ -58,10 +58,9 @@ Opus = {
client_settings.link.libpath:Add("other/opus/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
client_settings.link.libpath:Add("other/opus/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
client_settings.link.libpath:Add("other/opus/linux/lib64")
client_settings.link.libpath:Add("other/opus/linux/lib32")
end
end
end

View file

@ -58,10 +58,9 @@ Opusfile = {
client_settings.link.libpath:Add("other/opus/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
client_settings.link.libpath:Add("other/opus/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
client_settings.link.libpath:Add("other/opus/linux/lib64")
client_settings.link.libpath:Add("other/opus/linux/lib32")
end
end
end

View file

@ -4,14 +4,14 @@ SDL = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.use_sdlconfig = false
option.use_pkgconfig = false
option.use_winlib = 0
option.use_osxframework = false
option.lib_path = nil
if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then
if ExecuteSilent("pkg-config sdl") == 0 then
option.value = true
option.use_sdlconfig = true
option.use_pkgconfig = true
end
if platform == "win32" then
@ -25,14 +25,14 @@ SDL = {
if platform == "macosx" then
option.value = true
option.use_osxframework = true
option.use_sdlconfig = false
option.use_pkgconfig = false
end
end
local apply = function(option, settings)
if option.use_sdlconfig == true then
settings.cc.flags:Add("`sdl-config --cflags`")
settings.link.flags:Add("`sdl-config --libs`")
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config sdl --cflags`")
settings.link.flags:Add("`pkg-config sdl --libs`")
end
if option.use_osxframework == true then
@ -54,14 +54,14 @@ SDL = {
local save = function(option, output)
output:option(option, "value")
output:option(option, "use_sdlconfig")
output:option(option, "use_pkgconfig")
output:option(option, "use_winlib")
output:option(option, "use_osxframework")
end
local display = function(option)
if option.value == true then
if option.use_sdlconfig == true then return "using sdl-config" end
if option.use_pkgconfig == true then return "using pkg-config" end
if option.use_winlib == 32 then return "using supplied win32 libraries" end
if option.use_winlib == 64 then return "using supplied win64 libraries" end
if option.use_osxframework == true then return "using osx framework" end