package("qt6lib") set_kind("template") 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_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly = true}) add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true}) add_versions("6.3.0", "dummy") add_versions("6.5.1", "dummy") add_versions("6.6.0", "dummy") on_load(function (package) package:add("deps", "qt6base", {debug = package:is_debug(), version = package:version_str()}) end) on_fetch(function (package) local qt = package:dep("qt6base"):fetch() if not qt then return end local libname = assert(package:data("libname"), "this package must not be used directly") local links = table.wrap(package:data("links")) local includedirs = {qt.includedir} local linkname local frameworks if package:is_plat("windows") then linkname = "Qt6" .. libname if package:is_debug() then linkname = linkname .. "d" end table.insert(includedirs, path.join(qt.includedir, "Qt" .. libname)) elseif package:is_plat("android") then linkname = "Qt6" .. libname if package:is_arch("x86_64", "x64") then linkname = linkname .. "_x86_64" elseif package:is_arch("arm64", "arm64-v8a") then linkname = linkname .. "_arm64-v8a" elseif package:is_arch("armv7", "armeabi-v7a", "armeabi", "armv7-a", "armv5te") then linkname = linkname .. "_armeabi-v7a" elseif package:is_arch("x86") then linkname = linkname .. "_x86" end table.insert(includedirs, path.join(qt.includedir, "Qt" .. libname)) elseif package:is_plat("macosx") then table.insert(includedirs, path.join(qt.libdir, "Qt" .. libname .. ".framework", "Headers")) frameworks = "Qt" .. libname else linkname = "Qt6" .. libname table.insert(includedirs, path.join(qt.includedir, "Qt" .. libname)) end table.insert(links, 1, linkname) if frameworks then table.join2(frameworks, package:data("frameworks")) else frameworks = package:data("frameworks") end return { qtdir = qt, version = qt.version, includedirs = includedirs, links = links, linkdirs = qt.libdir, frameworks = frameworks, frameworkdirs = qt.libdir, syslinks = package:data("syslinks") } end) on_install("windows|x64", "linux|x86_64", "macosx|x86_64", "mingw|x86_64", function (package) local qt = package:dep("qt6base"):data("qt") assert(qt, "qt6base is required") end)