Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions packages/q/qt6quickcontrols2/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package("qt6quickcontrols2")
set_base("qt6lib")
set_kind("library")

on_load(function (package)
package:add("deps", "qt6quick", "qt6qml", "qt6gui", "qt6core", {debug = package:is_debug(), version = package:version_str()})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dependencies qt6qml, qt6gui, and qt6core are transitive dependencies of qt6quick. You can simplify this declaration by only listing qt6quick as a direct dependency. This improves maintainability by relying on the dependency graph already defined in the qt6quick package.

        package:add("deps", "qt6quick", {debug = package:is_debug(), version = package:version_str()})

package:data_set("libname", "QuickControls2")

package:base():script("load")(package)
end)

on_test(function (package)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move on_test to the bottom

local cxflags
if package:is_plat("windows") then
cxflags = {"/Zc:__cplusplus", "/permissive-"}
else
cxflags = "-fPIC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency, cxflags should always be a table of strings. The Windows-specific flags on line 15 are correctly defined as a table. This branch should do the same to ensure the cxflags variable has a consistent type, which is better practice even if xmake can handle a string value.

            cxflags = {"-fPIC"}

end

assert(package:check_cxxsnippets({test = [[
void test() {
QQuickStyle::setStyle("Material");
}
]]}, {
configs = {languages = "c++17", cxflags = cxflags},
includes = {"QQuickStyle"}
}))
end)

on_install("windows|x64,linux|x86_64,linux|arm64,macosx,mingw|x86_64@windows,linux,macosx", function (package)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? remove it. see other qt6xxx packages

local qt = package:dep("qt6base"):data("qt")
assert(qt, "qt6base is required")
end)

on_install("android|arm64-v8a,armeabi-v7a,armeabi,x86_64,x86@windows,linux,macosx", function (package)
local qt = package:dep("qt6base"):data("qt")
assert(qt, "qt6base is required")
end)

Loading