Skip to content

Instantly share code, notes, and snippets.

@annulen
Created November 9, 2011 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annulen/1350926 to your computer and use it in GitHub Desktop.
Save annulen/1350926 to your computer and use it in GitHub Desktop.
Imaginary Premake extension which adds Qt support using non-yet-existing features
usage "Qt"
variables { "qtdir", "qtbin", "qtlib", "qtinclude", "mocdir", "mocflags", "uidir", "rccdir", "qmdir" }
compiler {
name = "moc",
typematcher = premake.qt.ismocableheader, -- function defined in qt-support.lua
outfilebuilder = function(infile)
return "%mocdir/moc_" .. path.getbasename(infile) .. ".cpp"
end,
buildcommands = { "%qtbin/moc %mocflags -nw -o %outfile %infile" }
}
compiler {
name = "moc-i",
typematcher = premake.qt.ismocablecppfile, -- function defined in qt-support.lua
outfilebuilder = function(infile)
return "%mocdir/" .. path.getbasename(infile) .. ".moc"
end,
buildcommands = { "%qtbin/moc %mocflags -i -o %outfile %infile" }
}
compiler {
name = "uic",
typematcher = premake.qt.typematcher(".ui"), -- function defined in qt-support.lua
outfilebuilder = function(infile)
return "%uidir/ui_" .. path.getbasename(infile) .. ".h"
end,
buildcommands = { "%qtbin/uic %infile -o %outfile" },
dependbuilder = -- to be written
}
compiler {
name = "rcc",
typematcher = premake.qt.typematcher(".qrc"), -- function defined in qt-support.lua
outfilebuilder = function(infile)
return "%rccdir/qrc_" .. path.getbasename(infile) .. ".cpp"
end,
buildcommands = { "%qtbin/rcc -name " .. path.getbasename(infile) .. " %infile -o %outfile" },
dependbuilder = premake.qt.qrc_depends -- function defined in qt-support.lua
}
-- lrelease skipped
--
-- Default values of variables
--
--Don't know what should be good syntax for this...
qtdir
-- "$(QTDIR)" -- if set
-- "$(shell qmake-qt4 -query QT_INSTALL_PREFIX)" -- if qmake-qt4 is found in path (damned Debian and its family!)
-- "$(shell qmake -query QT_INSTALL_PREFIX)" -- if qmake is found in path
-- otherwise undefined
qtbin
-- "$(QTDIR)/bin" -- if QTDIR is defined
-- "$(shell qmake-qt4 -query QT_INSTALL_BINS)" -- if qmake-qt4 is found in path
-- "$(shell qmake -query QT_INSTALL_BINS)" -- if qmake is found in path
-- otherwise undefined
-- similarly for qtlib and qtinclude
mocdir "%objdir"
uidir "%objdir"
rccdir "%objdir"
mocflags "%INCLUDES %DEFINES"
configuration "macosx"
mocflags "%INCLUDES %DEFINES -D__APPLE__ -D__GNUC__"
configuration "is not debug" -- abstract syntax, should work like "not premake.config.isdebugbuild(cfg)"
defines "QT_NO_DEBUG"
configuration "*"
--
-- Qt modules
--
usage "QtCore"
uses "Qt"
defines "QT_CORE_LIB"
includedirs "%qtincludes/QtCore"
configuration "macosx"
includedirs "%qtlib/QtCore.framework/Headers"
configuration "*"
usage "QtGui"
uses "QtCore"
defines "QT_GUI_LIB"
includedirs "%qtincludes/QtGui"
configuration "macosx"
includedirs "%qtlib/QtGui.framework/Headers"
configuration "*"
-- etc. for all Qt modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment