-
Notifications
You must be signed in to change notification settings - Fork 185
/
CMakeLists.txt
150 lines (125 loc) · 4.77 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
project(pidgin-lwqq)
cmake_minimum_required(VERSION 2.6)
set(VERSION_MAJOR "0")
set(VERSION_MINOR "6")
set(VERSION_PATCH "1")
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH}
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX 1)
endif()
if(LINUX)
set(SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share")
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBPURPLE REQUIRED purple)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(LWQQ REQUIRED lwqq>=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
#recommand libcurl>=7.22.0
exec_program("pkg-config --variable=plugindir purple 2>/dev/null"
OUTPUT_VARIABLE LIB_INSTALL_DIR)
exec_program("pkg-config --variable=datadir purple 2>/dev/null"
OUTPUT_VARIABLE PURPLE_DATADIR)
set(PURPLE_DATADIR "${PURPLE_DATADIR}/")
exec_program("pkg-config --modversion purple 2>/dev/null"
OUTPUT_VARIABLE PURPLE_VERSION)
set(OPEN_PROG "xdg-open")
endif()
if(APPLE)
set(CMAKE_PREFIX_PATH
"${PROJECT_SOURCE_DIR}/../adium/Frameworks/" )
find_library(LIBPURPLE NAMES "libpurple" PATHS "${CMAKE_PERFIX_PATH}")
find_library(GLIB NAMES "libglib" PATHS "${CMAKE_PERFIX_PATH}")
set(OPEN_PROG "open")
endif()
if(WIN32)
set(LIB_INSTALL_DIR "plugins")
set(PURPLE_DATADIR "")
set(EV_FOUND Off)
set(SHARE_DIR "share")
set(CMAKE_PREFIX_PATH
"${WIN32_LIBS_DIR}/../pidgin/libpurple" )
find_package(LibPurple REQUIRED)
set(CMAKE_PREFIX_PATH
"${WIN32_LIBS_DIR}/glib_2.28.8-1_win32/include"
"${WIN32_LIBS_DIR}/glib_2.28.8-1_win32/lib"
"${WIN32_LIBS_DIR}/gtk_2_0-2.14/include/glib-2.0"
"${WIN32_LIBS_DIR}/gtk_2_0-2.14/lib"
)
find_package(GLIB2 REQUIRED)
set(CMAKE_PREFIX_PATH
"${WIN32_LIBS_DIR}/../lwqq/lib"
"${WIN32_LIBS_DIR}/../lwqq/build"
"${WIN32_LIBS_DIR}/../lwqq/build/lib"
)
find_package(Lwqq REQUIRED)
get_filename_component( MinGW_Path ${CMAKE_CXX_COMPILER} PATH )
set(OPEN_PROG "start")
endif(WIN32)
add_definitions(-Wall)
message("libpurple version:${PURPLE_VERSION}")
if(PURPLE_VERSION VERSION_LESS "2.8")
message("libpurple version outdate")
add_definitions(-DPURPLE_OUTDATE=1)
endif(PURPLE_VERSION VERSION_LESS "2.8")
add_definitions(-DINST_PREFIX="${CMAKE_INSTALL_PREFIX}")
option(NLS "Native language support" On)
if(NLS)
#find_package(Gettext)
include(cmake/Gettext.cmake)
endif(NLS)
if(NLS AND GETTEXT_FOUND)
set(ENABLE_NLS true)
else()
set(ENABLE_NLS false)
endif()
option(REDIRECT_DEBUG "Redirect debug output to pidgin" On)
set(package pidgin-lwqq)
set(localedir ${SHARE_DIR}/locale)
set(datadir ${SHARE_DIR}/lwqq)
set(version "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/src/config.h)
add_subdirectory(src)
add_subdirectory(res)
add_subdirectory(po)
message( "===============pidgin-lwqq flags===============")
message(STATUS "Native Language Support : ${ENABLE_NLS}")
message(STATUS "Install Path : ${LIB_INSTALL_DIR}")
message( "===============================================")
option(UOA "ubuntu online account support" Off)
if(UOA)
pkg_check_modules(AP REQUIRED account-plugin)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
EXEC_PROGRAM("pkg-config --variable=provider_plugindir account-plugin 2>/dev/null"
OUTPUT_VARIABLE PLUGIN_INSTALL_DIR)
#set the rpath for account-plugin.
#since it works so we don't care about detail.
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH ${PLUGIN_INSTALL_DIR})
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_subdirectory(ubuntu-online-account)
endif(UOA)
set(CPACK_PACKAGE_NAME "pidgin-lwqq")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A pidgin plugin for QQ protocol support, based on lwqq")
set(CPACK_PACKAGE_VENDOR "xiehuc")
set(CPACK_PACKAGE_DESCRIPTION "pidgin-lwqq is a pidgin plugin for QQ protocol support. It's based on the lwqq library which uses the webqq.")
set(CPACK_PACKAGE_CONTACT "edhelas@movim.eu")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "pidgin")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "liblwqq (>=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${version}")
set(ACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${version}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Jaussoin Timothée") #required
if(WIN32)
set(CPACK_GENERATOR "ZIP")
include(InstallRequiredSystemLibraries)
endif()
if(LINUX)
set(CPACK_GENERATOR "DEB")
endif()
include(CPack)