-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
188 lines (153 loc) · 5.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
cmake_minimum_required(VERSION 3.2)
set(USE_QT_LIBRARIES
Core Gui Widgets
)
find_package(Qt5 REQUIRED ${USE_QT_LIBRARIES})
# std::make_unique is part of c++14
#
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()
if(NOT BUILD_DATE)
string(TIMESTAMP BUILD_DATE "%Y-%m-%d")
string(TIMESTAMP BUILD_DATE_DOTTED "%Y.%m.%d")
endif()
add_definitions(
-DBUILD_DATE=\"${BUILD_DATE_DOTTED}\"
)
set(SOURCES
../../src/application/Application.cpp
../../src/application/main.cpp
../../src/model/FileSystemSortFilterProxyModel.cpp
../../src/model/ImageCatalog.cpp
../../src/ui/AboutComponentsDialog.cpp
../../src/ui/FileSystemTreeView.cpp
../../src/ui/ImageAreaWidget.cpp
../../src/ui/MainWindow.cpp
../../src/ui/SettingsDialog.cpp
../../src/ui/SettingsShortcutsTableWidget.cpp
../../src/ui/StatusBar.cpp
../../src/ui/support/RecentFileAction.cpp
../../src/ui/support/Settings.cpp
../../src/ui/support/SettingsShortcutsTableWidgetItem.cpp
../../src/util/misc.cpp
)
qt5_wrap_ui(UI_HEADERS
../../src/ui/forms/AboutComponentsDialog.ui
../../src/ui/forms/AboutDialog.ui
../../src/ui/forms/AboutSupportedFormatsDialog.ui
../../src/ui/forms/MainWindow.ui
../../src/ui/forms/SettingsDialog.ui
)
# Satisfy new Policy CMP0071
#
set_property(SOURCE "ui_AboutComponentsDialog.h" PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE "ui_AboutDialog.h" PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE "ui_AboutSupportedFormatsDialog.h" PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE "ui_MainWindow.h" PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE "ui_SettingsDialog.h" PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE "qrc_vookiimageviewer.cpp" PROPERTY SKIP_AUTOMOC ON)
qt5_add_resources(UI_RESOURCES ../../src/resource/vookiimageviewer.qrc)
if(APPLE)
find_library(APPKIT AppKit)
set(OS_LIBS ${APPKIT})
set(MACOSX_BUNDLE_EXECUTABLE_NAME VookiImageViewer)
set(MACOSX_BUNDLE_ICON_FILE vookiimageviewericon.icns)
set(MACOSX_BUNDLE_BUNDLE_NAME VookiImageViewer)
set(MACOSX_BUNDLE_COPYRIGHT "(C) 2017 Michal Duda")
set(MACOSX_BUNDLE_INFO_STRING "Lightweight image viewer")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${BUILD_DATE_DOTTED})
set(MACOSX_BUNDLE_GUI_IDENTIFIER "cz.VookiImageViewer")
set_source_files_properties(../../src/resource/openclipart/vookiimageviewericon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SOURCES
${SOURCES}
../../src/abstraction/mac/init.mm
)
add_executable(VookiImageViewer
MACOSX_BUNDLE
../../src/resource/openclipart/vookiimageviewericon.icns
${SOURCES}
${UI_HEADERS}
${UI_RESOURCES})
set_target_properties(VookiImageViewer PROPERTIES MACOSX_BUNDLE_INFO_PLIST ../support/MacOSXBundleInfo.plist.in)
elseif(WIN32)
set(SOURCES
${SOURCES}
../../src/abstraction/win/init.cpp
)
add_executable(VookiImageViewer
WIN32
windows/support/application.rc
${SOURCES}
${UI_HEADERS}
${UI_RESOURCES})
else()
set(SOURCES
${SOURCES}
../../src/abstraction/unix/init.cpp
)
add_executable(VookiImageViewer
${SOURCES}
${UI_HEADERS}
${UI_RESOURCES})
endif()
target_link_libraries(VookiImageViewer
Qt5::Core
Qt5::Gui
Qt5::Widgets)
TARGET_LINK_LIBRARIES(VookiImageViewer ${OS_LIBS})
#### Plugins ####
#
# Photoshop documents (psd)
#
add_library(vooki_kimg_psd MODULE ../../src/plugins/kimageformats/psd.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_psd Qt5::Gui)
# Gimp (xcf)
#
add_library(vooki_kimg_xcf MODULE ../../src/plugins/kimageformats/xcf.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_xcf Qt5::Gui)
# Personal Computer Exchange (pcx)
#
add_library(vooki_kimg_pcx MODULE ../../src/plugins/kimageformats/pcx.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_pcx Qt5::Gui)
# Targa (tga): supports more formats than Qt's version
#
add_library(vooki_kimg_tga MODULE ../../src/plugins/kimageformats/tga.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_tga Qt5::Gui)
# Sun Raster (ras)
#
add_library(vooki_kimg_ras MODULE ../../src/plugins/kimageformats/ras.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_ras Qt5::Gui)
# Softimage PIC (pic)
#
add_library(vooki_kimg_pic MODULE ../../src/plugins/kimageformats/pic.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_pic Qt5::Gui)
# SGI images (rgb, rgba, sgi, bw)
#
add_library(vooki_kimg_rgb MODULE ../../src/plugins/kimageformats/rgb.cpp)
TARGET_LINK_LIBRARIES(vooki_kimg_rgb Qt5::Gui)
# Camera RAW Thumbnails (raf, mos, cr2, erf, dng, mrw, nef, orf, rw2, pef, x3f, srw, x3f, arw)
#
if(APPLE)
SET(LIBRAW "3rdPartyLibs/LibRaw-0.18.8")
SET(CMAKE_CXX_FLAGS "-I../${LIBRAW} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "-L../${LIBRAW}/lib ${CMAKE_MODULE_LINKER_FLAGS}")
add_library(vooki_raw_thumb MODULE ../../src/plugins/rawthumb/rawThumbHandler.cpp ../../src/plugins/rawthumb/rawThumbPlugin.cpp)
TARGET_LINK_LIBRARIES(vooki_raw_thumb Qt5::Gui libraw_r.a)
elseif(WIN32)
add_definitions(-DLIBRAW_NODLL)
SET(LIBRAW "3rdPartyLibs/LibRaw-0.18.8")
SET(CMAKE_CXX_FLAGS "-I../${LIBRAW} ${CMAKE_CXX_FLAGS}")
add_library(vooki_raw_thumb MODULE ../../src/plugins/rawthumb/rawThumbHandler.cpp ../../src/plugins/rawthumb/rawThumbPlugin.cpp)
TARGET_LINK_LIBRARIES(vooki_raw_thumb Qt5::Gui ../${LIBRAW}/lib/libraw)
else()
find_library(LIBRAW NAMES libraw_r raw_r)
add_library(vooki_raw_thumb MODULE ../../src/plugins/rawthumb/rawThumbHandler.cpp ../../src/plugins/rawthumb/rawThumbPlugin.cpp)
TARGET_LINK_LIBRARIES(vooki_raw_thumb Qt5::Gui ${LIBRAW})
endif()