summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheinrich5991 <heinrich5991@gmail.com>2018-09-12 22:15:07 +0200
committerheinrich5991 <heinrich5991@gmail.com>2018-10-12 22:09:04 +0200
commiteb1c2a8d91e1dfdbe9871b546ac2bc831d5db71f (patch)
treef983074691849cacdd91f36dd2769a68fcd41cf8
parentb519c3ce07e2d4bb3443628b5bdffb71cde43931 (diff)
Try `pkg-config` to find external libs, too
Sometimes `sdl-config` and `freetype-config` might not exist despite the libs being installed.
-rw-r--r--other/freetype/freetype.lua9
-rw-r--r--other/sdl/sdl.lua10
2 files changed, 19 insertions, 0 deletions
diff --git a/other/freetype/freetype.lua b/other/freetype/freetype.lua
index aa5af22dd..9d484afbd 100644
--- a/other/freetype/freetype.lua
+++ b/other/freetype/freetype.lua
@@ -5,12 +5,16 @@ FreeType = {
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
option.value = true
option.use_ftconfig = true
+ elseif ExecuteSilent("pkg-config") > 0 and ExecuteSilent("pkg-config freetype2") == 0 then
+ option.value = true
+ option.use_pkgconfig = true
end
if platform == "win32" then
@@ -29,6 +33,9 @@ FreeType = {
if option.use_ftconfig == true then
settings.cc.flags:Add("`freetype-config --cflags`")
settings.link.flags:Add("`freetype-config --libs`")
+ elseif 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
@@ -43,12 +50,14 @@ 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"
diff --git a/other/sdl/sdl.lua b/other/sdl/sdl.lua
index 141832056..9bf75ea81 100644
--- a/other/sdl/sdl.lua
+++ b/other/sdl/sdl.lua
@@ -4,6 +4,7 @@ SDL = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
+ option.use_pkgconfig = false
option.use_sdlconfig = false
option.use_winlib = 0
option.use_osxframework = false
@@ -12,6 +13,9 @@ SDL = {
if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then
option.value = true
option.use_sdlconfig = true
+ elseif ExecuteSilent("pkg-config") > 0 and ExecuteSilent("pkg-config sdl") == 0 then
+ option.value = true
+ option.use_pkgconfig = true
end
if platform == "win32" then
@@ -25,6 +29,7 @@ SDL = {
if platform == "macosx" then
option.value = true
option.use_osxframework = true
+ option.use_pkgconfig = false
option.use_sdlconfig = false
end
end
@@ -33,6 +38,9 @@ SDL = {
if option.use_sdlconfig == true then
settings.cc.flags:Add("`sdl-config --cflags`")
settings.link.flags:Add("`sdl-config --libs`")
+ elseif 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,6 +62,7 @@ SDL = {
local save = function(option, output)
output:option(option, "value")
+ output:option(option, "use_pkgconfig")
output:option(option, "use_sdlconfig")
output:option(option, "use_winlib")
output:option(option, "use_osxframework")
@@ -62,6 +71,7 @@ SDL = {
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