This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
CMakeLists.txt
120 lines (96 loc) · 3.2 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
project( zulip )
cmake_minimum_required( VERSION 2.8.6 )
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
set( ZULIP_VERSION_MAJOR 0 )
set( ZULIP_VERSION_MINOR 5 )
set( ZULIP_VERSION_PATCH 1 )
set( ZULIP_VERSION ${ZULIP_VERSION_MAJOR}.${ZULIP_VERSION_MINOR}.${ZULIP_VERSION_PATCH} )
set( ZULIP_VERSION_SHORT "${ZULIP_VERSION}" )
set( ZULIP_APPLICATION_NAME "Zulip")
# enforce proper symbol exporting on all platforms
add_definitions( "-fvisibility=hidden" )
# enforce using constBegin, constEnd for const-iterators
add_definitions( "-DQT_STRICT_ITERATORS" )
# make predefined install dirs available everywhere
include( GNUInstallDirs )
# Allow building with Qt5
option(BUILD_WITH_QT5 "Try to find Qt5 and build with it" OFF)
if (APPLE)
set(QT_USE_QTWEBKIT FALSE)
set(QT_COMPONENTS QtCore QtGui QtNetwork QtSvg QtXml)
else()
set(QT_USE_QTWEBKIT TRUE)
set(QT_COMPONENTS QtCore QtGui QtNetwork QtSvg QtXml QtWebkit)
if (NOT WIN32)
set(QT_COMPONENTS ${QT_COMPONENTS} QtDBus)
endif()
endif()
# Generates windows installer with NSIS
INCLUDE( ZulipCPack.cmake )
# Dependencies
if(BUILD_WITH_QT5)
find_package(Qt5Core QUIET)
if( Qt5Core_DIR )
find_package(Qt5Widgets QUIET)
find_package(Qt5Network QUIET)
message(STATUS "Building against Qt5")
macro(qt_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
include_directories(${Qt5Core_INCLUDES})
include_directories(${Qt5Widgets_INCLUDES})
add_definitions(${Qt5Widgets_DEFINITIONS})
set(QT5_BUILD ON)
endif()
else()
find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake qmake-mac)
find_package( Qt4 COMPONENTS ${QT_COMPONENTS} REQUIRED )
macro(qt_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
include( ${QT_USE_FILE} )
add_definitions( ${QT_DEFINITIONS} )
set(QT4_BUILD ON)
endif()
if(NOT APPLE AND NOT WIN32)
if(QT4_BUILD)
find_package(Phonon 4.6.0 REQUIRED)
else()
find_package(Qt5DBus REQUIRED)
endif()
endif()
# Configure Qt
set( QT_USE_QTNETWORK TRUE )
# Output directories
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# Flag controlling whether this is a local server + SSO build or not
set( SSO_BUILD OFF CACHE BOOL "Whether or not to make the desktop app use the SSO login page")
if( SSO_BUILD )
message("Building SSO version of Zulip Desktop")
endif()
# make uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
add_subdirectory( thirdparty )
add_subdirectory( src )
if (APPLE)
add_subdirectory(src/mac/launchhelper)
endif()