-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oriane Chagnon
committed
Oct 19, 2020
0 parents
commit 769b4e6
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(Test LANGUAGES CXX) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
# QtCreator supports the following variables for Android, which are identical to qmake Android variables. | ||
# Check http://doc.qt.io/qt-5/deployment-android.html for more information. | ||
# They need to be set before the find_package(Qt5 ...) call. | ||
|
||
#if(ANDROID) | ||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") | ||
# if (ANDROID_ABI STREQUAL "armeabi-v7a") | ||
# set(ANDROID_EXTRA_LIBS | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) | ||
# endif() | ||
#endif() | ||
|
||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED) | ||
|
||
if(ANDROID) | ||
add_library(Test SHARED | ||
main.cpp | ||
qml.qrc | ||
) | ||
else() | ||
add_executable(Test | ||
main.cpp | ||
qml.qrc | ||
) | ||
endif() | ||
|
||
target_compile_definitions(Test | ||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) | ||
target_link_libraries(Test | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | ||
|
||
QGuiApplication app(argc, argv); | ||
|
||
QQmlApplicationEngine engine; | ||
const QUrl url(QStringLiteral("qrc:/main.qml")); | ||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, | ||
&app, [url](QObject *obj, const QUrl &objUrl) { | ||
if (!obj && url == objUrl) | ||
QCoreApplication::exit(-1); | ||
}, Qt::QueuedConnection); | ||
engine.load(url); | ||
|
||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import QtQuick 2.10 | ||
import QtQuick.Window 2.10 | ||
|
||
Window { | ||
width: 640 | ||
height: 480 | ||
visible: true | ||
title: qsTr("Hello World") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>main.qml</file> | ||
</qresource> | ||
</RCC> |