forked from easymodo/qimgv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (70 loc) · 2.43 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
cmake_minimum_required(VERSION 3.0)
project(qimgv)
set(CMAKE_BUILD_TYPE "Release")
# COMPILE FLAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
# AUTOMOC
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# USER OPTIONS
# Usage: cmake -DVIDEO_SUPPORT=ON [...]
option(VIDEO_SUPPORT "Enable video support" ON)
option(KDE_BLUR "Support blur when using KDE" OFF)
# FIND PACKAGES
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
if(KDE_BLUR) # do i also need one for mpv?
find_package(KF5WindowSystem REQUIRED)
endif()
# INCLUDE SOURCES
file(GLOB SRC *.cpp)
list(REMOVE_ITEM SRC moc_*.cpp)
list(REMOVE_ITEM SRC *_automoc.cpp)
include(CMake/SRC_Components.cmake)
include(CMake/SRC_SourceContainers.cmake)
include(CMake/SRC_Utils.cmake)
include(CMake/SRC_Gui.cmake)
# ADD RESOURCES
QT5_ADD_RESOURCES(RES resources.qrc)
# ADD EXECUTABLE
add_executable(qimgv ${SRC} ${SRC_Components} ${SRC_SourceContainers} ${SRC_Utils} ${SRC_Gui} ${RES})
# LINK STUFF
target_link_libraries(qimgv Qt5::Core Qt5::Widgets Qt5::Concurrent)
# OPTION DEFINITIONS, LINKING
if(KDE_BLUR)
target_link_libraries(qimgv KF5::WindowSystem)
add_definitions(-DUSE_KDE_BLUR)
endif()
if(VIDEO_SUPPORT)
target_link_libraries(qimgv mpv)
add_definitions(-DUSE_MPV)
endif()
## INSTALLATION
# binary
install(PROGRAMS ${CMAKE_BINARY_DIR}/qimgv
DESTINATION bin)
# .desktop
install(FILES distrib/qimgv.desktop
DESTINATION share/applications)
# icons
install(FILES distrib/hicolor/16x16/apps/qimgv.png
DESTINATION share/icons/hicolor/16x16/apps)
install(FILES distrib/hicolor/22x22/apps/qimgv.png
DESTINATION share/icons/hicolor/22x22/apps)
install(FILES distrib/hicolor/24x24/apps/qimgv.png
DESTINATION share/icons/hicolor/24x24/apps)
install(FILES distrib/hicolor/32x32/apps/qimgv.png
DESTINATION share/icons/hicolor/32x32/apps)
install(FILES distrib/hicolor/48x48/apps/qimgv.png
DESTINATION share/icons/hicolor/48x48/apps)
install(FILES distrib/hicolor/64x64/apps/qimgv.png
DESTINATION share/icons/hicolor/64x64/apps)
install(FILES distrib/hicolor/128x128/apps/qimgv.png
DESTINATION share/icons/hicolor/128x128/apps)
install(FILES distrib/hicolor/256x256/apps/qimgv.png
DESTINATION share/icons/hicolor/256x256/apps)
install(FILES distrib/hicolor/scalable/apps/qimgv.svg
DESTINATION share/icons/hicolor/scalable/apps)