-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
130 lines (98 loc) · 3.07 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#
# Set up cmake
#
cmake_minimum_required(VERSION 3.19)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(ExternalProject)
option(QTDEPLOY "Generate and run Qt deployment scripts" OFF)
#
# Project data
#
project(enroute VERSION 2.32.2)
set(APP_ID de.akaflieg_freiburg.enroute)
set(DISPLAY_NAME "Enroute")
math(EXPR PROJECT_VERSION_CODE 10000*${PROJECT_VERSION_MAJOR}+100*${PROJECT_VERSION_MINOR}+${PROJECT_VERSION_PATCH})
#
# Installation
#
include(GNUInstallDirs)
#
# Qt Setup
#
find_package(Qt6 6.8 COMPONENTS Bluetooth Concurrent Core Core5Compat Gui HttpServer LinguistTools Location Positioning Quick QuickControls2 QuickWidgets Sql Svg TextToSpeech Widgets REQUIRED)
set(QT_VERSION ${Qt6Core_VERSION})
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(Qt6 6.8 COMPONENTS Sensors SerialPort WebView REQUIRED)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Qt6 6.8 COMPONENTS SerialPort WebView REQUIRED)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
find_package(Qt6 6.8 COMPONENTS Sensors WebView REQUIRED)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(Qt6 6.8 COMPONENTS DBus SerialPort Widgets REQUIRED)
find_package(Qt6 6.8 COMPONENTS WebView)
endif()
qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de es fr it pl)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(QT_QML_GENERATE_QMLLS_INI ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
qt_policy(SET QTP0002 NEW)
qt_policy(SET QTP0004 NEW)
#
# External Packages
#
find_package(libzip REQUIRED)
find_package(Git REQUIRED)
find_package(QMapLibre COMPONENTS Location REQUIRED)
if(IOS)
set(PRODUCT_BUNDLE_IDENTIFIER de.akafliegfreiburg.enroute)
set(CMAKE_XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon)
include(CMakeLists_ios.txt OPTIONAL)
endif()
#
# Find GIT repository data.
#
if (EXISTS ${CMAKE_SOURCE_DIR}/.git)
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git branch ${GIT_BRANCH}")
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git Commit ${GIT_COMMIT}")
# Get the latest commit date of the working branch
execute_process(
COMMAND git log -1 --format=%as
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git commit from ${GIT_DATE}")
else()
message("Not working from a GIT directory")
set(GIT_BRANCH "")
set(GIT_COMMIT "")
set(GIT_DATE "")
endif()
#
# Subdirectories
#
add_subdirectory(3rdParty)
add_subdirectory(generatedSources)
add_subdirectory(metadata)
add_subdirectory(packaging)
add_subdirectory(src)