CMakeLists.txt 6.69 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

Laurent Montel's avatar
Laurent Montel committed
78
add_definitions(-DQT_NO_FOREACH)
79

80
81
82
83
84
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
85
86
## Dependencies
find_package(JPEG)
87
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
88

89
find_package(PNG)
90
set_package_properties(PNG PROPERTIES URL "http://www.libpng.org" DESCRIPTION "PNG image manipulation support" TYPE REQUIRED)
91

Nicolas Fella's avatar
Nicolas Fella committed
92
find_package(LibExiv2)
93
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
94

Csaba Kertesz's avatar
Csaba Kertesz committed
95
find_package(CFitsio)
96
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
97
98
99
if(CFITSIO_FOUND)
    set(HAVE_FITS true)
endif()
Csaba Kertesz's avatar
Csaba Kertesz committed
100

101
102
103
104
105
106
107
108
109
110
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
111
find_package(KF5Kipi)
112
113
114
if (KF5Kipi_FOUND)
   set(KIPI_FOUND true)
endif()
115
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
116

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

120
121
if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO)
    find_package(KF5Baloo 5.1.90)
122
    set_package_properties(KF5Baloo PROPERTIES URL "https://commits.kde.org/baloo" DESCRIPTION "Desktop-wide semantic information support" TYPE OPTIONAL)
123
124
125
126
127
    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 ()
128
endif ()
129

130
131
132
133
find_package(KF5KDcraw)
if (KF5KDcraw_FOUND)
   add_definitions(-DKDCRAW_FOUND)
endif()
134
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
135

Lukáš Tinkl's avatar
Lukáš Tinkl committed
136
137
138
139
140
141
142

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
143
144
145
configure_file(config-gwenview.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

146
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
147

148
149
150
151
152
function(JoinListAsString VALUES GLUE OUTPUT)
    string(REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
    set(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()

153
154
155
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

156
set(IMAGE_MIME_TYPES_LIST
157
    image/avif
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
    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
175
    application/x-krita
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
)
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
201
## dirs to build
David Edmundson's avatar
David Edmundson committed
202
add_subdirectory(lib)
203
add_subdirectory(app)
204
add_subdirectory(importer)
205
add_subdirectory(part)
David Edmundson's avatar
David Edmundson committed
206
add_subdirectory(tests)
David Edmundson's avatar
David Edmundson committed
207
208
209
210
add_subdirectory(icons)
add_subdirectory(images)
add_subdirectory(cursors)
add_subdirectory(color-schemes)
211
add_subdirectory(doc)
212
add_subdirectory(kconf_update)
Laurent Montel's avatar
Laurent Montel committed
213
214
ecm_qt_install_logging_categories(EXPORT GWENVIEW FILE gwenview.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})

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