Previous 199869 Revisions Next

r37200 Thursday 16th April, 2015 at 10:31:53 UTC by Miodrag Milanović
extract libs and liboptions from pkg-config, prepare for future work (nw)
[scripts/src/osd]modules.lua sdl.lua

trunk/scripts/src/osd/modules.lua
r245711r245712
1function string.starts(String,Start)
2   return string.sub(String,1,string.len(Start))==Start
3end
4
5function addlibfromstring(str)
6   if (str==nil) then return  end
7   for w in str:gmatch("%S+") do
8      if string.starts(w,"-l")==true then
9         links {
10            string.sub(w,3)
11         }
12      end
13   end
14end
15
16function addoptionsfromstring(str)
17   if (str==nil) then return  end
18   for w in str:gmatch("%S+") do
19      if string.starts(w,"-l")==false then
20         linkoptions {
21            w
22         }
23      end
24   end
25end
26
127function osdmodulesbuild()
228
329   removeflags {
r245711r245712
191217
192218   if _OPTIONS["NO_USE_MIDI"]~="1" then
193219      if _OPTIONS["targetos"]=="linux" then
194         linkoptions {
195            backtick("pkg-config --libs alsa"),
196         }
220         local str = backtick("pkg-config --libs alsa")
221         addlibfromstring(str)
222         addoptionsfromstring(str)
197223      elseif _OPTIONS["targetos"]=="macosx" then
198224         links {
199225            "CoreMIDI.framework",
r245711r245712
223249         if _OPTIONS["QT_HOME"]~=nil then
224250            linkoptions {
225251               "-L" .. backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_INSTALL_LIBS"),
226               "-lQtGui",
227               "-lQtCore",
228252            }
253            links {
254               "QtGui",
255               "QtCore",
256            }
229257         else
230            linkoptions {
231               backtick("pkg-config --libs QtGui"),
232            }
258            local str = backtick("pkg-config --libs QtGui")
259            addlibfromstring(str)
260            addoptionsfromstring(str)
233261         end
234262      end
235263   end
trunk/scripts/src/osd/sdl.lua
r245711r245712
3737            "SDL_ttf",
3838         }
3939      end
40      linkoptions {
41         backtick("pkg-config --libs fontconfig"),
42      }
40      local str = backtick("pkg-config --libs fontconfig")
41      addlibfromstring(str)
42      addoptionsfromstring(str)
4343   end
4444
4545   if _OPTIONS["targetos"]=="windows" then
r245711r245712
239239            }
240240         end
241241      else
242         linkoptions {
243            backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'"),
244         }
242         local str = backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'")
243         addlibfromstring(str)
244         addoptionsfromstring(str)
245245      end
246246   else
247247      if _OPTIONS["NO_X11"]=="1" then
r245711r245712
259259            }
260260         end
261261      end
262      linkoptions {
263         backtick(sdlconfigcmd() .. " --libs"),
264      }
262      local str = backtick(sdlconfigcmd() .. " --libs")
263      addlibfromstring(str)
264      addoptionsfromstring(str)
265265      if _OPTIONS["targetos"]~="haiku" then
266266         links {
267267            "m",
r245711r245712
280280      end
281281   end
282282elseif BASE_TARGETOS=="os2" then
283   linkoptions {
284      backtick(sdlconfigcmd() .. " --libs"),
285   }
283   local str = backtick(sdlconfigcmd() .. " --libs")
284   addlibfromstring(str)
285   addoptionsfromstring(str)
286286   links {
287287      "pthread"
288288   }


Previous 199869 Revisions Next


© 1997-2024 The MAME Team