forked from vacuum-im/vacuum-im
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
185 lines (161 loc) · 6.1 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
cmake_minimum_required(VERSION 2.8)
project(vacuum-im)
if(POLICY CMP0022)
cmake_policy(SET CMP0022 NEW)
endif()
find_package(Qt4 REQUIRED)
add_custom_target(updatets)
include("src/make/config.cmake")
include("src/translations/languages.cmake")
include_directories("${CMAKE_SOURCE_DIR}/src")
if (APPLE)
file(COPY "resources/menuicons"
DESTINATION "${INSTALL_RESOURCES}"
PATTERN ".svn" EXCLUDE)
else (APPLE)
install(DIRECTORY "resources/menuicons"
DESTINATION "${INSTALL_RESOURCES}"
PATTERN ".svn" EXCLUDE)
endif (APPLE)
include("src/packages/package.cmake")
set(INSTALL_SDK YES CACHE BOOL "Install files needed to build custom plugins")
set(INSTALL_DOCS YES CACHE BOOL "Install documentation (currently it's only AUTHORS, CHANGELOG, README and COPYING)")
set(LANGS "" CACHE STRING "List of languages to build localization for (this variable overrides any of LANG_*)")
set(USED_LANGS "" CACHE INTERNAL "List of languages actually used for generating targets")
add_lang_options()
set(FORCE_BUNDLED_MINIZIP NO CACHE BOOL "Use bundled minizip even if local system have one")
find_library(SYSTEM_ZLIB_FOUND z)
find_library(SYSTEM_IDN_FOUND idn)
find_library(SYSTEM_MINIZIP_FOUND minizip)
find_library(SYSTEM_QTLOCKEDFILE_FOUND QtSolutions_LockedFile-2.4)
if (FORCE_BUNDLED_MINIZIP)
set(SYSTEM_MINIZIP_FOUND NO)
endif (FORCE_BUNDLED_MINIZIP)
if (SYSTEM_ZLIB_FOUND)
add_definitions(-DUSE_SYSTEM_ZLIB)
endif (SYSTEM_ZLIB_FOUND)
if (SYSTEM_IDN_FOUND)
add_definitions(-DUSE_SYSTEM_IDN)
endif (SYSTEM_IDN_FOUND)
if (SYSTEM_MINIZIP_FOUND)
add_definitions(-DUSE_SYSTEM_MINIZIP)
endif (SYSTEM_MINIZIP_FOUND)
if (SYSTEM_QTLOCKEDFILE_FOUND)
add_definitions(-DUSE_SYSTEM_QTLOCKEDFILE)
endif (SYSTEM_QTLOCKEDFILE_FOUND)
if ("${LANGS}" STREQUAL "")
process_lang_options()
else ("${LANGS}" STREQUAL "")
set_enabled_langs("${LANGS}")
endif ("${LANGS}" STREQUAL "")
if (INSTALL_DOCS)
install(FILES "AUTHORS" "CHANGELOG" "README" "COPYING" "TRANSLATORS"
DESTINATION "${INSTALL_DOCUMENTS}")
endif (INSTALL_DOCS)
add_subdirectory(src)
# runtime deps on Windows
if (WIN32)
set(WEBKIT_WITHOUT_PHONON NO CACHE BOOL "Turn this flag ON if you use QtWebKit built without Phonon support")
set(WEBKIT_WITHOUT_XMLPATTERNS NO CACHE BOOL "Turn this flag ON if you use QtWebKit built without QtXmlPatterns")
cpack_add_component_group(libs
DISPLAY_NAME "Shared libraries"
DESCRIPTION "Required libraries that already may be present in your system")
set(QT_LIBS "${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
"${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
"${QT_LIBRARY_DIR}/../bin/QtNetwork4.dll"
"${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
"${QT_LIBRARY_DIR}/../bin/QtWebkit4.dll")
if (NOT WEBKIT_WITHOUT_PHONON)
set(QT_LIBS ${QT_LIBS} "${QT_LIBRARY_DIR}/../bin/phonon4.dll")
endif (NOT WEBKIT_WITHOUT_PHONON)
if (NOT WEBKIT_WITHOUT_XMLPATTERNS)
set(QT_LIBS ${QT_LIBS} "${QT_LIBRARY_DIR}/../bin/QtXmlPatterns4.dll")
endif (NOT WEBKIT_WITHOUT_XMLPATTERNS)
install(FILES ${QT_LIBS}
DESTINATION "${INSTALL_LIBS}"
COMPONENT qt_libs)
install(DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
DESTINATION "${INSTALL_LIBS}"
COMPONENT qt_libs
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*d4.dll" EXCLUDE)
cpack_add_component(qt_libs
DISPLAY_NAME "Qt4 libraries"
DESCRIPTION "May be unchecked if you already have working Qt4 installation"
GROUP libs)
# Qt localization
foreach(LANG ${LOCALIZED_LANGS})
string(SUBSTRING ${LANG} 0 2 SHORTLANG)
install(FILES "${QT_TRANSLATIONS_DIR}/qt_${SHORTLANG}.qm"
DESTINATION "${INSTALL_TRANSLATIONS}/${LANG}"
COMPONENT qt_${LANG})
cpack_add_component(qt_${LANG}
DISPLAY_NAME "Qt4 translation"
GROUP ${LANG}_translation
DEPENDS qt_libs)
endforeach(LANG)
# install(FILES "libeay32.dll" "ssleay32.dll"
# DESTINATION "${INSTALL_LIBS}"
# COMPONENT openssl_libs)
# cpack_add_component(openssl_libs
# DISPLAY_NAME "OpenSSL libraries"
# DESCRIPTION "May be unchecked if you already have OpenSSL installed"
# GROUP libs)
if (MINGW)
install(FILES "mingwm10.dll" "libgcc_s_dw2-1.dll"
DESTINATION "${INSTALL_LIBS}"
COMPONENT mingw_runtime)
cpack_add_component(mingw_runtime
DISPLAY_NAME "MinGW runtime libraries"
DESCRIPTION "May be unchecked if you already have MinGW installed"
GROUP libs)
elseif (MSVC)
# TODO: check these patterns
file(GLOB MSVC_DLLS "msvc*.dll")
file(GLOB MANIFEST "Microsoft.VC*.CRT.manifest")
install(FILES ${MSVC_DLLS} ${MANIFEST}
DESTINATION "${INSTALL_LIBS}"
COMPONENT msvc_runtime)
cpack_add_component(msvc_runtime
DISPLAY_NAME "MSVC runtime libraries"
DESCRIPTION "May be unchecked if you already have MS Visual C++ or it's redistributable package installed"
GROUP libs)
endif (MINGW)
endif (WIN32)
if (APPLE)
set_target_properties(${VACUUM_LOADER_NAME} PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "vacuum"
MACOSX_BUNDLE_INFO_STRING "Vacuum-IM"
MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}"
MACOSX_BUNDLE_ICON_FILE "vacuum"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.jrudevels.vacuum"
MACOSX_BUNDLE_COPYRIGHT "Copyright 2010-2012, Potapov S.A.")
list(APPEND DIRS
${QT_LIBRARY_DIR}
${CMAKE_INSTALL_PREFIX}/${LIBDIR})
install(CODE "
include(BundleUtilities)
file(GLOB_RECURSE PLUGINS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_APP_DIR}/Contents/PlugIns/*.dylib\")
fixup_bundle(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_APP_DIR}\" \"\${PLUGINS}\" \"${DIRS}\")"
COMPONENT xxx-this_should_be_the_last_component_in_lexicographical_order_because_cmake_sucks)
file(COPY vacuum.icns
DESTINATION "${INSTALL_RESOURCES}")
file(WRITE "${CMAKE_BINARY_DIR}/${INSTALL_RESOURCES}/qt.conf" "[Paths]\nPlugins = PlugIns")
file(COPY "${QT_PLUGINS_DIR}/imageformats"
DESTINATION "${INSTALL_PLUGINS}")
file(COPY "${QT_PLUGINS_DIR}/sqldrivers/libqsqlite.dylib"
DESTINATION "${INSTALL_PLUGINS}/sqldrivers")
# Qt localization
foreach(LANG ${LOCALIZED_LANGS})
string(SUBSTRING ${LANG} 0 2 SHORTLANG)
file(COPY "${QT_TRANSLATIONS_DIR}/qt_${SHORTLANG}.qm"
DESTINATION "${INSTALL_TRANSLATIONS}/${LANG}")
endforeach(LANG)
endif (APPLE)
if (INSTALL_SDK)
cpack_add_component(sdk
DISPLAY_NAME "SDK"
DESCRIPTION "Files needed to build custom plugins"
DISABLED)
endif (INSTALL_SDK)