blob: 2be54cb0341257821cbbeb5edceacfccf74e26f9 (
plain)
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
|
cmake_minimum_required(VERSION 2.8.11) # Maybe works with even older versions
project(qmatrixclient)
enable_language(CXX)
include(CheckCXXCompilerFlag)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
# Setup command line parameters for the compiler and linker
CHECK_CXX_COMPILER_FLAG("-Wall" WALL_FLAG_SUPPORTED)
if ( WALL_FLAG_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-Wall($| )")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif ( )
CHECK_CXX_COMPILER_FLAG("-Wpedantic" PEDANTIC_FLAG_SUPPORTED)
if ( PEDANTIC_FLAG_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )pedantic($| )")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
endif ( )
if ( CMAKE_VERSION VERSION_LESS "3.1" )
CHECK_CXX_COMPILER_FLAG("-std=c++11" STD_FLAG_SUPPORTED)
if ( STD_FLAG_SUPPORTED )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif ( STD_FLAG_SUPPORTED )
else ( CMAKE_VERSION VERSION_LESS "3.1" )
set(CMAKE_CXX_STANDARD 11)
endif ( CMAKE_VERSION VERSION_LESS "3.1" )
find_package(Qt5 5.2.1 REQUIRED Network Gui)
get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE)
message( STATUS )
message( STATUS "=============================================================================" )
message( STATUS " libqmatrixclient Build Information" )
message( STATUS "=============================================================================" )
if (CMAKE_BUILD_TYPE)
message( STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif(CMAKE_BUILD_TYPE)
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
if (MATRIX_DOC_PATH AND GTAD_PATH)
message( STATUS "Generating API stubs enabled" )
message( STATUS " Using GTAD at ${GTAD_PATH}" )
message( STATUS " Using CS API files at ${MATRIX_DOC_PATH}/api/client-server" )
endif ()
message( STATUS "=============================================================================" )
message( STATUS )
# Set up source files
set(libqmatrixclient_SRCS
connectiondata.cpp
connection.cpp
logging.cpp
room.cpp
user.cpp
avatar.cpp
settings.cpp
events/event.cpp
events/eventcontent.cpp
events/roommessageevent.cpp
events/roommemberevent.cpp
events/roomavatarevent.cpp
events/typingevent.cpp
events/receiptevent.cpp
jobs/basejob.cpp
jobs/checkauthmethods.cpp
jobs/passwordlogin.cpp
jobs/sendeventjob.cpp
jobs/setroomstatejob.cpp
jobs/postreceiptjob.cpp
jobs/joinroomjob.cpp
jobs/roommessagesjob.cpp
jobs/syncjob.cpp
jobs/mediathumbnailjob.cpp
)
set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server/)
file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR}
${API_DEF_PATH}/*.yaml
${API_DEF_PATH}/definitions/*.yaml
${MATRIX_DOC_PATH}/event-schemas/schema/*
)
if (MATRIX_DOC_PATH AND GTAD_PATH)
add_custom_target(update-api
${GTAD_PATH} --config jobs/gtad.yaml --out jobs/generated
${MATRIX_DOC_PATH}/api/client-server
content-repo.yaml- cas_login_redirect.yaml- cas_login_ticket.yaml-
old_sync.yaml- room_initial_sync.yaml-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
SOURCES jobs/gtad.yaml
jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache
${API_DEFS}
VERBATIM
)
endif()
aux_source_directory(jobs/generated libqmatrixclient_job_SRCS)
set(example_SRCS examples/qmc-example.cpp)
add_library(qmatrixclient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS})
set_property(TARGET qmatrixclient PROPERTY VERSION "0.2.0")
set_property(TARGET qmatrixclient PROPERTY SOVERSION 0 )
target_link_libraries(qmatrixclient Qt5::Core Qt5::Network Qt5::Gui)
add_executable(qmc-example ${example_SRCS})
target_link_libraries(qmc-example Qt5::Core qmatrixclient)
if (WIN32)
install (FILES mime/packages/freedesktop.org.xml
DESTINATION mime/packages)
endif (WIN32)
|