summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2019-02-24 00:12:18 +0800
committerruki <[email protected]>2019-02-24 00:12:18 +0800
commit28a830e6baec04094a2f4933421a216c87025272 (patch)
tree0fd98b241f7061138aa84142a6995bcf2d0f1b3a /tests/projects
parent85a7d6d728348b22254abb1a1bf4e5b1402cba2f (diff)
add static qt projects
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/qt/console_static/src/main.cpp9
-rw-r--r--tests/projects/qt/console_static/xmake.lua13
-rw-r--r--tests/projects/qt/quickapp_static/src/main.cpp25
-rw-r--r--tests/projects/qt/quickapp_static/src/main.qml9
-rw-r--r--tests/projects/qt/quickapp_static/src/qml.qrc5
-rw-r--r--tests/projects/qt/quickapp_static/xmake.lua34
-rw-r--r--tests/projects/qt/widgetapp/xmake.lua1
-rw-r--r--tests/projects/qt/widgetapp_static/src/main.cpp11
-rw-r--r--tests/projects/qt/widgetapp_static/src/mainwindow.cpp14
-rw-r--r--tests/projects/qt/widgetapp_static/src/mainwindow.h22
-rw-r--r--tests/projects/qt/widgetapp_static/src/mainwindow.ui24
-rw-r--r--tests/projects/qt/widgetapp_static/xmake.lua39
12 files changed, 206 insertions, 0 deletions
diff --git a/tests/projects/qt/console_static/src/main.cpp b/tests/projects/qt/console_static/src/main.cpp
new file mode 100644
index 000000000..de25444ff
--- /dev/null
+++ b/tests/projects/qt/console_static/src/main.cpp
@@ -0,0 +1,9 @@
+#include <QCoreApplication>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+
+ printf("hello xmake\n");
+ return a.exec();
+}
diff --git a/tests/projects/qt/console_static/xmake.lua b/tests/projects/qt/console_static/xmake.lua
new file mode 100644
index 000000000..249f52cdd
--- /dev/null
+++ b/tests/projects/qt/console_static/xmake.lua
@@ -0,0 +1,13 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("qt_console")
+
+ -- add rules
+ add_rules("qt.console")
+
+ -- add files
+ add_files("src/*.cpp")
+
diff --git a/tests/projects/qt/quickapp_static/src/main.cpp b/tests/projects/qt/quickapp_static/src/main.cpp
new file mode 100644
index 000000000..05e41f5e1
--- /dev/null
+++ b/tests/projects/qt/quickapp_static/src/main.cpp
@@ -0,0 +1,25 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QQmlExtensionPlugin>
+#include <QtPlugin>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+
+ Q_IMPORT_PLUGIN(QtQuick2Plugin)
+// Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
+
+ qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())->registerTypes("QtQuick");
+ qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance()) ->initializeEngine( &engine, "QtQuick");
+
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/tests/projects/qt/quickapp_static/src/main.qml b/tests/projects/qt/quickapp_static/src/main.qml
new file mode 100644
index 000000000..188049dae
--- /dev/null
+++ b/tests/projects/qt/quickapp_static/src/main.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.9
+import QtQuick.Window 2.2
+
+Window {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("Hello World")
+}
diff --git a/tests/projects/qt/quickapp_static/src/qml.qrc b/tests/projects/qt/quickapp_static/src/qml.qrc
new file mode 100644
index 000000000..ca3fce67a
--- /dev/null
+++ b/tests/projects/qt/quickapp_static/src/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/projects/qt/quickapp_static/xmake.lua b/tests/projects/qt/quickapp_static/xmake.lua
new file mode 100644
index 000000000..03232c822
--- /dev/null
+++ b/tests/projects/qt/quickapp_static/xmake.lua
@@ -0,0 +1,34 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("qt_demo")
+
+ -- add rules
+ add_rules("qt.application")
+
+ -- add headers
+ add_headerfiles("src/*.h")
+
+ -- add files
+ add_files("src/*.cpp")
+ add_files("src/qml.qrc")
+
+ -- add frameworks
+ add_frameworks("QtQuick")
+
+ -- add plugin: platforms
+ add_values("qt.linkdirs", "plugins/platforms")
+ if is_plat("macosx") then
+ add_values("qt.links", "qcocoa", "Qt5PrintSupport", "Qt5PlatformSupport", "Qt5Widgets", "cups")
+ add_values("qt.plugins", "QCocoaIntegrationPlugin")
+ elseif is_plat("windows") then
+ add_values("qt.links", "Qt5PrintSupport", "Qt5PlatformSupport", "cups")
+ add_values("qt.plugins", "QWindowsIntegrationPlugin")
+ end
+
+ -- add plugin: qml.QtQuick
+ add_values("qt.linkdirs", "qml/QtQuick.2")
+ add_values("qt.links", "qtquick2plugin")
+
diff --git a/tests/projects/qt/widgetapp/xmake.lua b/tests/projects/qt/widgetapp/xmake.lua
index dc052f202..2b0217835 100644
--- a/tests/projects/qt/widgetapp/xmake.lua
+++ b/tests/projects/qt/widgetapp/xmake.lua
@@ -20,3 +20,4 @@ target("qt_demo")
-- add frameworks
add_frameworks("QtWidgets")
+
diff --git a/tests/projects/qt/widgetapp_static/src/main.cpp b/tests/projects/qt/widgetapp_static/src/main.cpp
new file mode 100644
index 000000000..b48f94ec8
--- /dev/null
+++ b/tests/projects/qt/widgetapp_static/src/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/projects/qt/widgetapp_static/src/mainwindow.cpp b/tests/projects/qt/widgetapp_static/src/mainwindow.cpp
new file mode 100644
index 000000000..49d64fce7
--- /dev/null
+++ b/tests/projects/qt/widgetapp_static/src/mainwindow.cpp
@@ -0,0 +1,14 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
diff --git a/tests/projects/qt/widgetapp_static/src/mainwindow.h b/tests/projects/qt/widgetapp_static/src/mainwindow.h
new file mode 100644
index 000000000..8e06f4918
--- /dev/null
+++ b/tests/projects/qt/widgetapp_static/src/mainwindow.h
@@ -0,0 +1,22 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/projects/qt/widgetapp_static/src/mainwindow.ui b/tests/projects/qt/widgetapp_static/src/mainwindow.ui
new file mode 100644
index 000000000..1c59b695e
--- /dev/null
+++ b/tests/projects/qt/widgetapp_static/src/mainwindow.ui
@@ -0,0 +1,24 @@
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QMenuBar" name="menuBar" />
+ <widget class="QToolBar" name="mainToolBar" />
+ <widget class="QWidget" name="centralWidget" />
+ <widget class="QStatusBar" name="statusBar" />
+ </widget>
+ <layoutDefault spacing="6" margin="11" />
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/projects/qt/widgetapp_static/xmake.lua b/tests/projects/qt/widgetapp_static/xmake.lua
new file mode 100644
index 000000000..b6142ef03
--- /dev/null
+++ b/tests/projects/qt/widgetapp_static/xmake.lua
@@ -0,0 +1,39 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("qt_demo")
+
+ -- add rules
+ add_rules("qt.application")
+
+ -- add headers
+ add_headerfiles("src/*.h")
+
+ -- add files
+ add_files("src/*.cpp")
+ add_files("src/mainwindow.ui")
+
+ -- add files with Q_OBJECT meta (only for qt.moc)
+ add_files("src/mainwindow.h")
+
+ -- add frameworks
+ add_frameworks("QtWidgets")
+
+ -- add plugin: platforms
+ add_values("qt.linkdirs", "plugins/platforms")
+ if is_plat("macosx") then
+ add_values("qt.links", "qcocoa", "Qt5PrintSupport", "Qt5PlatformSupport", "cups")
+ add_values("qt.plugins", "QCocoaIntegrationPlugin")
+ elseif is_plat("windows") then
+ add_values("qt.links", "Qt5PrintSupport", "Qt5PlatformSupport", "cups")
+ add_values("qt.plugins", "QWindowsIntegrationPlugin")
+ end
+
+ -- add plugin: imageformats.QSvgPlugin (optional)
+ --[[
+ add_values("qt.linkdirs", "plugins/imageformats")
+ add_values("qt.links", "qsvg", "Qt5Svg")
+ add_values("qt.plugins", "QSvgPlugin")
+ ]]