From f6fbdaa2e86de0e96f079b22aeebb26e5eef2c56 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 13 Apr 2015 18:47:33 +0200 Subject: [PATCH] Added QT_HOME to support custom QT installations (nw) --- makefile | 6 ++++ scripts/src/osd/modules.lua | 55 +++++++++++++++++++++++++++---------- scripts/src/osd/sdl_cfg.lua | 12 ++++++-- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/makefile b/makefile index 609f0a3907c..e0d3f3064cf 100644 --- a/makefile +++ b/makefile @@ -78,6 +78,8 @@ # PYTHON_EXECUTABLE = python3 # SHADOW_CHECK = 1 +# QT_HOME = /usr/lib64/qt48/ + -include useroptions.mak ########################################################################### @@ -525,6 +527,10 @@ ifdef SHADOW_CHECK PARAMS += --SHADOW_CHECK='$(SHADOW_CHECK)' endif +ifdef QT_HOME +PARAMS += --QT_HOME='$(QT_HOME)' +endif + #------------------------------------------------- # All scripts #------------------------------------------------- diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index 0617939154e..3fe914f3444 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -105,15 +105,24 @@ function osdmodulesbuild() if (os.is("windows")) then MOC = "moc" else - MOCTST = backtick("which moc-qt4 2>/dev/null") - if (MOCTST=='') then - MOCTST = backtick("which moc 2>/dev/null") + if _OPTIONS["QT_HOME"]~=nil then + QMAKETST = backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake --version 2>/dev/null") + if (QMAKETST=='') then + print("Qt's Meta Object Compiler (moc) wasn't found!") + os.exit(1) + end + MOC = _OPTIONS["QT_HOME"] .. "/bin/moc" + else + MOCTST = backtick("which moc-qt4 2>/dev/null") + if (MOCTST=='') then + MOCTST = backtick("which moc 2>/dev/null") + end + if (MOCTST=='') then + print("Qt's Meta Object Compiler (moc) wasn't found!") + os.exit(1) + end + MOC = MOCTST end - if (MOCTST=='') then - print("Qt's Meta Object Compiler (moc) wasn't found!") - os.exit(1) - end - MOC = MOCTST end @@ -141,9 +150,15 @@ function osdmodulesbuild() "-F" .. backtick("qmake -query QT_INSTALL_LIBS"), } else - buildoptions { - backtick("pkg-config --cflags QtGui"), - } + if _OPTIONS["QT_HOME"]~=nil then + buildoptions { + "-I" .. backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_INSTALL_HEADERS"), + } + else + buildoptions { + backtick("pkg-config --cflags QtGui"), + } + end end else defines { @@ -205,9 +220,15 @@ function osdmodulestargetconf() "QtGui.framework", } else - linkoptions { - backtick("pkg-config --libs QtGui"), - } + if _OPTIONS["QT_HOME"]~=nil then + buildoptions { + "-I" .. backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_INSTALL_LIBS"), + } + else + linkoptions { + backtick("pkg-config --libs QtGui"), + } + end end end @@ -294,6 +315,12 @@ newoption { }, } +newoption { + trigger = "QT_HOME", + description = "QT lib location", +} + + if not _OPTIONS["USE_QTDEBUG"] then if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="solaris" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"] == "emscripten" or _OPTIONS["targetos"] == "os2" then _OPTIONS["USE_QTDEBUG"] = "0" diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 6114cc4727f..d891ef9da04 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -117,9 +117,15 @@ if _OPTIONS["targetos"]=="windows" then configuration { } elseif _OPTIONS["targetos"]=="linux" then - buildoptions { - '$(shell pkg-config --cflags QtGui)', - } + if _OPTIONS["QT_HOME"]~=nil then + buildoptions { + "-I" .. backtick(_OPTIONS["QT_HOME"] .. "/bin/qmake -query QT_INSTALL_HEADERS"), + } + else + buildoptions { + backtick("pkg-config --cflags QtGui"), + } + end elseif _OPTIONS["targetos"]=="macosx" then defines { "SDLMAME_MACOSX",