summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-04-23 22:55:46 +0800
committerruki <[email protected]>2018-04-23 11:34:39 +0800
commit41d3b7182ad98791d9b61a2303072da178e97cba (patch)
tree9b6ff946b7d63a657c6c76bf1824b78104a5b827
parent16d63f84c4edad63a48fe3ed58e043a8032e53b6 (diff)
add qt templates
-rw-r--r--xmake/templates/c++/console_qt/project/.gitignore22
-rw-r--r--xmake/templates/c++/console_qt/project/src/main.cpp9
-rw-r--r--xmake/templates/c++/console_qt/project/xmake.lua13
-rw-r--r--xmake/templates/c++/console_qt/template.lua15
-rw-r--r--xmake/templates/c++/quickapp_qt/project/src/main.cpp16
-rw-r--r--xmake/templates/c++/quickapp_qt/project/src/main.qml9
-rw-r--r--xmake/templates/c++/quickapp_qt/project/src/qml.qrc5
-rw-r--r--xmake/templates/c++/quickapp_qt/project/xmake.lua20
-rw-r--r--xmake/templates/c++/quickapp_qt/template.lua15
-rw-r--r--xmake/templates/c++/shared_library_qt/project/.gitignore22
-rw-r--r--xmake/templates/c++/shared_library_qt/project/src/demo.cpp6
-rw-r--r--xmake/templates/c++/shared_library_qt/project/src/demo.h13
-rw-r--r--xmake/templates/c++/shared_library_qt/project/src/demo_global.h12
-rw-r--r--xmake/templates/c++/shared_library_qt/project/xmake.lua21
-rw-r--r--xmake/templates/c++/shared_library_qt/template.lua15
-rw-r--r--xmake/templates/c++/static_library_qt/project/.gitignore22
-rw-r--r--xmake/templates/c++/static_library_qt/project/src/demo.cpp5
-rw-r--r--xmake/templates/c++/static_library_qt/project/src/demo.h11
-rw-r--r--xmake/templates/c++/static_library_qt/project/xmake.lua18
-rw-r--r--xmake/templates/c++/static_library_qt/template.lua15
20 files changed, 284 insertions, 0 deletions
diff --git a/xmake/templates/c++/console_qt/project/.gitignore b/xmake/templates/c++/console_qt/project/.gitignore
new file mode 100644
index 000000000..08ffbbd04
--- /dev/null
+++ b/xmake/templates/c++/console_qt/project/.gitignore
@@ -0,0 +1,22 @@
+*.a
+*.o
+*.exe
+*.obj
+*.dll
+*.lib
+*.out
+*.suo
+*~
+*.swp
+*.swo
+*.bak
+*.orig
+*.pdb
+*.idb
+.svn
+.DS_Store
+.xmake
+*.gch
+*.gch.d
+gmon.out
+build
diff --git a/xmake/templates/c++/console_qt/project/src/main.cpp b/xmake/templates/c++/console_qt/project/src/main.cpp
new file mode 100644
index 000000000..de25444ff
--- /dev/null
+++ b/xmake/templates/c++/console_qt/project/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/xmake/templates/c++/console_qt/project/xmake.lua b/xmake/templates/c++/console_qt/project/xmake.lua
new file mode 100644
index 000000000..5dba5a131
--- /dev/null
+++ b/xmake/templates/c++/console_qt/project/xmake.lua
@@ -0,0 +1,13 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("[targetname]")
+
+ -- add rules
+ add_rules("qt.console")
+
+ -- add files
+ add_files("src/*.cpp")
+
diff --git a/xmake/templates/c++/console_qt/template.lua b/xmake/templates/c++/console_qt/template.lua
new file mode 100644
index 000000000..e5ed714e6
--- /dev/null
+++ b/xmake/templates/c++/console_qt/template.lua
@@ -0,0 +1,15 @@
+-- set name
+set_name("console_qt")
+
+-- set description
+set_description("The Console Program (Qt)")
+
+-- set project directory
+set_projectdir("project")
+
+-- add macros
+add_macros("targetname", "$(targetname)")
+
+-- add macro files
+add_macrofiles("xmake.lua")
+
diff --git a/xmake/templates/c++/quickapp_qt/project/src/main.cpp b/xmake/templates/c++/quickapp_qt/project/src/main.cpp
new file mode 100644
index 000000000..6333b85c4
--- /dev/null
+++ b/xmake/templates/c++/quickapp_qt/project/src/main.cpp
@@ -0,0 +1,16 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/xmake/templates/c++/quickapp_qt/project/src/main.qml b/xmake/templates/c++/quickapp_qt/project/src/main.qml
new file mode 100644
index 000000000..188049dae
--- /dev/null
+++ b/xmake/templates/c++/quickapp_qt/project/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/xmake/templates/c++/quickapp_qt/project/src/qml.qrc b/xmake/templates/c++/quickapp_qt/project/src/qml.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/xmake/templates/c++/quickapp_qt/project/src/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/xmake/templates/c++/quickapp_qt/project/xmake.lua b/xmake/templates/c++/quickapp_qt/project/xmake.lua
new file mode 100644
index 000000000..ab193b6ee
--- /dev/null
+++ b/xmake/templates/c++/quickapp_qt/project/xmake.lua
@@ -0,0 +1,20 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("[targetname]")
+
+ -- add rules
+ add_rules("qt.application")
+
+ -- add headers
+ add_headers("src/*.h")
+
+ -- add files
+ add_files("src/*.cpp")
+ add_files("src/qml.qrc")
+
+ -- add frameworks
+ add_frameworks("QtQuick")
+
diff --git a/xmake/templates/c++/quickapp_qt/template.lua b/xmake/templates/c++/quickapp_qt/template.lua
new file mode 100644
index 000000000..1efa5b9aa
--- /dev/null
+++ b/xmake/templates/c++/quickapp_qt/template.lua
@@ -0,0 +1,15 @@
+-- set name
+set_name("quickapp_qt")
+
+-- set description
+set_description("The Quick Application (Qt)")
+
+-- set project directory
+set_projectdir("project")
+
+-- add macros
+add_macros("targetname", "$(targetname)")
+
+-- add macro files
+add_macrofiles("xmake.lua")
+
diff --git a/xmake/templates/c++/shared_library_qt/project/.gitignore b/xmake/templates/c++/shared_library_qt/project/.gitignore
new file mode 100644
index 000000000..08ffbbd04
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/project/.gitignore
@@ -0,0 +1,22 @@
+*.a
+*.o
+*.exe
+*.obj
+*.dll
+*.lib
+*.out
+*.suo
+*~
+*.swp
+*.swo
+*.bak
+*.orig
+*.pdb
+*.idb
+.svn
+.DS_Store
+.xmake
+*.gch
+*.gch.d
+gmon.out
+build
diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo.cpp b/xmake/templates/c++/shared_library_qt/project/src/demo.cpp
new file mode 100644
index 000000000..bd791c271
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/project/src/demo.cpp
@@ -0,0 +1,6 @@
+#include "demo.h"
+
+
+QtDemo::QtDemo()
+{
+}
diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo.h b/xmake/templates/c++/shared_library_qt/project/src/demo.h
new file mode 100644
index 000000000..d88dc29ee
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/project/src/demo.h
@@ -0,0 +1,13 @@
+#ifndef QT_DEMO_H
+#define QT_DEMO_H
+
+#include "demo_global.h"
+
+class QT_DEMOSHARED_EXPORT QtDemo
+{
+
+public:
+ QtDemo();
+};
+
+#endif // QT_TEST5_H
diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo_global.h b/xmake/templates/c++/shared_library_qt/project/src/demo_global.h
new file mode 100644
index 000000000..25abfb05c
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/project/src/demo_global.h
@@ -0,0 +1,12 @@
+#ifndef QT_DEMO_GLOBAL_H
+#define QT_DEMO_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(QT_DEMO_LIBRARY)
+# define QT_DEMOSHARED_EXPORT Q_DECL_EXPORT
+#else
+# define QT_DEMOSHARED_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // QT_TEST5_GLOBAL_H
diff --git a/xmake/templates/c++/shared_library_qt/project/xmake.lua b/xmake/templates/c++/shared_library_qt/project/xmake.lua
new file mode 100644
index 000000000..4e1163958
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/project/xmake.lua
@@ -0,0 +1,21 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("[targetname]")
+
+ -- add rules
+ add_rules("qt.shared")
+
+ -- add headers
+ add_headers("src/*.h")
+
+ -- add files
+ add_files("src/*.cpp")
+
+ -- add defines
+ add_defines("QT_DEMO_LIBRARY")
+
+ -- add frameworks
+ add_frameworks("QtGui")
diff --git a/xmake/templates/c++/shared_library_qt/template.lua b/xmake/templates/c++/shared_library_qt/template.lua
new file mode 100644
index 000000000..d65460fa1
--- /dev/null
+++ b/xmake/templates/c++/shared_library_qt/template.lua
@@ -0,0 +1,15 @@
+-- set name
+set_name("shared_qt")
+
+-- set description
+set_description("The Share Library (Qt)")
+
+-- set project directory
+set_projectdir("project")
+
+-- add macros
+add_macros("targetname", "$(targetname)")
+
+-- add macro files
+add_macrofiles("xmake.lua")
+
diff --git a/xmake/templates/c++/static_library_qt/project/.gitignore b/xmake/templates/c++/static_library_qt/project/.gitignore
new file mode 100644
index 000000000..08ffbbd04
--- /dev/null
+++ b/xmake/templates/c++/static_library_qt/project/.gitignore
@@ -0,0 +1,22 @@
+*.a
+*.o
+*.exe
+*.obj
+*.dll
+*.lib
+*.out
+*.suo
+*~
+*.swp
+*.swo
+*.bak
+*.orig
+*.pdb
+*.idb
+.svn
+.DS_Store
+.xmake
+*.gch
+*.gch.d
+gmon.out
+build
diff --git a/xmake/templates/c++/static_library_qt/project/src/demo.cpp b/xmake/templates/c++/static_library_qt/project/src/demo.cpp
new file mode 100644
index 000000000..a702ad253
--- /dev/null
+++ b/xmake/templates/c++/static_library_qt/project/src/demo.cpp
@@ -0,0 +1,5 @@
+#include "demo.h"
+
+QtDemo::QtDemo()
+{
+}
diff --git a/xmake/templates/c++/static_library_qt/project/src/demo.h b/xmake/templates/c++/static_library_qt/project/src/demo.h
new file mode 100644
index 000000000..51eb9be55
--- /dev/null
+++ b/xmake/templates/c++/static_library_qt/project/src/demo.h
@@ -0,0 +1,11 @@
+#ifndef QT_DEMO_H
+#define QT_DEMO_H
+
+class QtDemo
+{
+
+public:
+ QtDemo();
+};
+
+#endif // QT_DEMO_H
diff --git a/xmake/templates/c++/static_library_qt/project/xmake.lua b/xmake/templates/c++/static_library_qt/project/xmake.lua
new file mode 100644
index 000000000..2b28757b2
--- /dev/null
+++ b/xmake/templates/c++/static_library_qt/project/xmake.lua
@@ -0,0 +1,18 @@
+
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
+
+-- add target
+target("[targetname]")
+
+ -- add rules
+ add_rules("qt.static")
+
+ -- add headers
+ add_headers("src/*.h")
+
+ -- add files
+ add_files("src/*.cpp")
+
+ -- add frameworks
+ add_frameworks("QtGui")
diff --git a/xmake/templates/c++/static_library_qt/template.lua b/xmake/templates/c++/static_library_qt/template.lua
new file mode 100644
index 000000000..14b5db59c
--- /dev/null
+++ b/xmake/templates/c++/static_library_qt/template.lua
@@ -0,0 +1,15 @@
+-- set name
+set_name("static_qt")
+
+-- set description
+set_description("The Static Library (Qt)")
+
+-- set project directory
+set_projectdir("project")
+
+-- add macros
+add_macros("targetname", "$(targetname)")
+
+-- add macro files
+add_macrofiles("xmake.lua")
+