forked from KDE/kipi-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
288 lines (222 loc) · 10.7 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#
# Copyright (c) 2010-2017 by Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
project(kipi-plugins)
message(STATUS "----------------------------------------------------------------------------------")
message(STATUS "Starting CMake configuration for: ${PROJECT_NAME}")
# =======================================================
# Information to update before to release this package.
# kipi-plugins version
set(KIPIPLUGINS_MAJOR_VERSION "5")
set(KIPIPLUGINS_MINOR_VERSION "5")
set(KIPIPLUGINS_PATCH_VERSION "0")
# Suffix to add at end of version string. Usual values are:
# "-git" : alpha code unstable from git. Do not use in production
# "-beta1" : beta1 release.
# "-beta2" : beta2 release.
# "-beta3" : beta3 release.
# "-rc" : release candidate.
# "" : final relase. Can be used in production.
set(KIPIPLUGINS_SUFFIX_VERSION "")
# =======================================================
# Set env. variables accordinly.
set(KIPIPLUGINS_VERSION_STRING
"${KIPIPLUGINS_MAJOR_VERSION}.${KIPIPLUGINS_MINOR_VERSION}.${KIPIPLUGINS_PATCH_VERSION}${KIPIPLUGINS_SUFFIX_VERSION}"
)
# NOTE: This string is used to set libkipiplugins SO version ID
set(KIPIPLUGINS_LIB_SO_VERSION_STRING
"${KIPIPLUGINS_MAJOR_VERSION}.${KIPIPLUGINS_MINOR_VERSION}.${KIPIPLUGINS_PATCH_VERSION}"
)
# =======================================================
set(CMAKE_MIN_VERSION "3.0.0")
set(ECM_MIN_VERSION "1.5.0")
set(KF5_MIN_VERSION "5.1.0")
set(QT_MIN_VERSION "5.2.0")
set(KIPI_MIN_VERSION "5.0.0")
cmake_minimum_required(VERSION ${CMAKE_MIN_VERSION})
############## ECM setup ######################
find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${kipi-plugins_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
# Cmake macros
include(GenerateExportHeader)
include(CheckFunctionExists)
include(FeatureSummary)
# ECM macros
include(ECMOptionalAddSubdirectory)
include(ECMAddTests)
include(ECMMarkNonGuiExecutable)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(ECMInstallIcons)
include(ECMAddAppIcon)
# KDE macros
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)
include(KDECompilerSettings)
# Local macros
include(MacroUtils)
include(MacroLocalLibs)
##########################################################################
option(ENABLE_KIO "Build Kipi-plugins with KIO support (default=ON)" ON)
############## Find Packages ###################
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
Core
Widgets
PrintSupport
Gui
Xml
XmlPatterns
Svg
Concurrent
Network
)
if(BUILD_TESTING)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
Test)
endif()
find_package(KF5 ${KF5_MIN_VERSION}
REQUIRED COMPONENTS
Config
WindowSystem
XmlGui
I18n
)
find_package(KF5 ${KF5_MIN_VERSION}
OPTIONAL_COMPONENTS
Archive # for FlashExport
)
if(ENABLE_KIO)
find_package(KF5 ${KF5_MIN_VERSION}
OPTIONAL_COMPONENTS
KIO # Some kipi-plugins depends of KIO indeep.
)
# Check if KIO have been compiled with KIOWidgets. Some tools rely only to KIO core, some other with KIOWidgets too..
if(KF5KIO_FOUND)
get_target_property(KIOWidgets_INCLUDE_DIRS KF5::KIOWidgets INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "KF5::KIOWidgets include dirs: ${KIOWidgets_INCLUDE_DIRS}")
if(NOT KIOWidgets_INCLUDE_DIRS)
message(STATUS "KF5::KIOWidgets not available in shared KIO library. Some tools will not be compiled.")
set(KF5KIOWidgets_FOUND FALSE)
else()
set(KF5KIOWidgets_FOUND TRUE)
endif()
endif()
endif()
# Dependencies detection required by all plugins
DETECT_LIBKIPI(${KIPI_MIN_VERSION})
if(KF5Kipi_FOUND)
# -- Optional dependencies detection required by some plugins -------------------------------------
DETECT_LIBMEDIAWIKI(5.0.0) # For Mediawiki.
DETECT_LIBKVKONTAKTE(4.70.0) # For VKontakte.
# ==================================================================================================
# Log messages
message(STATUS "")
message(STATUS "----------------------------------------------------------------------------------")
message(STATUS " ${PROJECT_NAME} ${KIPIPLUGINS_VERSION_STRING} dependencies results <http://www.digikam.org>")
message(STATUS "")
# Require shared libraries results.
PRINT_LIBRARY_STATUS("libqt" "http://www.qtsoftware.com" "(version >= ${QT_MIN_VERSION})" Qt5_FOUND)
PRINT_LIBRARY_STATUS("libkde" "http://www.kde.org" "(version >= ${KF5_MIN_VERSION})" KF5_FOUND)
PRINT_LIBRARY_STATUS("libkipi" "https://projects.kde.org/projects/kde/kdegraphics/libs/libkipi" "(version >= ${KIPI_MIN_VERSION}))" KF5Kipi_FOUND)
# Optional shared libraries results.
PRINT_OPTIONAL_LIBRARY_STATUS("libkio" "https://projects.kde.org/projects/frameworks/kio" "(version >= ${KF5_MIN_VERSION})" "Kipi-plugins will be compiled without libkio support." KF5KIO_FOUND)
PRINT_OPTIONAL_LIBRARY_STATUS("libkarchive" "https://projects.kde.org/projects/frameworks/karchive" "(version >= ${KF5_MIN_VERSION})" "Kipi-plugins will be compiled without libkarchive support." KF5Archive_FOUND)
PRINT_OPTIONAL_LIBRARY_STATUS("libmediawiki" "https://projects.kde.org/projects/extragear/libs/libmediawiki" "(version >= ${KF5_MIN_VERSION})" "Kipi-plugins will be compiled without libmediawiki support." KF5MediaWiki_FOUND)
PRINT_OPTIONAL_LIBRARY_STATUS("libkvkontakte" "https://projects.kde.org/projects/extragear/libs/libkvkontakte" "(version >= 4.70.0)" "Kipi-plugins will be compiled without libkvkontakte support." KF5Vkontakte_FOUND)
# Optional plugins results ----------------------------------------------------------------------------
message(STATUS "")
if(Qt5_FOUND AND KF5_FOUND AND KF5Kipi_FOUND)
set(KIPI_COMPILE_MESSAGE "kipi-plugins will be compiled")
FILL_WITH_DOTS(KIPI_COMPILE_MESSAGE)
message(STATUS " ${KIPI_COMPILE_MESSAGE} YES")
set(KIPIPLUGINS_CAN_BE_COMPILED true)
else()
message(FATAL_ERROR " kipi-plugins will not be compiled! Look README file for more details about dependencies...")
set(KIPIPLUGINS_CAN_BE_COMPILED false)
endif()
PRINT_COMPONENT_COMPILE_STATUS("VKontakte" KF5Vkontakte_FOUND)
PRINT_COMPONENT_COMPILE_STATUS("Mediawiki" KF5MediaWiki_FOUND)
PRINT_COMPONENT_COMPILE_STATUS("FlashExport" KF5Archive_FOUND)
# ==================================================================================================
if(KIPIPLUGINS_CAN_BE_COMPILED)
# ==================================================================================================
# Create git version header
# We only do this IF we are in a .git dir
find_file(GIT_MARKER entries PATHS ${CMAKE_SOURCE_DIR}/.git)
if(NOT GIT_MARKER)
set (GIT_MARKER ${CMAKE_SOURCE_DIR}/CMakeLists.txt) # Dummy file
endif()
# Add a custom command to drive the git script whenever the git entries
# file changes.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/gitscript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/gitscript.cmake"
@ONLY)
# Add a custom target to drive the custom command.
add_custom_target(kipiplugins-gitversion
ALL COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/gitscript.cmake")
# ==================================================================================================
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common/libkipiplugins
${CMAKE_CURRENT_BINARY_DIR}/common/libkipiplugins
${CMAKE_CURRENT_SOURCE_DIR}/common/libkipiplugins/dialogs
${CMAKE_CURRENT_SOURCE_DIR}/common/libkipiplugins/widgets
${CMAKE_CURRENT_SOURCE_DIR}/common/libkipiplugins/tools
${CMAKE_CURRENT_SOURCE_DIR}/common/libkipiplugins/o2/src
${KF5Kipi_INCLUDE_DIRS}
)
# To prevent warnings from M$ compiler
if(WIN32 AND MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_ATL_SECURE_NO_WARNINGS)
add_definitions(-D_AFX_SECURE_NO_WARNINGS)
endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_subdirectory(common)
add_subdirectory(printimages)
add_subdirectory(kmlexport)
add_subdirectory(sendimages)
add_subdirectory(flickr)
add_subdirectory(dropbox)
add_subdirectory(facebook)
add_subdirectory(imgur)
add_subdirectory(piwigo)
add_subdirectory(rajce)
add_subdirectory(smug)
add_subdirectory(imageshack)
add_subdirectory(yandexfotki)
add_subdirectory(googleservices)
add_subdirectory(jalbum)
add_subdirectory(reverseimagesearch)
if(KF5Archive_FOUND)
add_subdirectory(flashexport)
endif()
if(KF5Vkontakte_FOUND)
add_subdirectory(vkontakte)
endif()
if(KF5MediaWiki_FOUND)
add_subdirectory(mediawiki)
endif()
if(KF5KIO_FOUND AND KF5KIOWidgets_FOUND)
add_subdirectory(remotestorage) # kioimportwindow.cpp, kioexportwindow.cpp
endif()
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()
else()
message(STATUS "")
message(STATUS "----------------------------------------------------------------------------------")
message(STATUS " ${PROJECT_NAME} ${KIPIPLUGINS_VERSION_STRING} will not be compiled")
PRINT_OPTIONAL_LIBRARY_STATUS("libkipi"
"https://projects.kde.org/projects/kde/kdegraphics/libs/libkipi"
"(version >= ${KIPI_MIN_VERSION}))"
"Kipi-plugins needs this library to be compiled."
KF5Kipi_FOUND
)
message(STATUS "")
endif()