Improve Qt packages
This commit is contained in:
parent
39d8cc4933
commit
3653e9136d
|
|
@ -23,7 +23,7 @@ rule("qt5.moc")
|
||||||
set_extensions(".h", ".hpp")
|
set_extensions(".h", ".hpp")
|
||||||
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
|
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
|
||||||
local qtbase = target:dep("qt5core")
|
local qtbase = target:dep("qt5core")
|
||||||
local qt = assert(qtbase:data("qtdir"), "qt not found!")
|
local qt = assert(qtbase:fetch().qtbase, "qt not found!")
|
||||||
|
|
||||||
-- imports
|
-- imports
|
||||||
import("core.tool.compiler")
|
import("core.tool.compiler")
|
||||||
|
|
@ -96,7 +96,9 @@ target("NazaraShaderNodes")
|
||||||
add_deps("NazaraShader")
|
add_deps("NazaraShader")
|
||||||
add_packages("nodeeditor")
|
add_packages("nodeeditor")
|
||||||
add_packages("qt5core", "qt5gui", "qt5widgets")
|
add_packages("qt5core", "qt5gui", "qt5widgets")
|
||||||
|
if not is_plat("windows") then
|
||||||
add_cxflags("-fPIC")
|
add_cxflags("-fPIC")
|
||||||
|
end
|
||||||
|
|
||||||
add_includedirs("../src")
|
add_includedirs("../src")
|
||||||
add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl")
|
add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl")
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,18 @@ package("qt5base")
|
||||||
on_fetch(function (package, opt)
|
on_fetch(function (package, opt)
|
||||||
local qt = package:data("qtdir")
|
local qt = package:data("qtdir")
|
||||||
if qt then
|
if qt then
|
||||||
return {
|
return qt
|
||||||
qtdir = qt
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if os.isfile(package:manifest_file()) then
|
if os.isfile(package:manifest_file()) then
|
||||||
local qt = package:installdir()
|
local installdir = package:installdir()
|
||||||
package:data_set("qtdir", {
|
local qt = {
|
||||||
bindir = path.join(qt, "bin"),
|
bindir = path.join(installdir, "bin"),
|
||||||
includedir = path.join(qt, "include"),
|
includedir = path.join(installdir, "include"),
|
||||||
libdir = path.join(qt, "lib")
|
libdir = path.join(installdir, "lib")
|
||||||
})
|
|
||||||
return {
|
|
||||||
qtdir = qt
|
|
||||||
}
|
}
|
||||||
|
package:data_set("qtdir", qt)
|
||||||
|
return qt
|
||||||
end
|
end
|
||||||
|
|
||||||
if not opt.system then
|
if not opt.system then
|
||||||
|
|
@ -41,10 +38,7 @@ package("qt5base")
|
||||||
end
|
end
|
||||||
|
|
||||||
package:data_set("qtdir", qt)
|
package:data_set("qtdir", qt)
|
||||||
return {
|
return qt
|
||||||
version = qt.sdkver,
|
|
||||||
qtdir = qt,
|
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
on_install("windows", "linux", "macosx", "mingw", "android", "iphoneos", function (package)
|
on_install("windows", "linux", "macosx", "mingw", "android", "iphoneos", function (package)
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,16 @@ package("qt5core")
|
||||||
|
|
||||||
on_fetch(function (package)
|
on_fetch(function (package)
|
||||||
local base = package:dep("qt5base")
|
local base = package:dep("qt5base")
|
||||||
local qt = base:data("qtdir")
|
local qt = base:fetch()
|
||||||
if not qt then
|
if not qt then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
qtdir = qt,
|
qtdir = qt,
|
||||||
|
includedirs = {qt.includedir, path.join(qt.includedir, "QtCore")},
|
||||||
links = table.wrap("Qt5Core" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
links = table.wrap("Qt5Core" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
||||||
linkdirs = table.wrap(qt.libdir),
|
linkdirs = table.wrap(qt.libdir)
|
||||||
includedirs = table.wrap(qt.includedir)
|
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -30,5 +30,10 @@ package("qt5core")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
on_test(function (package)
|
on_test(function (package)
|
||||||
|
assert(package:check_cxxsnippets({test = [[
|
||||||
|
int test(int argc, char** argv) {
|
||||||
|
QCoreApplication app (argc, argv);
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
]]}, {configs = {languages = "c++14", cxflags = not package:is_plat("windows") and "-fPIC" or nil}, includes = {"QCoreApplication"}}))
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -10,23 +10,29 @@ package("qt5gui")
|
||||||
|
|
||||||
on_fetch(function (package)
|
on_fetch(function (package)
|
||||||
local base = package:dep("qt5base")
|
local base = package:dep("qt5base")
|
||||||
local qt = base:data("qtdir")
|
local qt = base:fetch()
|
||||||
if not qt then
|
if not qt then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
includedirs = {qt.includedir, path.join(qt.includedir, "QtGui")},
|
||||||
links = table.wrap("Qt5Gui" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
links = table.wrap("Qt5Gui" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
||||||
linkdirs = table.wrap(qt.libdir),
|
linkdirs = table.wrap(qt.libdir),
|
||||||
includedirs = table.wrap(qt.includedir)
|
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
on_install(function (package)
|
on_install(function (package)
|
||||||
local base = package:dep("qt5base")
|
local base = package:dep("qt5base")
|
||||||
local qt = base:data("qtdir")
|
local qt = base:fetch()
|
||||||
assert(qt, "qt5base is required")
|
assert(qt, "qt5base is required")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
on_test(function (package)
|
on_test(function (package)
|
||||||
|
assert(package:check_cxxsnippets({test = [[
|
||||||
|
int test(int argc, char** argv) {
|
||||||
|
QGuiApplication app (argc, argv);
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
]]}, {configs = {languages = "c++14", cxflags = not package:is_plat("windows") and "-fPIC" or nil}, includes = {"QGuiApplication"}}))
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ package("qt5widgets")
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
includedirs = {qt.includedir, path.join(qt.includedir, "QtWidgets")},
|
||||||
links = table.wrap("Qt5Widgets" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
links = table.wrap("Qt5Widgets" .. (package:is_plat("windows") and package:is_debug() and "d" or "")),
|
||||||
linkdirs = table.wrap(qt.libdir),
|
linkdirs = table.wrap(qt.libdir)
|
||||||
includedirs = table.wrap(qt.includedir)
|
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -29,4 +29,14 @@ package("qt5widgets")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
on_test(function (package)
|
on_test(function (package)
|
||||||
|
assert(package:check_cxxsnippets({test = [[
|
||||||
|
int test(int argc, char** argv) {
|
||||||
|
QApplication app (argc, argv);
|
||||||
|
|
||||||
|
QPushButton button ("Hello world !");
|
||||||
|
button.show();
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
]]}, {configs = {languages = "c++14", cxflags = not package:is_plat("windows") and "-fPIC" or nil}, includes = {"QApplication", "QPushButton"}}))
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue