-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
692 lines (599 loc) · 22.3 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
##############################################
# CMakeLists for PhotoQt: http://photoqt.org #
##############################################
cmake_minimum_required(VERSION 3.16)
project(photoqt LANGUAGES CXX)
##################################################################
#### GLOBAL VERSION STRING FOR ALL FILES (INCLUDING CPP/QML) ####
##################################################################
SET(APPVERSION "4.6")
add_definitions(-DPQMVERSION="${APPVERSION}")
########################################
#### SOME SETTINGS/FLAGS FOR CMAKE ####
########################################
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
#############################
#### GET list of files ####
#############################
include(CMake/ListFilesCPlusPlus.cmake)
include(CMake/ListFilesQML.cmake)
#############################################
#### OPTIONS THAT CAN BE SET BY THE USER ####
#############################################
option(RAW "Use libraw library" ON)
option(GRAPHICSMAGICK "Use GraphicsMagick library" OFF)
option(IMAGEMAGICK "Use ImageMagick library" ON)
option(DEVIL "Use DevIL library" ON)
option(FREEIMAGE "Use FreeImage library" ON)
option(POPPLER "Use Poppler library" ON)
option(QTPDF "Use QtPDF module instead of Poppler" OFF)
option(LIBARCHIVE "Enable features that require libarchive" ON)
option(VIDEO_QT "Enable video support through Qt" ON)
option(VIDEO_MPV "Enable video support through MPV" ON)
option(LIBVIPS "Use libvips" OFF)
option(RESVG "Replace Qt's SVG engine with resvg for better SVG support" OFF)
option(ZXING "Support for QR and barcodes detection (using ZXing)" ON)
option(EXIV2 "Use exiv2 library" ON)
option(EXIV2_ENABLE_BMFF "Enable BMFF format support in Exiv2 (if available)" ON)
option(PUGIXML "Enable features that require pugixml" ON)
option(CHROMECAST "Enable Chromecast support" ON)
option(CHROMECAST_PIPINSTALL "Allows CMake to attempt to install PyChromecast locally using pip." OFF)
option(LOCATION "Enable use of QtPositioning/QtLocation QML modules" ON)
option(MOTIONPHOTO "Enable support for Google Motion Photos and Apple Live Photos" ON)
option(PHOTOSPHERE "Enable support for photo spheres and 360 degree panoramic views" ON)
option(LCMS2 "Enable advanced color management with LCMS2" ON)
option(TESTING "Build some unit tests" OFF)
option(RUNCPPCHECK "Analyse source code with cppcheck" OFF)
option(FLATPAKBUILD "Enable this if this is a build for Flatpak" OFF)
if(QTPDF)
if(POPPLER)
set(POPPLER OFF)
message("** For displaying PDF documents you have to choose either Poppler OR QtPDF.")
message("** Poppler has been automatically disabled in favour of QtPDF.")
endif()
endif()
################################
#### FIND REQUIRED PACKAGES ####
################################
find_package(Qt6 6.2 REQUIRED COMPONENTS Quick Widgets Sql Core Svg Concurrent Multimedia PrintSupport DBus LinguistTools)
if(TESTING)
find_package(Qt6 6.2 REQUIRED COMPONENTS Test)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
if(IMAGEMAGICK)
find_package(ImageMagick COMPONENTS Magick++)
if(GRAPHICSMAGICK)
set(GRAPHICSMAGICK OFF)
message("** ImageMagick and GraphicsMagick cannot be used at the same time.")
message("** GraphicsMagick has been automatically disabled in favour of ImageMagick.")
endif()
endif()
if(GRAPHICSMAGICK)
find_package(GraphicsMagick)
endif()
if(EXIV2)
find_package(exiv2 REQUIRED)
endif()
if(RAW)
find_package(LibRaw)
endif()
if(NOT WIN32)
if(FREEIMAGE)
find_package(FreeImage)
endif()
endif()
if(LIBARCHIVE)
find_package(LibArchive)
endif()
if(NOT WIN32)
if(POPPLER)
find_package(Poppler COMPONENTS Qt6)
endif()
endif()
if(DEVIL)
find_package(DevIL)
endif()
if(CHROMECAST)
find_package(Python3 COMPONENTS Interpreter)
endif()
if(LIBVIPS)
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB REQUIRED glib-2.0 gobject-2.0)
endif()
if(VIDEO_MPV)
find_package(Libmpv)
set(photoqt_SOURCES ${photoqt_SOURCES} ${photoqt_libmpv_SOURCES})
endif()
if(QTPDF)
find_package(Qt6 COMPONENTS Pdf REQUIRED)
endif()
if(ZXING)
find_package(ZXing)
endif()
if(PHOTOSPHERE)
set(photoqt_SOURCES ${photoqt_SOURCES} ${photoqt_ps_SOURCES})
endif()
if(LCMS2)
find_package(LCMS2)
endif()
if(FLATPAKBUILD)
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB REQUIRED glib-2.0 gobject-2.0 gio-2.0)
endif()
######################
#### RUN CPPCHECK ####
######################
if(RUNCPPCHECK)
# Find CppCheck executable
find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
# If CppCheck executable found
if(CMAKE_CXX_CPPCHECK)
message("** Analyzing source code with cppcheck")
# Append desired arguments to CppCheck
list(APPEND CMAKE_CXX_CPPCHECK
"--enable=warning"
"--inconclusive"
"--library=qt"
)
endif()
else()
unset(CMAKE_CXX_CPPCHECK CACHE)
endif()
###############################
#### ADDITIONAL QT OPTIONS ####
###############################
# Since Python might be imported we have to avoid using Qt keywords (like 'slots') to avoid naming conflicts
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
# we always want to capture debug/log context information
add_definitions(-DQT_MESSAGELOGCONTEXT)
#####################################
#### Handle Qt<6.4 specific stuff ####
#####################################
if(Qt6_VERSION VERSION_LESS 6.5)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQMultiEffect_fake.qml" "${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQMultiEffect.qml")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQBlurBackground_fake.qml" "${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQBlurBackground.qml")
else()
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQMultiEffect_real.qml" "${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQMultiEffect.qml")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQBlurBackground_real.qml" "${CMAKE_CURRENT_SOURCE_DIR}/qml/elements/PQBlurBackground.qml")
endif()
#############################
#### Add the executeable ####
#############################
if(WIN32)
qt_add_executable(photoqt ${photoqt_SOURCES} ${ALLHEADERS} misc/misc.qrc img/img.qrc img/filetypes.qrc python/python.qrc windowsicons.rc)
else()
qt_add_executable(photoqt ${photoqt_SOURCES} ${ALLHEADERS} misc/misc.qrc img/img.qrc img/filetypes.qrc python/python.qrc)
endif()
# add qml files
qt_add_qml_module(photoqt URI src VERSION 1.0 QML_FILES ${photoqt_QML} RESOURCE_PREFIX)
# set header files as include files
target_include_directories(photoqt PRIVATE "cplusplus/header")
# set some properties for executable
set_target_properties(photoqt PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER photoqt.PhotoQt.org
MACOSX_BUNDLE_BUNDLE_VERSION "${APPVERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPVERSION}"
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
# link executable
target_link_libraries(photoqt PRIVATE Qt6::Quick Qt6::Widgets Qt6::Sql Qt6::Core Qt6::Svg Qt6::Concurrent Qt6::Multimedia Qt6::PrintSupport Qt6::DBus)
if(QTPDF)
target_link_libraries(photoqt PRIVATE Qt6::Pdf)
endif()
if(TESTING)
qt_add_executable(photoqt_test ${photoqt_testscripts_SOURCES} misc/misc.qrc testing/resources/testing.qrc)
target_link_libraries(photoqt_test PRIVATE Qt6::Quick Qt6::Widgets Qt6::Sql Qt6::Core Qt6::Svg Qt6::Concurrent Qt6::Test)
target_include_directories(photoqt_test PRIVATE "testing/header")
target_include_directories(photoqt_test PRIVATE "cplusplus/header")
endif()
##############################################
#### COMPOSE THE APPROPRIATE DESKTOP FILE ####
##############################################
include("CMake/ComposeDesktopFile.cmake")
composeDesktopFile()
######################
#### TRANSLATIONS ####
######################
# the compiled translations are automatically embedded as resource in executable
file(GLOB files "lang/*.ts")
qt_add_translations(photoqt
TS_FILES ${files}
RESOURCE_PREFIX "/lang")
########################
#### CUSTOM OPTIONS ####
########################
if(PUGIXML)
add_definitions(-DPQMPUGIXML)
target_link_libraries(photoqt PRIVATE "pugixml")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "pugixml")
endif()
endif()
if(VIDEO_QT)
add_definitions(-DPQMVIDEOQT)
endif()
if(LIBARCHIVE)
if(NOT ${LibArchive_FOUND})
message(FATAL_ERROR "** Unable to locate LibArchive... is it installed?")
else()
message("** Using LibArchive " ${LibArchive_VERSION})
add_definitions(-DPQMLIBARCHIVE)
include_directories(${LibArchive_INCLUDE_DIRS})
target_link_libraries(photoqt PRIVATE ${LibArchive_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${LibArchive_LIBRARIES})
endif()
endif()
else()
message("** LibArchive disabled")
endif()
if(POPPLER)
if(WIN32)
message("** Using Poppler")
add_definitions(-DPQMPOPPLER)
target_link_libraries(photoqt PRIVATE "poppler")
target_link_libraries(photoqt PRIVATE "poppler-qt6")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "poppler")
target_link_libraries(photoqt_test PRIVATE "poppler-qt6")
endif()
else()
if(NOT ${Poppler_FOUND})
message(FATAL_ERROR "** Unable to locate Poppler... is it installed?")
else()
message("** Using Poppler ${Poppler_VERSION}")
include_directories(${Poppler_INCLUDE_DIRS})
add_definitions(-DPQMPOPPLER)
target_link_libraries(photoqt PRIVATE ${Poppler_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${Poppler_LIBRARIES})
endif()
endif()
endif()
else()
message("** Poppler DISABLED")
endif()
if(QTPDF)
message("** Using QtPDF module")
add_definitions(-DPQMQTPDF)
endif()
if(DEVIL)
if(WIN32)
target_link_libraries(photoqt PRIVATE "DevIL")
message("** Using DevIL")
add_definitions(-DPQMDEVIL)
else()
if(NOT ${DevIL_FOUND})
message(FATAL_ERROR "** Unable to locate DevIL... is it installed?")
else()
message("** Using DevIL")
include_directories(${IL_INCLUDE_DIR})
add_definitions(-DPQMDEVIL)
target_link_libraries(photoqt PRIVATE ${IL_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${IL_LIBRARIES})
endif()
endif()
endif()
else()
message("** DevIL DISABLED")
endif()
if(FREEIMAGE)
if(WIN32)
target_link_libraries(photoqt PRIVATE "FreeImage")
message("** Using FreeImage")
add_definitions(-DPQMFREEIMAGE)
else()
if(NOT ${FREEIMAGE_FOUND})
message(FATAL_ERROR "** Unable to locate FreeImage... is it installed?")
else()
message("** Using FreeImage")
include_directories(${FREEIMAGE_INCLUDE_DIRS})
add_definitions(-DPQMFREEIMAGE)
target_link_libraries(photoqt PRIVATE ${FREEIMAGE_C_LIBRARY})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${FREEIMAGE_C_LIBRARY})
endif()
endif()
endif()
else()
message("** FreeImage DISABLED")
endif()
if(RAW)
if(NOT ${LIBRAW_FOUND})
message(FATAL_ERROR "** Unable to locate LibRaw... is it installed?")
else()
message("** Using LibRaw")
add_definitions(-DPQMRAW)
include_directories(${LIBRAW_INCLUDE_DIR})
if(WIN32)
target_link_libraries(photoqt PRIVATE "libraw")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "libraw")
endif()
else()
target_link_libraries(photoqt PRIVATE "raw")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "raw")
endif()
endif()
endif()
else()
message("** LibRaw DISABLED")
endif()
if(EXIV2)
if(NOT ${exiv2_FOUND})
message(FATAL_ERROR "** Unable to locate Exiv2... is it installed?")
else()
message("** Using Exiv2 ${exiv2_VERSION}")
include_directories(${EXIV2_INCLUDE_DIR})
add_definitions(-DPQMEXIV2)
target_link_libraries(photoqt PRIVATE "exiv2")
if(EXIV2_ENABLE_BMFF)
add_definitions(-DPQMEXIV2_ENABLE_BMFF)
endif()
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "exiv2")
endif()
if(WIN32)
add_definitions("-DNOMINMAX")
endif()
# if exiv2 0.27.x is used some c++ features removed in c++17 need to be reenabled
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(${exiv2_VERSION} MATCHES "^0\.27\.")
message("** Enabling C++ features removed in C++17 for Exiv2 0.27.x")
message("** Please update Exiv2 to at least 0.28.x!")
add_definitions(-D_HAS_AUTO_PTR_ETC=1)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(${exiv2_VERSION} MATCHES "^0\.27\.")
message("** Enabling C++ features removed in C++17 for Exiv2 0.27.x")
message("** Please update Exiv2 to at least 0.28.x!")
add_definitions(-fpermissive)
endif()
endif()
endif()
else()
message("** Exiv2 DISABLED")
endif()
if(GRAPHICSMAGICK)
if(NOT ${MAGICK++_FOUND})
message(FATAL_ERROR "** Unable to locate GraphicsMagick... is it installed?")
else()
message("** Using Graphicsmagick")
include_directories(${MAGICK++_INCLUDE_DIR})
add_definitions(-DPQMGRAPHICSMAGICK)
target_link_libraries(photoqt PRIVATE "GraphicsMagick++")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "GraphicsMagick++")
endif()
endif()
else()
message("** Graphicsmagick DISABLED")
endif()
if(IMAGEMAGICK)
if(NOT ${ImageMagick_FOUND})
message(FATAL_ERROR "** Unable to locate ImageMagick... is it installed?")
else()
message("** Using ImageMagick ${ImageMagick_VERSION_STRING}")
# These checks are necessary to "fix" compiling PhotoQt with both ImageMagick 6 and 7 available
if(ImageMagick_VERSION_STRING MATCHES "^7")
string(REPLACE "libMagick++-6." "libMagick++-7." ImageMagick_LIBRARIES "${ImageMagick_LIBRARIES}")
string(REPLACE "ImageMagick-6" "ImageMagick-7" ImageMagick_INCLUDE_DIRS "${ImageMagick_INCLUDE_DIRS}")
endif()
include_directories("${ImageMagick_INCLUDE_DIRS}")
add_definitions(-DPQMIMAGEMAGICK)
add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16)
add_definitions(-DMAGICKCORE_HDRI_ENABLE=1)
target_link_libraries(photoqt PRIVATE "${ImageMagick_LIBRARIES}")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${ImageMagick_LIBRARIES})
endif()
endif()
else()
message("** ImageMagick DISABLED")
endif()
if(CHROMECAST)
if(NOT ${Python3_FOUND})
message(FATAL_ERROR "** Unable to locate Python3... is it installed?")
elseif(NOT ${Python3_Interpreter_FOUND})
message(FATAL_ERROR "** Unable to locate Python3 Interpreter... is it installed?")
else()
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import pychromecast" RESULT_VARIABLE EXIT_CODE OUTPUT_QUIET TIMEOUT 60)
if(NOT ${EXIT_CODE} EQUAL 0)
if(CHROMECAST_PIPINSTALL)
# try installing it with pip
message(">> Attempt to install pychromecast locally using pip...")
execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install pychromecast)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import pychromecast" RESULT_VARIABLE EXIT_CODE OUTPUT_QUIET TIMEOUT 60)
if(NOT ${EXIT_CODE} EQUAL 0)
message(FATAL_ERROR "** Unable to locate Python3 module pychromecast. Please first install it or disable Chromecast support.")
else()
message(">> Success!")
endif()
else()
message(FATAL_ERROR "** Unable to import PyChromecast, make sure it is installed. "
"Enabling the CHROMECAST_PIPINSTALL option allows CMake to try to install it locally using pip.")
endif()
endif()
message("** Chromecast support enabled")
message("** Using Python ${Python3_VERSION}")
add_definitions(-DPQMCHROMECAST)
include_directories(${Python3_INCLUDE_DIRS})
target_link_libraries(photoqt PRIVATE ${Python3_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${Python3_LIBRARIES})
endif()
endif()
else()
message("** Chromecast support DISABLED")
endif()
if(LIBVIPS)
message("** Using libvips")
include_directories(${GLIB_INCLUDE_DIRS})
add_definitions(-DPQMLIBVIPS)
target_link_libraries(photoqt PRIVATE ${GLIB_LIBRARIES})
target_link_libraries(photoqt PRIVATE "vips")
target_link_libraries(photoqt PRIVATE "gobject-2.0")
target_link_libraries(photoqt PRIVATE "vips-cpp")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${GLIB_LIBRARIES})
target_link_libraries(photoqt_test PRIVATE "vips")
target_link_libraries(photoqt_test PRIVATE "gobject-2.0")
target_link_libraries(photoqt_test PRIVATE "vips-cpp")
endif()
else()
message("** libvips DISABLED")
endif()
if(VIDEO_MPV)
if(NOT ${Libmpv_FOUND})
message(FATAL_ERROR "** Unable to locate libmpv... is it installed?")
else()
message("** Using libmpv " ${Libmpv_VERSION})
include_directories(${Libmpv_INCLUDE_DIRS})
add_definitions(-DPQMVIDEOMPV)
target_link_libraries(photoqt PRIVATE ${Libmpv_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${Libmpv_LIBRARIES})
endif()
endif()
else()
message("** libmpv DISABLED")
endif()
if(LOCATION)
message("** Use of QtLocation/QtPosition enabled")
add_definitions(-DPQMLOCATION)
else()
message("** Use of QtLocation/QtPosition DISABLED")
endif()
if(RESVG)
target_link_libraries(${PROJECT_NAME} PRIVATE "resvg")
message("** Using resvg")
add_definitions(-DPQMRESVG)
else()
message("** resvg DISABLED")
endif()
if(MOTIONPHOTO)
message("** Support for Motion Photos and Apple Live Photos enabled")
add_definitions(-DPQMMOTIONPHOTO)
else()
message("** Support for Motion Photos and Apple Live Photos DISABLED")
endif()
if(PHOTOSPHERE)
message("** Support for photo spheres enabled")
message("** NOTE: When changing the PHOTOSPHERE option the source tree")
message("** might need to be cleaned before the next build")
add_definitions(-DPQMPHOTOSPHERE)
else()
message("** Support for photo spheres DISABLED")
endif()
if(ZXING)
if(NOT ${ZXing_FOUND})
message(FATAL_ERROR "** Unable to locate ZXing... is it installed?")
else()
message("** Using ZXing " ${ZXING_VERSION})
include_directories(${ZXING_INCLUDE_DIRS})
add_definitions(-DPQMZXING)
target_link_libraries(photoqt PRIVATE "ZXing")
if(TESTING)
target_link_libraries(photoqt_test PRIVATE "ZXing")
endif()
endif()
else()
message("** ZXing DISABLED")
endif()
if(LCMS2)
if(NOT ${LCMS2_FOUND})
message(FATAL_ERROR "** Unable to locate LCMS2... is it installed?")
else()
message("** Using LCMS2 " ${LCMS2_VERSION})
include_directories(${LCMS2_INCLUDE_DIR})
add_definitions(-DPQMLCMS2)
target_link_libraries(photoqt PRIVATE ${LCMS2_LIBRARIES})
if(TESTING)
target_link_libraries(photoqt_test PRIVATE ${LCMS2_LIBRARIES})
endif()
endif()
else()
message("** LCMS2 DISABLED")
endif()
if(FLATPAKBUILD)
message("** Enabling Flatpak workarounds")
add_definitions(-DPQMFLATPAKBUILD)
include_directories(${GLIB_INCLUDE_DIRS})
target_link_libraries(photoqt PRIVATE ${GLIB_LIBRARIES})
target_link_libraries(photoqt PRIVATE "gobject-2.0")
target_link_libraries(photoqt PRIVATE "gio-2.0")
endif()
#######################
#### INSTALL FILES ####
#######################
if(UNIX)
# Install executeable
install(
TARGETS ${PROJECT_NAME}
DESTINATION bin/
)
# Install desktop file
install(
FILES org.photoqt.PhotoQt.desktop
DESTINATION share/applications
)
# And install all the icons
install(
FILES icons/16x16/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/16x16/apps/
)
install(
FILES icons/32x32/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/32x32/apps/
)
install(
FILES icons/48x48/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/48x48/apps/
)
install(
FILES icons/64x64/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/64x64/apps/
)
install(
FILES icons/128x128/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/128x128/apps/
)
install(
FILES icons/256x256/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/256x256/apps/
)
install(
FILES icons/512x512/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/512x512/apps/
)
# the max allowed icon size for flathub is 512x512
if(NOT FLATPAKBUILD)
install(
FILES icons/1024x1024/org.photoqt.PhotoQt.png
DESTINATION share/icons/hicolor/1024x1024/apps/
)
endif()
install(
FILES org.photoqt.PhotoQt.metainfo.xml
DESTINATION share/metainfo/
)
endif()
##########################
#### UNINSTALL TARGET ####
##########################
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)