diff options
| author | 2015-04-16 12:30:13 +0200 | |
|---|---|---|
| committer | 2015-04-16 12:31:53 +0200 | |
| commit | a50dec8b3c8e446d312ba9ebd347209f4b8d0708 (patch) | |
| tree | 7c02340ffc8aa988457d8ad08e76b291006e289b /scripts | |
| parent | 4e22124500bbe4d2c9376e0c7ec164762f0d4b3a (diff) | |
extract libs and liboptions from pkg-config, prepare for future work (nw)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/src/osd/modules.lua | 44 | ||||
| -rw-r--r-- | scripts/src/osd/sdl.lua | 24 |
2 files changed, 48 insertions, 20 deletions
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 diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 8b713bf635a..d5852bcd298 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -37,9 +37,9 @@ function maintargetosdoptions(_target) "SDL_ttf", } end - linkoptions { - backtick("pkg-config --libs fontconfig"), - } + local str = backtick("pkg-config --libs fontconfig") + addlibfromstring(str) + addoptionsfromstring(str) end if _OPTIONS["targetos"]=="windows" then @@ -239,9 +239,9 @@ if BASE_TARGETOS=="unix" then } end else - linkoptions { - backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'"), - } + local str = backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'") + addlibfromstring(str) + addoptionsfromstring(str) end else if _OPTIONS["NO_X11"]=="1" then @@ -259,9 +259,9 @@ if BASE_TARGETOS=="unix" then } end end - linkoptions { - backtick(sdlconfigcmd() .. " --libs"), - } + local str = backtick(sdlconfigcmd() .. " --libs") + addlibfromstring(str) + addoptionsfromstring(str) if _OPTIONS["targetos"]~="haiku" then links { "m", @@ -280,9 +280,9 @@ if BASE_TARGETOS=="unix" then end end elseif BASE_TARGETOS=="os2" then - linkoptions { - backtick(sdlconfigcmd() .. " --libs"), - } + local str = backtick(sdlconfigcmd() .. " --libs") + addlibfromstring(str) + addoptionsfromstring(str) links { "pthread" } |
