This repository has been archived by the owner on Sep 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
CMakeLists.txt
171 lines (131 loc) · 5.74 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
PROJECT( Charm CXX )
include(FeatureSummary)
set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules/")
set(CMAKE_MODULE_PATH ${ECM_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/kde-modules" )
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMInstallIcons)
IF( NOT Charm_VERSION )
FIND_PACKAGE( Git QUIET )
IF( EXISTS ${GIT_EXECUTABLE} )
EXECUTE_PROCESS( COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=1
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE Charm_VERSION
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE )
IF( NOT GIT_RESULT EQUAL 0 )
MESSAGE( FATAL_ERROR "Cannot get 'git describe' version!" )
ENDIF()
ENDIF()
ENDIF()
STRING( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.(.*)$" Charm_VERSION "${Charm_VERSION}")
SET( Charm_VERSION_MAJOR "${CMAKE_MATCH_1}" )
SET( Charm_VERSION_MINOR "${CMAKE_MATCH_2}" )
SET( Charm_VERSION_PATCH "${CMAKE_MATCH_3}" )
SET( Charm_VERSION_COUNT 3 )
IF( NOT ( DEFINED Charm_VERSION_MAJOR AND DEFINED Charm_VERSION_MINOR AND DEFINED Charm_VERSION_PATCH ) )
MESSAGE( FATAL_ERROR "No Git executable or valid Charm version argument found.\n"
"Please pass a version to CMake e.g. cmake -DCharm_VERSION=1.0.0" )
ENDIF()
MESSAGE( STATUS "Building Charm ${Charm_VERSION} in ${CMAKE_BUILD_TYPE} mode" )
find_package(Qt5 5.15 COMPONENTS Core Widgets Xml Network Sql Test PrintSupport REQUIRED)
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
endif()
IF(APPLE)
find_package(Qt5MacExtras REQUIRED)
ENDIF()
IF(UNIX AND NOT APPLE)
find_package(Qt5DBus QUIET)
ENDIF()
find_package(Qt5Keychain REQUIRED)
set_package_properties(Qt5Keychain PROPERTIES
DESCRIPTION "Provides support for secure credentials storage"
URL "https://github.com/frankosterfeld/qtkeychain"
TYPE REQUIRED)
SET(CHARM_MAC_HIGHRES_SUPPORT_ENABLED ON)
ENABLE_TESTING()
IF( UNIX AND NOT APPLE )
set( Charm_EXECUTABLE charmtimetracker )
ELSE()
set( Charm_EXECUTABLE Charm )
ENDIF()
SET( BIN_INSTALL_DIR bin )
SET( DOC_INSTALL_DIR ${CMAKE_INSTALL_DOCBUNDLEDIR}/${Charm_EXECUTABLE} )
SET( ICONS_DIR "${CMAKE_SOURCE_DIR}/Charm/Icons" )
IF( CHARM_PREPARE_DEPLOY AND WIN32 OR APPLE)
SET( BIN_INSTALL_DIR . )
SET( DOC_INSTALL_DIR . )
ENDIF()
OPTION( CHARM_IDLE_DETECTION "Build the Charm idle detector" ON )
OPTION( CHARM_TIMESHEET_TOOLS "Build the Charm timesheet tools" OFF )
set( CHARM_IDLE_TIME "360" CACHE STRING "Set the idle timeout (in seconds, default 360)" )
OPTION( CHARM_CI_SUPPORT "Build Charm with command interface support" OFF )
IF( CHARM_CI_SUPPORT )
OPTION( CHARM_CI_TCPSERVER "Build Charm with TCP command interface support" ON )
OPTION( CHARM_CI_LOCALSERVER "Build Charm with local socket command interface support" ON )
ENDIF()
OPTION(CHARM_PREPARE_DEPLOY "Deploy dependencies with install target(Windows, Apple)" ON)
ADD_SUBDIRECTORY( Core )
ADD_SUBDIRECTORY( Charm )
IF( CHARM_TIMESHEET_TOOLS AND UNIX )
# Only build the tools if they are explicitly requested to avoid
# the Qt MySQL driver dependency.
ADD_SUBDIRECTORY( Tools/TimesheetProcessor )
ADD_SUBDIRECTORY( Tools/TimesheetGenerator )
MESSAGE( STATUS "Building the Charm timesheet tools")
ENDIF()
ADD_SUBDIRECTORY( Tests )
CONFIGURE_FILE( CharmCMake.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/CharmCMake.h )
SET( LICENSE_FILE "License.txt" )
SET( README_FILE "ReadMe.md" )
IF( NOT APPLE )
INSTALL( FILES "${LICENSE_FILE}" "${README_FILE}" DESTINATION ${DOC_INSTALL_DIR} )
ENDIF()
IF (WIN32)
FIND_PACKAGE( PythonInterp 3.5 QUIET)
set_package_properties(PythonInterp PROPERTIES
PURPOSE "Used to create Windows installer"
TYPE OPTIONAL)
IF(PYTHONINTERP_FOUND)
OPTION(CHARM_SIGN_INSTALLER "Sign the installer and the contained files" ON)
SET(EXTRA_PACKAGE_COMMANDS )
FIND_PACKAGE( OpenSSL QUIET)
set_package_properties(OpenSSL PROPERTIES
PURPOSE "Deployment of openssl libraries."
TYPE OPTIONAL)
IF (OPENSSL_FOUND)
SET(EXTRA_PACKAGE_COMMANDS ${EXTRA_PACKAGE_COMMANDS} --deployOpenSSL "${OPENSSL_INCLUDE_DIR}/../")
ENDIF()
IF( CMAKE_BUILD_TYPE MATCHES "^([Dd][Ee][Bb][Uu][Gg])" )
SET(EXTRA_PACKAGE_COMMANDS ${EXTRA_PACKAGE_COMMANDS} --buildType debug)
ENDIF()
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(EXTRA_PACKAGE_COMMANDS ${EXTRA_PACKAGE_COMMANDS} --architecture x64)
ELSE()
set(EXTRA_PACKAGE_COMMANDS ${EXTRA_PACKAGE_COMMANDS} --architecture x86)
ENDIF()
IF(CHARM_SIGN_INSTALLER)
set(EXTRA_PACKAGE_COMMANDS ${EXTRA_PACKAGE_COMMANDS} --sign)
ENDIF()
ADD_CUSTOM_TARGET(package
COMMAND
${PYTHON_EXECUTABLE}
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/create-win-installer.py"
--installerName "Charm-${Charm_VERSION}.exe"
--applicationFileName "bin/Charm.exe"
--buildDir "${CMAKE_CURRENT_BINARY_DIR}"
--productName Charm
--productVersion "${Charm_VERSION}"
--companyName KDAB
--applicationIcon "${CMAKE_CURRENT_SOURCE_DIR}/Charm/Icons/Charm.ico"
--productLicence "${CMAKE_CURRENT_SOURCE_DIR}/License.txt"
${EXTRA_PACKAGE_COMMANDS}
DEPENDS
${Charm_EXECUTABLE}
VERBATIM)
ENDIF()
ENDIF()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)