XMake: Qt as packages, proof of concept

This commit is contained in:
Jérôme Leclercq
2021-07-28 16:13:22 +02:00
parent 0bb443b0d0
commit 8397fd257b
7 changed files with 185 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ index 3d47a3f..cc5eb68 100644
@@ -1,5 +1,11 @@
#pragma once
+#include <QtGlobal>
+#include <QtCore/QtGlobal>
+
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+

View File

@@ -7,9 +7,9 @@ package("nodeeditor")
set_urls("https://github.com/paceholder/nodeeditor/archive/refs/tags/$(version).tar.gz",
"https://github.com/paceholder/nodeeditor.git")
add_versions("2.1.3", "4e3194a04ac4a2a2bf4bc8eb6cc27d5cc154923143c1ecf579ce7f0115a90585")
add_patches("2.1.3", path.join(os.scriptdir(), "patches", "2.1.3", "fix_qt.patch"), "804ee98d47b675c578981414ed25a745f1b12d0cd8b03ea7d7b079c7e1ce1ea9")
add_patches("2.1.3", path.join(os.scriptdir(), "patches", "2.1.3", "fix_qt.patch"), "3192c66fe711ad4bbfba96348601655396bc32465e2807f5be252cde6e2a3d59")
add_deps("cmake")
add_deps("cmake", "qt5core", "qt5gui", "qt5widgets")
on_load(function (package)
if package:config("shared") then
@@ -20,8 +20,7 @@ package("nodeeditor")
end)
on_install("windows", "linux", "mingw", "macosx", function (package)
import("detect.sdks.find_qt")
local qt = find_qt()
local qt = package:dep("qt5core"):fetch().qtdir
local configs = {"-DBUILD_EXAMPLES=OFF", "-DBUILD_TESTING=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
@@ -33,10 +32,6 @@ package("nodeeditor")
end)
on_test(function (package)
do
-- Disable test until I can test with Qt
return
end
assert(package:check_cxxsnippets({test = [[
void test() {
QtNodes::FlowScene scene(std::make_shared<QtNodes::DataModelRegistry>());

View File

@@ -0,0 +1,35 @@
package("qt5base")
set_kind("binary")
set_homepage("https://www.qt.io")
set_description("Qt is the faster, smarter way to create innovative devices, modern UIs & applications for multiple screens. Cross-platform software development at its best.")
set_license("LGPL-3")
on_load(function (package)
-- I think find_qt could be moved here
import("detect.sdks.find_qt")
local qt = find_qt()
if qt then
package:data_set("qtdir", qt)
end
end)
on_fetch(function (package)
local qt = package:data("qtdir")
if not qt then
return
end
return {
qtdir = qt,
}
end)
-- TODO: on_install using aqtinstall
on_test(function (package)
local qt = package:data("qtdir")
os.vrun(path.join(qt.bindir, "moc", " -v"))
os.vrun(path.join(qt.bindir, "rcc", " -v"))
os.vrun(path.join(qt.bindir, "uic", " -v"))
end)

View File

@@ -0,0 +1,19 @@
package("qt5core")
set_homepage("https://www.qt.io")
set_description("Qt is the faster, smarter way to create innovative devices, modern UIs & applications for multiple screens. Cross-platform software development at its best.")
set_license("LGPL-3")
add_deps("qt5base", {public=true})
on_fetch(function (package)
local base = package:dep("qt5base")
local qt = base:data("qtdir")
return {
qtdir = qt,
links = table.wrap("Qt5Core" .. (package:is_debug() and "d" or "")),
linkdirs = table.wrap(qt.libdir),
includedirs = table.wrap(qt.includedir)
}
end)

View File

@@ -0,0 +1,18 @@
package("qt5gui")
set_homepage("https://www.qt.io")
set_description("Qt is the faster, smarter way to create innovative devices, modern UIs & applications for multiple screens. Cross-platform software development at its best.")
set_license("LGPL-3")
add_deps("qt5base", "qt5core", "qt5core")
on_fetch(function (package)
local base = package:dep("qt5base")
local qt = base:data("qtdir")
return {
links = table.wrap("Qt5Gui" .. (package:is_debug() and "d" or "")),
linkdirs = table.wrap(qt.libdir),
includedirs = table.wrap(qt.includedir)
}
end)

View File

@@ -0,0 +1,19 @@
package("qt5widgets")
set_homepage("https://www.qt.io")
set_description("Qt is the faster, smarter way to create innovative devices, modern UIs & applications for multiple screens. Cross-platform software development at its best.")
set_license("LGPL-3")
add_deps("qt5base", "qt5core", "qt5gui")
on_fetch(function (package)
local base = package:dep("qt5base")
local qt = base:data("qtdir")
print(qt)
return {
links = table.wrap("Qt5Widgets" .. (package:is_debug() and "d" or "")),
linkdirs = table.wrap(qt.libdir),
includedirs = table.wrap(qt.includedir)
}
end)