CMakeLists.txt 6.78 KB
Newer Older
1
cmake_minimum_required (VERSION 3.16 FATAL_ERROR)
2

3
# KDE Application Version, managed by release script
4
set (RELEASE_SERVICE_VERSION_MAJOR "21")
5
set (RELEASE_SERVICE_VERSION_MINOR "07")
6
7
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
8

9
project(gwenview VERSION ${RELEASE_SERVICE_VERSION})
10

Halla Rempt's avatar
Halla Rempt committed
11
12
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )

Laurent Montel's avatar
Laurent Montel committed
13
14
set (QT_MIN_VERSION "5.12.0")
set (KF5_MIN_VERSION "5.68.0")
15

16
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
Csaba Kertesz's avatar
Csaba Kertesz committed
17

18
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
19
20
21

include(KDEInstallDirs)
include(KDECMakeSettings)
22
include(KDECompilerSettings NO_POLICY_SCOPE)
23
24
25
26
27
include(ECMOptionalAddSubdirectory)
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMMarkNonGuiExecutable)
include(ECMGenerateHeaders)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
28
include(ECMAddAppIcon)
29
30
include(GenerateExportHeader)
include(FeatureSummary)
Laurent Montel's avatar
Laurent Montel committed
31
include(ECMQtDeclareLoggingCategory)
32
## Generate header with version number
33
ecm_setup_version(${RELEASE_SERVICE_VERSION}
34
35
36
                  VARIABLE_PREFIX GWENVIEW
                  VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/lib/gwenview_version.h"
)
37

Aurélien Gâteau's avatar
Aurélien Gâteau committed
38
## CMake options
Aurélien Gâteau's avatar
Aurélien Gâteau committed
39
40
set(GWENVIEW_SEMANTICINFO_BACKEND_NONE OFF)
set(GWENVIEW_SEMANTICINFO_BACKEND_FAKE OFF)
Vishesh Handa's avatar
Vishesh Handa committed
41
set(GWENVIEW_SEMANTICINFO_BACKEND_BALOO OFF)
42

Lukáš Tinkl's avatar
Lukáš Tinkl committed
43
set(GWENVIEW_SEMANTICINFO_BACKEND "Baloo" CACHE STRING "Semantic info backend for Gwenview (Baloo/Fake/None)")
44

Aurélien Gâteau's avatar
Aurélien Gâteau committed
45
# Init GWENVIEW_SEMANTICINFO_BACKEND_* vars
Lukáš Tinkl's avatar
Lukáš Tinkl committed
46
if(GWENVIEW_SEMANTICINFO_BACKEND STREQUAL "None")
47
    set(GWENVIEW_SEMANTICINFO_BACKEND_NONE ON)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
48
elseif(GWENVIEW_SEMANTICINFO_BACKEND STREQUAL "Fake")
Aurélien Gâteau's avatar
Aurélien Gâteau committed
49
    set(GWENVIEW_SEMANTICINFO_BACKEND_FAKE ON)
50
else()
Vishesh Handa's avatar
Vishesh Handa committed
51
    set(GWENVIEW_SEMANTICINFO_BACKEND_BALOO ON)
52
endif()
53

54
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets Concurrent Svg PrintSupport)
55
56
find_package(Qt5DBus ${QT_MIN_VERSION} CONFIG QUIET)
set(HAVE_QTDBUS ${Qt5DBus_FOUND})
57

Christoph Feck's avatar
Christoph Feck committed
58
find_package(Phonon4Qt5 4.6.60 NO_MODULE REQUIRED)
59
include_directories(BEFORE SYSTEM ${PHONON_INCLUDES})
David Edmundson's avatar
David Edmundson committed
60
61
add_definitions(-DPHONON_LIB_SONAME=\"${PHONON_LIB_SONAME}\")

62
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
63
    KIO
64
    ItemModels
65
66
67
68
69
70
    I18n
    DocTools
    Parts
    WindowSystem
    IconThemes
    Notifications
71
    WidgetsAddons
72
)
73
74
find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS
    Activities
75
    Purpose
76
)
77

78
79
80
81
82
if (KF5ConfigWidgets_VERSION VERSION_GREATER "5.56.0" AND ${Phonon4Qt5_VERSION} VERSION_GREATER "4.10.59")
        add_definitions(-DQT_NO_FOREACH)
        MESSAGE(STATUS "compile without foreach")
endif()

83
84
85
86
87
message(STATUS ${KF5KIO_VERSION})
if (KF5KIO_VERSION VERSION_GREATER_EQUAL "5.82.0")
    add_definitions(-DKIO_REQUEST_MIMETYPE)
endif()

Aurélien Gâteau's avatar
Aurélien Gâteau committed
88
89
## Dependencies
find_package(JPEG)
90
set_package_properties(JPEG PROPERTIES URL "http://libjpeg.sourceforge.net/" DESCRIPTION "JPEG image manipulation support" TYPE REQUIRED)
Aurélien Gâteau's avatar
Aurélien Gâteau committed
91

92
find_package(PNG)
93
set_package_properties(PNG PROPERTIES URL "http://www.libpng.org" DESCRIPTION "PNG image manipulation support" TYPE REQUIRED)
94

Nicolas Fella's avatar
Nicolas Fella committed
95
find_package(LibExiv2)
96
set_package_properties(Exiv2 PROPERTIES URL "https://www.exiv2.org" DESCRIPTION "image metadata support" TYPE REQUIRED)
Aurélien Gâteau's avatar
Aurélien Gâteau committed
97

