This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
123 lines (96 loc) · 3.54 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
cmake_minimum_required( VERSION 2.8.12 )
project ( drawpile C CXX )
find_package(ECM REQUIRED NOMODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config" ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
### generic info
set ( WEBSITE "https://drawpile.net/" )
set ( DRAWPILE_VERSION "2.1.16" )
### protocol versions
# see doc/protocol.md for protocol version history
set ( DRAWPILE_PROTO_SERVER_VERSION 4 )
set ( DRAWPILE_PROTO_MAJOR_VERSION 22 )
set ( DRAWPILE_PROTO_MINOR_VERSION 2 )
set ( DRAWPILE_PROTO_DEFAULT_PORT 27750 )
###
include ( "config/Names.cmake" )
include(KDEInstallDirs)
### options
option ( CLIENT "Compile client" ON )
option ( SERVER "Compile dedicated server" ON )
option ( SERVERGUI "Enable server GUI" ON )
option ( THICKSRV "Compile dedicated thick server (EXPERIMENTAL)" OFF )
option ( TOOLS "Compile extra tools" OFF )
option ( INSTALL_DOC "Install documents" ON )
option ( INITSYS "Init system integration" "systemd" )
option ( TESTS "Build unit tests" OFF )
option ( KIS_TABLET "Enable customized Windows tablet support code" OFF )
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
message(STATUS "Use -DCMAKE_BUILD_TYPE=debug to enable debugging")
set(CMAKE_BUILD_TYPE "Release")
endif()
message ( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
# Include some nice macros
include ( "config/Macros.cmake" )
if(TESTS)
enable_testing()
include("config/Tests.cmake")
endif(TESTS)
### binary and library output ###
set ( EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" )
set ( LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib" )
find_package ( PkgConfig )
if ( PKGCONFIG_FOUND )
if ( INITSYS STREQUAL "systemd" )
pkg_check_modules ( SYSTEMD "libsystemd" )
endif ()
endif ( PKGCONFIG_FOUND )
### Cmake policies
if(POLICY CMP0071)
# Don't run automoc and autouic on generated files (ui_*.h, qrc_*.cpp)
cmake_policy(SET CMP0071 OLD)
endif()
### General compiler flags
### Compiler-specific C++ 11 activation ###
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.7)
# GCC < 4.7
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
else ()
# GCC >= 4.7 (set instead of append, because it needs to be first)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang++
set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# Microsoft Visual C++
else ()
# Other C++ compilers
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif ()
### Set deployment target (OSX specific)
if ( APPLE )
set(CMAKE_CXX_FLAGS "-mmacosx-version-min=10.10 ${CMAKE_CXX_FLAGS}")
endif (APPLE)
### Output config.h ###
configure_file ( config/config.h.cmake "${CMAKE_BINARY_DIR}/config.h" )
add_definitions ( -DHAVE_CONFIG_H )
# Tell the compiler where to find config.h
include_directories ( "${CMAKE_BINARY_DIR}" )
# scan sub-directories
add_subdirectory( src )
if ( INSTALL_DOC )
add_subdirectory( doc )
endif ( )
add_subdirectory( desktop )
if ( CMAKE_BUILD_TYPE STREQUAL Debug )
message ( STATUS "CXX flags (debug): ${CMAKE_CXX_FLAGS_DEBUG}")
elseif ( CMAKE_BUILD_TYPE STREQUAL Release )
message ( STATUS "CXX flags (release): ${CMAKE_CXX_FLAGS_RELEASE}")
endif ( )