From a50dec8b3c8e446d312ba9ebd347209f4b8d0708 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 16 Apr 2015 12:30:13 +0200 Subject: extract libs and liboptions from pkg-config, prepare for future work (nw) --- scripts/src/osd/modules.lua | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'scripts/src/osd/modules.lua') diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index dd2e9a1cf8d..9bfdfb201c1 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -1,3 +1,29 @@ +function string.starts(String,Start) + return string.sub(String,1,string.len(Start))==Start +end + +function addlibfromstring(str) + if (str==nil) then return end + for w in str:gmatch("%S+") do + if string.starts(w,"-l")==true then + links { + string.sub(w,3) + } + end + end +end + +function addoptionsfromstring(str) + if (str==nil) then return end + for w in str:gmatch("%S+") do + if string.starts(w,"-l")==false then + linkoptions { + w + } + end + end +end + function osdmodulesbuild() removeflags { @@ -191,9 +217,9 @@ function osdmodulestargetconf() if _OPTIONS["NO_USE_MIDI"]~="1" then if _OPTIONS["targetos"]=="linux" then - linkoptions { - backtick("pkg-config --libs alsa"), - } + local str = backtick("pkg-config --libs alsa") + addlibfromstring(str) + addoptionsfromstring(str) elseif _OPTIONS["targetos"]=="macosx" then links { "CoreMIDI.framework", @@ -223,13 +249,15 @@ function osdmodulestargetconf() if _OPTIONS["QT_HOME"]~=nil then linkoptions { "-L" .. backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_INSTALL_LIBS"), - "-lQtGui", - "-lQtCore", } - else - linkoptions { - backtick("pkg-config --libs QtGui"), + links { + "QtGui", + "QtCore", } + else + local str = backtick("pkg-config --libs QtGui") + addlibfromstring(str) + addoptionsfromstring(str) end end end -- cgit v1.2.3-70-g09d2