Csaba Kertesz's avatar
Csaba Kertesz committed
98
find_package(CFitsio)
99
set_package_properties(CFitsio PROPERTIES URL "https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html" DESCRIPTION "FITS format support" TYPE OPTIONAL)
Andreas Sturmlechner's avatar
Andreas Sturmlechner committed
100
101
102
if(CFITSIO_FOUND)
    set(HAVE_FITS true)
endif()
Csaba Kertesz's avatar
Csaba Kertesz committed
103

104
105
106
107
108
109
110
111
112
113
find_package(TIFF)
set_package_properties(TIFF PROPERTIES DESCRIPTION "Library for reading TIFF files"
                       URL "http://www.libtiff.org/"
                       TYPE OPTIONAL
                       PURPOSE "Disable uninteresting log messages from libtiff by default"
                       )
if (TIFF_FOUND)
    set(HAVE_TIFF true)
endif()

Laurent Montel's avatar
Laurent Montel committed
114
find_package(KF5Kipi)
115
116
117
if (KF5Kipi_FOUND)
   set(KIPI_FOUND true)
endif()
118
set_package_properties(KF5Kipi PROPERTIES URL "https://phabricator.kde.org/source/kipi-plugins/" DESCRIPTION "Provides various image manipulation and export features" TYPE OPTIONAL)
Aurélien Gâteau's avatar
Aurélien Gâteau committed
119

Halla Rempt's avatar
Halla Rempt committed
120
find_package(LCMS2)
121
set_package_properties(LCMS2 PROPERTIES URL "http://www.littlecms.com" DESCRIPTION "Color management engine" TYPE REQUIRED)
Halla Rempt's avatar
Halla Rempt committed
122

123
124
if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO)
    find_package(KF5Baloo 5.1.90)
125
    set_package_properties(KF5Baloo PROPERTIES URL "https://commits.kde.org/baloo" DESCRIPTION "Desktop-wide semantic information support" TYPE OPTIONAL)
126
127
128
129
130
    if (NOT KF5Baloo_FOUND)
        message (STATUS "You have selected Baloo for semantic backend, but required version was not found. Overriding the backend to None")
        unset(GWENVIEW_SEMANTICINFO_BACKEND_BALOO)
        set(GWENVIEW_SEMANTICINFO_BACKEND_NONE ON)
    endif ()
131
endif ()
132

133
134
135
136
find_package(KF5KDcraw)
if (KF5KDcraw_FOUND)
   add_definitions(-DKDCRAW_FOUND)
endif()
137
set_package_properties(KF5KDcraw PROPERTIES URL "https://phabricator.kde.org/source/libkdcraw/" DESCRIPTION "C++ interface around LibRaw library used to decode RAW picture files" TYPE OPTIONAL)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
138

Lukáš Tinkl's avatar
Lukáš Tinkl committed
139
140
141
142
143
144
145

find_package(X11)
if(X11_FOUND)
   find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED X11Extras)
   set(HAVE_X11 1)
endif()

David Edmundson's avatar
David Edmundson committed
146
147
148
configure_file(config-gwenview.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

149
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
150

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
function(JoinListAsString VALUES GLUE OUTPUT)
    string(REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
    set(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()

set(IMAGE_MIME_TYPES_LIST
    image/gif
    image/jpeg
    image/png
    image/bmp
    image/x-eps
    image/x-icns
    image/x-ico
    image/x-portable-bitmap
    image/x-portable-graymap
    image/x-portable-pixmap
    image/x-xbitmap
    image/x-xpixmap
    image/tiff
    image/x-psd
    image/x-webp
    image/webp
    image/x-tga
174
    application/x-krita
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
)
if (KF5KDcraw_FOUND)
    list(APPEND IMAGE_MIME_TYPES_LIST
        image/x-kde-raw
        image/x-canon-cr2
        image/x-canon-crw
        image/x-kodak-dcr
        image/x-adobe-dng
        image/x-kodak-k25
        image/x-kodak-kdc
        image/x-minolta-mrw
        image/x-nikon-nef
        image/x-olympus-orf
        image/x-pentax-pef
        image/x-fuji-raf
        image/x-panasonic-rw
        image/x-sony-sr2
        image/x-sony-srf
        image/x-sigma-x3f
        image/x-sony-arw
        image/x-panasonic-rw2
    )
endif()
JoinListAsString("${IMAGE_MIME_TYPES_LIST}" ";" IMAGE_MIME_TYPES)

Aurélien Gâteau's avatar
Aurélien Gâteau committed
200
## dirs to build
David Edmundson's avatar
David Edmundson committed
201
add_subdirectory(lib)
202
add_subdirectory(app)
203
add_subdirectory(importer)
204
add_subdirectory(part)
David Edmundson's avatar
David Edmundson committed
205
add_subdirectory(tests)
David Edmundson's avatar
David Edmundson committed
206
207
208
209
add_subdirectory(icons)
add_subdirectory(images)
add_subdirectory(cursors)
add_subdirectory(color-schemes)
210
add_subdirectory(doc)
211
add_subdirectory(kconf_update)
Laurent Montel's avatar
Laurent Montel committed
212
213
ecm_qt_install_logging_categories(EXPORT GWENVIEW FILE gwenview.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})

Lukáš Tinkl's avatar
Lukáš Tinkl committed
214
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)