2
0

xmake.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("qt6qml")
  2. set_base("qt6lib")
  3. set_kind("library")
  4. on_load(function (package)
  5. package:add("deps", "qt6core", "qt6gui", {debug = package:is_debug(), version = package:version_str()})
  6. package:data_set("libname", "Qml")
  7. package:base():script("load")(package)
  8. end)
  9. on_test(function (package)
  10. local cxflags
  11. if package:is_plat("windows") then
  12. cxflags = {"/Zc:__cplusplus", "/permissive-"}
  13. else
  14. cxflags = "-fPIC"
  15. end
  16. assert(package:check_cxxsnippets({test = [[
  17. int test(int argc, char** argv) {
  18. #if QT_VERSION >= 0x50601
  19. QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  20. #endif
  21. QGuiApplication app(argc, argv);
  22. QQmlApplicationEngine engine;
  23. engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  24. if (engine.rootObjects().isEmpty())
  25. return -1;
  26. return app.exec();
  27. }
  28. ]]}, {configs = {languages = "c++17", cxflags = cxflags}, includes = {"QGuiApplication", "QQmlApplicationEngine"}}))
  29. end)