diff --git a/tools/xmake.lua b/tools/xmake.lua index 82efff569..d9e26212c 100644 --- a/tools/xmake.lua +++ b/tools/xmake.lua @@ -23,7 +23,7 @@ rule("qt5.moc") set_extensions(".h", ".hpp") before_buildcmd_file(function (target, batchcmds, sourcefile, opt) local qtbase = target:dep("qt5core") - local qt = assert(qtbase:data("qtdir"), "qt not found!") + local qt = assert(qtbase:fetch().qtbase, "qt not found!") -- imports import("core.tool.compiler") @@ -96,7 +96,9 @@ target("NazaraShaderNodes") add_deps("NazaraShader") add_packages("nodeeditor") add_packages("qt5core", "qt5gui", "qt5widgets") - add_cxflags("-fPIC") + if not is_plat("windows") then + add_cxflags("-fPIC") + end add_includedirs("../src") add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl") diff --git a/xmake-repo/packages/q/qt5base/xmake.lua b/xmake-repo/packages/q/qt5base/xmake.lua index e6ccd8545..d9340ec71 100644 --- a/xmake-repo/packages/q/qt5base/xmake.lua +++ b/xmake-repo/packages/q/qt5base/xmake.lua @@ -13,21 +13,18 @@ package("qt5base") on_fetch(function (package, opt) local qt = package:data("qtdir") if qt then - return { - qtdir = qt - } + return qt end if os.isfile(package:manifest_file()) then - local qt = package:installdir() - package:data_set("qtdir", { - bindir = path.join(qt, "bin"), - includedir = path.join(qt, "include"), - libdir = path.join(qt, "lib") - }) - return { - qtdir = qt + local installdir = package:installdir() + local qt = { + bindir = path.join(installdir, "bin"), + includedir = path.join(installdir, "include"), + libdir = path.join(installdir, "lib") } + package:data_set("qtdir", qt) + return qt end if not opt.system then @@ -41,10 +38,7 @@ package("qt5base") end package:data_set("qtdir", qt) - return { - version = qt.sdkver, - qtdir = qt, - } + return qt end) on_install("windows", "linux", "macosx", "mingw", "android", "iphoneos", function (package) diff --git a/xmake-repo/packages/q/qt5core/xmake.lua b/xmake-repo/packages/q/qt5core/xmake.lua index 5922758f3..2286206cb 100644 --- a/xmake-repo/packages/q/qt5core/xmake.lua +++ b/xmake-repo/packages/q/qt5core/xmake.lua @@ -10,16 +10,16 @@ package("qt5core") on_fetch(function (package) local base = package:dep("qt5base") - local qt = base:data("qtdir") + local qt = base:fetch() if not qt then return end return { 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 "")), - linkdirs = table.wrap(qt.libdir), - includedirs = table.wrap(qt.includedir) + linkdirs = table.wrap(qt.libdir) } end) @@ -30,5 +30,10 @@ package("qt5core") end) 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) diff --git a/xmake-repo/packages/q/qt5gui/xmake.lua b/xmake-repo/packages/q/qt5gui/xmake.lua index b1051dc73..5529d4a37 100644 --- a/xmake-repo/packages/q/qt5gui/xmake.lua +++ b/xmake-repo/packages/q/qt5gui/xmake.lua @@ -10,23 +10,29 @@ package("qt5gui") on_fetch(function (package) local base = package:dep("qt5base") - local qt = base:data("qtdir") + local qt = base:fetch() if not qt then return end return { + includedirs = {qt.includedir, path.join(qt.includedir, "QtGui")}, links = table.wrap("Qt5Gui" .. (package:is_plat("windows") and package:is_debug() and "d" or "")), linkdirs = table.wrap(qt.libdir), - includedirs = table.wrap(qt.includedir) } end) on_install(function (package) local base = package:dep("qt5base") - local qt = base:data("qtdir") + local qt = base:fetch() assert(qt, "qt5base is required") end) 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) diff --git a/xmake-repo/packages/q/qt5widgets/xmake.lua b/xmake-repo/packages/q/qt5widgets/xmake.lua index 95b1f46a4..247013719 100644 --- a/xmake-repo/packages/q/qt5widgets/xmake.lua +++ b/xmake-repo/packages/q/qt5widgets/xmake.lua @@ -16,9 +16,9 @@ package("qt5widgets") end return { + includedirs = {qt.includedir, path.join(qt.includedir, "QtWidgets")}, links = table.wrap("Qt5Widgets" .. (package:is_plat("windows") and package:is_debug() and "d" or "")), - linkdirs = table.wrap(qt.libdir), - includedirs = table.wrap(qt.includedir) + linkdirs = table.wrap(qt.libdir) } end) @@ -29,4 +29,14 @@ package("qt5widgets") end) 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)