-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
110 lines (86 loc) · 2.97 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
cmake_minimum_required(VERSION 3.18)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
project(basic_qml)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
find_package(Qt5 REQUIRED COMPONENTS Quick Widgets QuickCompiler)
qtquick_compiler_add_resources(RESOURCES qml.qrc)
if (ANDROID)
include(cmake/QtAndroidCMake/AddQtAndroidApk.cmake)
set(QT_ANDROID_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtAndroidCMake CACHE STRING "Source directory of AddQtAndroidApk.cmake")
set(QT_ANDROID_QT_ROOT ${QT_ANDROID_QT_ROOT} CACHE STRING "Qt SDK root folder")
set(QT_ANDROID_SDK_ROOT ${QT_ANDROID_SDK_ROOT} CACHE STRING "" FORCE)
set(QT_ANDROID_NDK_ROOT ${QT_ANDROID_NDK_ROOT} CACHE STRING "" FORCE)
add_library(basic_qml
main.cpp
qml.qrc)
target_link_libraries(basic_qml PRIVATE
Qt5::Widgets
Qt5::Quick
)
add_qt_android_apk(basic_qml_apk basic_qml
NAME "Basic QML"
VERSION_CODE 2
PACKAGE_NAME "com.mindpower.basic_qml"
PACKAGE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android
INSTALL
)
elseif (IOS)
add_executable(basicqml
main.cpp
qml.qrc)
include(cmake/QtIosCMake/AddQtIosApp.cmake)
target_link_libraries(basicqml PRIVATE
Qt5::Widgets
Qt5::Quick
)
include(cmake/QtStaticCMake/QtStaticCMake.cmake)
qt_generate_plugin_import(basicqml)
qt_generate_qml_plugin_import(basicqml
QML_SRC ${CMAKE_CURRENT_SOURCE_DIR}/
EXTRA_PLUGIN
QtQuickVirtualKeyboardPlugin
QtQuickVirtualKeyboardSettingsPlugin
QtQuickVirtualKeyboardStylesPlugin
QmlFolderListModelPlugin
QQuickLayoutsPlugin
)
add_qt_ios_app(basicqml
NAME "Basic QML"
BUNDLE_IDENTIFIER "com.company.basicqml"
VERSION "1.2.3"
SHORT_VERSION "1.2.3"
LONG_VERSION "1.2.3.456"
SUPPORT_IPHONE
REQUIRES_FULL_SCREEN
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
find_package(Qt5 COMPONENTS QuickControls2 REQUIRED)
add_executable(basic_qml
main.cpp
qml.qrc)
target_link_libraries(basic_qml PRIVATE
Qt::Widgets
Qt::Quick
Qt::QuickControls2
)
include(cmake/QtStaticCMake/QtStaticCMake.cmake)
qt_generate_plugin_import(basic_qml)
qt_generate_qml_plugin_import(basic_qml
QML_SRC ${CMAKE_CURRENT_SOURCE_DIR}/
EXTRA_PLUGIN
QmlFolderListModelPlugin
QQuickLayoutsPlugin
)
include(cmake/QtWasmCMake/CMakeLists.txt)
add_qt_wasm_app(basic_qml INITIAL_MEMORY 32MB)
else ()
add_executable(basic_qml
main.cpp
qml.qrc)
target_link_libraries(basic_qml PRIVATE
Qt::Widgets
Qt::Quick
)
endif ()