-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
100 lines (79 loc) · 3.91 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
cmake_minimum_required(VERSION 3.5)
file(READ .version version)
project(qmattermost VERSION ${version} LANGUAGES CXX)
configure_file(build-config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/sources/build-config.h)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -g -ggdb")
set(APPID "mattermost-qt")
# 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()
option(BUILD_MULTIMEDIA "Enable Multimedia" OFF)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS Network REQUIRED)
find_package(Qt5 COMPONENTS WebSockets REQUIRED)
if(BUILD_MULTIMEDIA)
find_package(Qt5 COMPONENTS Multimedia REQUIRED)
find_package(Qt5 COMPONENTS MultimediaWidgets REQUIRED)
endif()
include_directories(${Qt5Network_INCLUDE_DIRS} sources/)
if(ANDROID)
add_library(mattermost-client SHARED
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
logindialog.cpp
logindialog.h
logindialog.ui
qmattermostbackend.cpp
qmattermostbackend.h
resource.qrc
)
else()
file(GLOB_RECURSE SOURCES sources/*.cpp)
add_executable(${APPID}
${SOURCES}
resource.qrc
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set_property(TARGET ${APPID} PROPERTY WIN32_EXECUTABLE true)
endif()
endif()
add_subdirectory (tools)
target_link_libraries (${APPID} PRIVATE Qt5::Widgets Qt5::Network Qt5::WebSockets)
if(UNIX)
include(GNUInstallDirs)
set(SRC_ICONS_DIR "resources/icons/application-dark")
set(SRC_ICON_PREFIX "${APPID}-dark")
set(DST_ICONS_DIR "${CMAKE_INSTALL_DATAROOTDIR}/icons")
install (TARGETS "${APPID}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-16.png" DESTINATION "${DST_ICONS_DIR}/hicolor/16x16/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-32.png" DESTINATION "${DST_ICONS_DIR}/hicolor/32x32/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-64.png" DESTINATION "${DST_ICONS_DIR}/hicolor/64x64/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-128.png" DESTINATION "${DST_ICONS_DIR}/hicolor/128x128/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-256.png" DESTINATION "${DST_ICONS_DIR}/hicolor/256x256/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-512.png" DESTINATION "${DST_ICONS_DIR}/hicolor/512x512/apps" RENAME "${APPID}.png")
install (FILES "${SRC_ICONS_DIR}/${SRC_ICON_PREFIX}-1024.png" DESTINATION "${DST_ICONS_DIR}/hicolor/1024x1024/apps" RENAME "${APPID}.png")
install (FILES "resources/svg/${SRC_ICON_PREFIX}.svg" DESTINATION "${DST_ICONS_DIR}/hicolor/scalable/apps" RENAME "${APPID}.svg")
configure_file("resources/mattermost-qt.desktop.in" "resources/mattermost-qt.desktop" @ONLY)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/mattermost-qt.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" RENAME "${APPID}.desktop")
configure_file("resources/mattermost-qt.appdata.xml.in" "resources/mattermost-qt.appdata.xml" @ONLY)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/mattermost-qt.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" RENAME "${APPID}.appdata.xml")
endif()
if(BUILD_MULTIMEDIA)
target_link_libraries(qmattermost PRIVATE Qt5::Multimedia Qt5::MultimediaWidgets)
endif()