Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 225 lines (185 sloc) 6.606 kb
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
1 cmake_minimum_required(VERSION 2.8.6)
2 project(Jreen)
677bf3f Moving to cmake build system
Sidorov Aleksey authored
3
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
4 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
677bf3f Moving to cmake build system
Sidorov Aleksey authored
5
a0b4631 @dschmidt Use GNUInstallDirs to determine install dirs
dschmidt authored
6 include( GNUInstallDirs )
7
07b74c9 @euroelessar Source refactoring for future binary compatilibity
authored
8 set(CMAKE_JREEN_VERSION_MAJOR 1 CACHE INT "Major Jreen version number" FORCE)
53924ba @euroelessar Release 1.2.0
authored
9 set(CMAKE_JREEN_VERSION_MINOR 2 CACHE INT "Minor Jreen version number" FORCE)
08734ed @euroelessar Release 1.2.1
authored
10 set(CMAKE_JREEN_VERSION_PATCH 1 CACHE INT "Release Jreen version number" FORCE)
936ff24 @euroelessar Fixed #776133
authored
11 set(CMAKE_JREEN_VERSION_STRING "${CMAKE_JREEN_VERSION_MAJOR}.${CMAKE_JREEN_VERSION_MINOR}.${CMAKE_JREEN_VERSION_PATCH}" CACHE STRING "Jreen version string" FORCE)
677bf3f Moving to cmake build system
Sidorov Aleksey authored
12
13 # Search for source and headers in source directory (non-recursive)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
14 file(GLOB_RECURSE SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
677bf3f Moving to cmake build system
Sidorov Aleksey authored
15
831c7e6 @euroelessar Fixed compilation with upstream qbs
authored
16 option(JREEN_FORCE_QT4 "Force using of Qt4 in Jreen" off)
a53b2d8 @euroelessar Forced -qt5 suffix for Qt5 version
authored
17 set(JREEN_SUFFIX "")
643d5aa @euroelessar Install headers to Qt-specific version of jreen
authored
18 set(JREEN_INCLUDE_PATH "")
727b71c @euroelessar Fixed Requires section for libjreen-qt5
authored
19 set(JREEN_QT_MIDDLE "")
831c7e6 @euroelessar Fixed compilation with upstream qbs
authored
20
21 if(NOT JREEN_FORCE_QT4)
22 find_package(Qt5Core QUIET)
23 endif()
24
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
25 if(Qt5Core_DIR)
26 find_package(Qt5Network QUIET)
27 message(STATUS "Found Qt5!")
a53b2d8 @euroelessar Forced -qt5 suffix for Qt5 version
authored
28 set(JREEN_SUFFIX "-qt5")
643d5aa @euroelessar Install headers to Qt-specific version of jreen
authored
29 set(JREEN_INCLUDE_PATH "jreen-qt5")
727b71c @euroelessar Fixed Requires section for libjreen-qt5
authored
30 set(JREEN_QT_MIDDLE "5")
677bf3f Moving to cmake build system
Sidorov Aleksey authored
31
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
32 add_definitions("-DQT_DISABLE_DEPRECATED_BEFORE=0")
33 list(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/sjdns.cpp")
34 else()
35 message(STATUS "Could not find Qt5, so let's use Qt4...")
643d5aa @euroelessar Install headers to Qt-specific version of jreen
authored
36 set(JREEN_INCLUDE_PATH "jreen-qt4")
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
37
38 find_package(Qt4 4.6.0 COMPONENTS QtCore QtNetwork REQUIRED)
677bf3f Moving to cmake build system
Sidorov Aleksey authored
39
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
40 macro(qt5_use_modules)
41 endmacro()
42
43 include(${QT_USE_FILE})
8533049 @euroelessar Fixed stream feature configuration behaviour
authored
44 endif()
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
45
46 if(JREEN_BUILD_INTERNAL)
47 add_definitions("-DJ_BUILD_INTERNAL")
48 endif()
49 find_package(PkgConfig)
50 find_package(GSASL REQUIRED)
2165fac @euroelessar Initial Jingle support
authored
51
52 pkg_search_module(SPEEX speex)
53 if(NOT SPEEX_FOUND)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
54 message(STATUS "Could not find speex library.")
55 else()
56 message(STATUS "Speex library is found.")
57 include_directories(${SPEEX_INCLUDE_DIRS})
58 add_definitions("-DJREEN_HAVE_SPEEX=1")
59 endif()
170a70f @AlexeyProkhin FindZLIB is broken on Ubuntu, so find zlib using pkg-config
AlexeyProkhin authored
60
61 # FindZLIB is broken on Ubuntu, so find the library using pkg-config
7fbe3ab Find zlib spike fix for other platforms
Sidorov Aleksey authored
62 if(LINUX)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
63 find_package(PkgConfig)
64 pkg_search_module(ZLIB_PKGCONF REQUIRED zlib)
65
66 find_path(ZLIB_INCLUDE_DIR
67 NAMES zlib.h
68 PATHS ${ZLIB_PKGCONF_INCLUDE_DIRS}
69 )
70
71 find_library(ZLIB_LIBRARIES
72 NAMES z
73 PATHS ${ZLIB_PKGCONF_LIBRARY_DIRS}
74 )
75
76 if(NOT ZLIB_INCLUDE_DIR)
77 message(SEND_ERROR "Could not find zlib includes.")
78 endif(NOT ZLIB_INCLUDE_DIR)
79
80 if(NOT ZLIB_LIBRARIES)
81 message(SEND_ERROR "Could not find zlib library.")
82 endif(NOT ZLIB_LIBRARIES)
c4dc833 Find zlib fix
Sidorov Aleksey authored
83 else()
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
84 find_package(ZLIB REQUIRED)
7fbe3ab Find zlib spike fix for other platforms
Sidorov Aleksey authored
85 endif()
170a70f @AlexeyProkhin FindZLIB is broken on Ubuntu, so find zlib using pkg-config
AlexeyProkhin authored
86
677bf3f Moving to cmake build system
Sidorov Aleksey authored
87 # Add include directories
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
88 include_directories(.
89 ${CMAKE_CURRENT_BINARY_DIR}
90 3rdparty
91 ${GSASL_INCLUDE_DIRS}
ca3b569 @torkve Fix gsasl include
torkve authored
92 ${GSASL_INCLUDEDIR}
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
93 ${ZLIB_INCLUDE_DIR}
677bf3f Moving to cmake build system
Sidorov Aleksey authored
94 )
95
07f5e56 @euroelessar Added ability to use system jdns
authored
96 LIST(APPEND SRC ${3RD_PARTY_SRC_C})
97 LIST(APPEND SRC ${3RD_PARTY_SRC})
98
e3f45cc @euroelessar Compilation fix
authored
99 # Ice support
014118a @euroelessar Jingle implementation is moved to experimental subdirectory
authored
100 option(JREEN_USE_IRISICE "Use ICE from IRIS" OFF)
101 if (JREEN_USE_IRISICE)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
102 file(GLOB_RECURSE ICESUPPORT_SRC "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/icesupport/*.cpp")
103 file(GLOB_RECURSE ICESUPPORT_SRC_C "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/icesupport/*.c")
104 list(APPEND SRC ${ICESUPPORT_SRC})
105 list(APPEND SRC ${ICESUPPORT_SRC_C})
106 add_definitions("-DHAVE_IRISICE")
014118a @euroelessar Jingle implementation is moved to experimental subdirectory
authored
107 endif()
e3f45cc @euroelessar Compilation fix
authored
108
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
109 if(NOT Qt5Core_DIR)
110 option(JREEN_USE_SYSTEM_JDNS "Use system JDNS" OFF)
111
112 if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/jdns")
113 set(JREEN_USE_SYSTEM_JDNS ON)
114 endif()
115
116 if(JREEN_USE_SYSTEM_JDNS)
117 # For Linux it was found already before at line 29
118 if(NOT LINUX)
119 find_package(PkgConfig)
120 endif()
121 pkg_search_module(JDNS REQUIRED qjdns)
122 include_directories(${JDNS_INCLUDE_DIR})
123 list(APPEND EXTRA_LIBS ${JDNS_LIBRARIES})
124 else()
125 file(GLOB_RECURSE JDNS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/jdns/*.cpp")
126 file(GLOB_RECURSE JDNS_SRC_C "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/jdns/*.c")
127 list(APPEND SRC ${JDNS_SRC})
128 list(APPEND SRC ${JDNS_SRC_C})
129 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty")
130 endif()
07f5e56 @euroelessar Added ability to use system jdns
authored
131 endif()
132
677bf3f Moving to cmake build system
Sidorov Aleksey authored
133 # This project will generate library
054d1ea Compile fix for Symbian. Fixed setServer on client
Sidorov Aleksey authored
134
135 if(SYMBIAN)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
136 set(JREEN_BUILD_TYPE STATIC)
054d1ea Compile fix for Symbian. Fixed setServer on client
Sidorov Aleksey authored
137 else()
f7281d6 New dns srvinfo class instead ugly jdns
Sidorov Aleksey authored
138 set(JREEN_BUILD_TYPE SHARED)
054d1ea Compile fix for Symbian. Fixed setServer on client
Sidorov Aleksey authored
139 endif()
140
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
141 ADD_LIBRARY(jreen${JREEN_SUFFIX} ${JREEN_BUILD_TYPE} ${SRC} ${MOC_SRC})
677bf3f Moving to cmake build system
Sidorov Aleksey authored
142
143 #compiler flags
0a43a84 Fixed PIC
Sidorov Aleksey authored
144 #fixme add macro to clang
677bf3f Moving to cmake build system
Sidorov Aleksey authored
145 if(CMAKE_COMPILER_IS_GNUCXX)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
146 if(SYMBIAN)
054d1ea Compile fix for Symbian. Fixed setServer on client
Sidorov Aleksey authored
147 #disable stupid warnings
148 ADD_DEFINITIONS("-w")
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
149 else()
054d1ea Compile fix for Symbian. Fixed setServer on client
Sidorov Aleksey authored
150 ADD_DEFINITIONS("-Wall -Wextra" ) #add -Werror
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
151 ENDif()
152 if(NOT WIN32)
23e09a9 Presence factory now works!
Sidorov Aleksey authored
153 ADD_DEFINITIONS("-fvisibility=hidden" )
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
154 endif(NOT WIN32)
677bf3f Moving to cmake build system
Sidorov Aleksey authored
155 elseif(MSVC)
b2b1a33 Error factory
Sidorov Aleksey authored
156 ADD_DEFINITIONS("/W3" )
677bf3f Moving to cmake build system
Sidorov Aleksey authored
157 endif()
936ff24 @euroelessar Fixed #776133
authored
158
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
159 set_target_properties(jreen${JREEN_SUFFIX} PROPERTIES
936ff24 @euroelessar Fixed #776133
authored
160 VERSION ${CMAKE_JREEN_VERSION_STRING}
161 SOVERSION ${CMAKE_JREEN_VERSION_MAJOR}
162 DEFINE_SYMBOL J_BUILD_LIBRARY
163 )
677bf3f Moving to cmake build system
Sidorov Aleksey authored
164
165 file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/jreen" )
5193fc6 @euroelessar Fixed installing of Jingle headers
authored
166 file(GLOB_RECURSE JREEN_INCLUDE_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
167
88dcd44 Fixed headers
Sidorov Aleksey authored
168 foreach(header ${JREEN_INCLUDE_HEADERS})
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
169 if(NOT ${header} MATCHES ".*_p\\.h")
170 if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/include/jreen/${header}")
677bf3f Moving to cmake build system
Sidorov Aleksey authored
171 file( WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/jreen/${header}"
5a3b3ca fix include generator
Sidorov Aleksey authored
172 "#include \"${CMAKE_CURRENT_SOURCE_DIR}/src/${header}\"
677bf3f Moving to cmake build system
Sidorov Aleksey authored
173 "
174 )
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
175 endif(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/include/jreen/${header}")
b73e382 @euroelessar Fixed experimental headers installation
authored
176 get_filename_component(headerPath ${header} PATH)
177 install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/${header}"
643d5aa @euroelessar Install headers to Qt-specific version of jreen
authored
178 DESTINATION include/${JREEN_INCLUDE_PATH}/jreen/${headerPath}
b73e382 @euroelessar Fixed experimental headers installation
authored
179 COMPONENT jreenDevel
180 )
677bf3f Moving to cmake build system
Sidorov Aleksey authored
181 endif(NOT ${header} MATCHES ".*_p\\.h")
182 endforeach(header)
183
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
184 set(JREEN_LIBRARIES jreen${JREEN_SUFFIX} CACHE INTERNAL "" )
01c0c66 @euroelessar Fixed variable name for jreen include dir
authored
185 set(JREEN_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include" CACHE INTERNAL "")
677bf3f Moving to cmake build system
Sidorov Aleksey authored
186
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
187 if(WIN32)
188 list(APPEND EXTRA_LIBS ws2_32)
189 endif()
190
191 if(SPEEX_FOUND)
192 list(APPEND EXTRA_LIBS ${SPEEX_LIBRARIES} )
193 endif()
194
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
195 target_link_libraries(jreen${JREEN_SUFFIX}
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
196 ${QT_LIBRARIES}
197 ${GSASL_LIBRARIES}
198 ${ZLIB_LIBRARIES}
199 ${EXTRA_LIBS}
f7281d6 New dns srvinfo class instead ugly jdns
Sidorov Aleksey authored
200 )
677bf3f Moving to cmake build system
Sidorov Aleksey authored
201
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
202 set_target_properties(jreen${JREEN_SUFFIX} PROPERTIES AUTOMOC TRUE)
203 qt5_use_modules(jreen${JREEN_SUFFIX} Core Network)
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
204
634242a @euroelessar Added package config
authored
205 # Install package config file
206 if(NOT WIN32)
207 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libjreen.pc.cmake
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
208 ${CMAKE_CURRENT_BINARY_DIR}/libjreen${JREEN_SUFFIX}.pc
634242a @euroelessar Added package config
authored
209 )
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
210 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjreen${JREEN_SUFFIX}.pc
a0b4631 @dschmidt Use GNUInstallDirs to determine install dirs
dschmidt authored
211 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
634242a @euroelessar Added package config
authored
212 )
c341ac3 @euroelessar Added Qt5 build support for cmake
authored
213 endif()
634242a @euroelessar Added package config
authored
214
a6c44b9 @euroelessar Added ability to specify library name's suffix
authored
215 install( TARGETS jreen${JREEN_SUFFIX}
677bf3f Moving to cmake build system
Sidorov Aleksey authored
216 RUNTIME DESTINATION bin
217 COMPONENT jreen
a0b4631 @dschmidt Use GNUInstallDirs to determine install dirs
dschmidt authored
218 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
677bf3f Moving to cmake build system
Sidorov Aleksey authored
219 COMPONENT jreen
a0b4631 @dschmidt Use GNUInstallDirs to determine install dirs
dschmidt authored
220 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
677bf3f Moving to cmake build system
Sidorov Aleksey authored
221 COMPONENT jreenDevel
222 BUNDLE DESTINATION library
223 )
224
Something went wrong with that request. Please try again.