-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
340 lines (312 loc) · 10.8 KB
/
CMakeLists.txt
File metadata and controls
340 lines (312 loc) · 10.8 KB
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
cmake_minimum_required(VERSION 3.16)
project(Photon VERSION 0.2.0 LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set MSVC runtime to dynamic to match vcpkg libraries
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
# Configure version header
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/Version.h"
)
find_package(Qt6 REQUIRED COMPONENTS Quick QuickControls2 ShaderTools Gui Concurrent GuiPrivate)
find_package(Vulkan REQUIRED)
if(WIN32)
# Use find_package for vcpkg compatibility on Windows
find_package(LibRaw REQUIRED)
find_package(OpenCV REQUIRED)
find_package(TIFF REQUIRED)
add_compile_definitions(WIN32_LEAN_AND_MEAN)
add_compile_definitions(NOMINMAX)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBRAW REQUIRED libraw)
pkg_check_modules(OPENCV REQUIRED opencv4)
pkg_check_modules(TIFF REQUIRED libtiff-4)
endif()
qt_standard_project_setup(REQUIRES 6.10)
qt_add_executable(Photon
src/main.cpp
src/engine/RawEngine.cpp
src/engine/RawEngine.h
src/engine/Denoiser.cpp
src/engine/Denoiser.h
src/engine/GpuSearcher.cpp
src/engine/GpuSearcher.h
src/engine/GpuChromaFilter.cpp
src/engine/GpuChromaFilter.h
src/engine/ImageDeveloper.cpp
src/engine/ImageDeveloper.h
src/engine/VulkanComputeContext.cpp
src/engine/VulkanComputeContext.h
src/engine/patch_search.comp
src/engine/Panorama.cpp
src/engine/Panorama.h
src/components/RawViewport.cpp
src/components/RawViewport.h
src/components/ToneLutProvider.h
src/managers/AppStateManager.cpp
src/managers/AppStateManager.h
src/managers/ThumbnailProvider.cpp
src/managers/ThumbnailProvider.h
src/managers/ThumbnailImageProvider.cpp
src/managers/ThumbnailImageProvider.h
src/managers/FileScanner.cpp
src/managers/FileScanner.h
src/managers/KeyTracker.h
src/managers/PresetManager.cpp
src/managers/PresetManager.h
src/managers/LogManager.cpp
src/managers/LogManager.h
src/managers/ExportManager.cpp
src/managers/ExportManager.h
src/managers/PreviewManager.cpp
src/managers/PreviewManager.h
)
# Mark Theme.qml as a singleton (must be before qt_add_qml_module)
set_source_files_properties(content/theme/Theme.qml PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
)
qt6_add_shaders(Photon "raw_shaders"
PREFIX "/Main/shaders"
BASE "src/components"
FILES
src/components/RawViewport.vert
src/components/RawViewport.frag
src/components/PatchSearch.vert
src/components/PatchSearch.frag
src/components/ColorMask.frag
)
qt6_add_shaders(Photon "compute_shaders"
PREFIX "/Main/shaders"
BASE "src/engine"
BATCHABLE compute_shaders
OUTPUT_TYPE spirv
GLSL "450"
ESSL "0"
FILES
src/engine/patch_search.comp
src/engine/box_filter.comp
src/engine/guided_ops.comp
)
qt_add_qml_module(Photon
URI "Main"
VERSION 1.0
RESOURCE_PREFIX "/"
SOURCES
src/components/RawViewport.cpp
src/components/RawViewport.h
src/components/ToneLutProvider.h
src/engine/RawEngine.cpp
src/engine/RawEngine.h
src/engine/Denoiser.cpp
src/engine/Denoiser.h
src/engine/GpuSearcher.cpp
src/engine/GpuSearcher.h
src/engine/GpuChromaFilter.cpp
src/engine/GpuChromaFilter.h
src/engine/ImageDeveloper.cpp
src/engine/ImageDeveloper.h
src/engine/Panorama.cpp
src/engine/Panorama.h
src/engine/VulkanComputeContext.cpp
src/engine/VulkanComputeContext.h
src/managers/AppStateManager.cpp
src/managers/AppStateManager.h
src/managers/ThumbnailProvider.cpp
src/managers/ThumbnailProvider.h
src/managers/ThumbnailImageProvider.cpp
src/managers/ThumbnailImageProvider.h
src/managers/FileScanner.cpp
src/managers/FileScanner.h
src/managers/KeyTracker.h
src/managers/PresetManager.cpp
src/managers/PresetManager.h
src/managers/LogManager.cpp
src/managers/LogManager.h
src/managers/ExportManager.cpp
src/managers/ExportManager.h
src/managers/PreviewManager.cpp
src/managers/PreviewManager.h
QML_FILES
content/views/App.qml
content/views/WelcomeView.qml
content/views/LibraryView.qml
content/views/DevelopView.qml
content/views/SettingView.qml
content/components/PhotonButton.qml
content/components/PhotonSwitch.qml
content/components/PhotonCheckbox.qml
content/components/PhotonInput.qml
content/components/PhotonSlider.qml
content/components/PhotonScrollBar.qml
content/components/PhotonToast.qml
content/components/PhotonToastManager.qml
content/components/Card.qml
content/components/Collapsible.qml
content/components/ControlGroup.qml
content/components/CropOverlay.qml
content/components/CropPanel.qml
content/components/Histogram.qml
content/components/ToneCurve.qml
content/components/PresetPanel.qml
content/components/SettingsSelectionDialog.qml
content/components/PhotoContextMenu.qml
content/components/MetadataPanel.qml
content/components/ExportPanel.qml
content/theme/Theme.qml
RESOURCES
assets/icons/photon.png
assets/icons/search.svg
assets/icons/hand.svg
assets/icons/zoom-in.svg
assets/icons/zoom-out.svg
assets/icons/undo.svg
assets/icons/redo.svg
assets/icons/flip-horizontal.svg
assets/icons/flip-vertical.svg
assets/icons/rotate-cw.svg
assets/icons/rotate-ccw.svg
assets/icons/ruler.svg
assets/icons/info.svg
assets/icons/settings.svg
assets/icons/crop.svg
assets/icons/telescope.svg
assets/icons/bookmark.svg
assets/icons/library.svg
assets/icons/gear.svg
assets/icons/tube.svg
assets/icons/trash.svg
assets/icons/download.svg
assets/icons/panorama.svg
assets/icons/hdr.svg
assets/icons/folder.svg
assets/icons/home.svg
assets/icons/eye.svg
assets/icons/copy.svg
assets/icons/clipboard-paste.svg
assets/icons/star.svg
assets/icons/filter.svg
assets/icons/copy-menu.svg
assets/icons/clipboard-paste-menu.svg
assets/icons/rotate-cw-menu.svg
assets/icons/flip-horizontal-menu.svg
assets/icons/flip-vertical-menu.svg
)
set_target_properties(Photon PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
if(WIN32)
target_link_libraries(Photon
PRIVATE Qt6::Quick Qt6::QuickControls2 Qt6::Gui Qt6::ShaderTools Qt6::Concurrent Qt6::GuiPrivate
PRIVATE ${LibRaw_LIBRARIES}
PRIVATE ${OpenCV_LIBRARIES}
PRIVATE ${TIFF_LIBRARIES}
PRIVATE Vulkan::Vulkan
)
else()
target_link_libraries(Photon
PRIVATE Qt6::Quick Qt6::QuickControls2 Qt6::Gui Qt6::ShaderTools Qt6::Concurrent Qt6::GuiPrivate
PRIVATE ${LIBRAW_LIBRARIES}
PRIVATE ${OPENCV_LIBRARIES}
PRIVATE ${TIFF_LIBRARIES}
PRIVATE Vulkan::Vulkan
)
endif()
# Performance Optimizations
if(MSVC)
target_compile_options(Photon PRIVATE /O2 /arch:AVX2 /GL)
target_link_options(Photon PRIVATE /LTCG)
else()
target_compile_options(Photon PRIVATE -O3 -mavx2 -mfma -flto=auto)
target_link_options(Photon PRIVATE -flto=auto)
endif()
target_include_directories(Photon PRIVATE
src
src/engine
src/components
src/managers
${CMAKE_CURRENT_BINARY_DIR}
$<$<NOT:$<BOOL:${WIN32}>>:/usr/include/qt6/QtGui/6.10.1>
$<$<NOT:$<BOOL:${WIN32}>>:/usr/include/qt6/QtGui/6.10.1/QtGui>
$<$<NOT:$<BOOL:${WIN32}>>:${OPENCV_INCLUDE_DIRS}>
)
# Ensure QML types are registered before main
set_target_properties(Photon PROPERTIES
QT_QML_IMPORT_PATH "${CMAKE_BINARY_DIR}/Main"
)
include(GNUInstallDirs)
install(TARGETS Photon
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
qt_generate_deploy_app_script(
TARGET Photon
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
qt_generate_deploy_qml_app_script(
TARGET Photon
OUTPUT_SCRIPT deploy_script
)
install(SCRIPT ${deploy_script})
# Install QML content
install(DIRECTORY content/ DESTINATION ${CMAKE_INSTALL_BINDIR}/content)
# Install Assets
install(DIRECTORY assets/ DESTINATION ${CMAKE_INSTALL_BINDIR}/assets)
# Install vcpkg DLLs on Windows
# if(WIN32)
# Find LibRaw DLL based on build configuration
# if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# file(GLOB LIBRAW_DLL "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin/rawd.dll")
# else()
# file(GLOB LIBRAW_DLL "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/raw.dll")
# endif()
# if(LIBRAW_DLL)
# install(FILES ${LIBRAW_DLL} DESTINATION ${CMAKE_INSTALL_BINDIR})
# endif()
#
# # Find and install all vcpkg DLLs (but not raw.dll again)
# file(GLOB VCPKG_DLLS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/*.dll")
# if(VCPKG_DLLS)
# list(REMOVE_ITEM VCPKG_DLLS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/raw.dll")
# install(FILES ${VCPKG_DLLS} DESTINATION ${CMAKE_INSTALL_BINDIR})
# endif()
#endif()
if(WIN32)
# 1. Determine the correct vcpkg bin folder based on build type
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(VCPKG_BIN_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin")
else()
set(VCPKG_BIN_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
endif()
# 2. Grab ALL DLLs from that folder (this handles LibRaw, OpenCV, and any others automatically)
file(GLOB VCPKG_DLLS "${VCPKG_BIN_DIR}/*.dll")
# 3. Install them
if(VCPKG_DLLS)
install(FILES ${VCPKG_DLLS} DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
if(WIN32)
set(CPACK_GENERATOR "WIX")
set(CPACK_WIX_UPGRADE_GUID "d2b3c4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e")
set(CPACK_PACKAGE_VENDOR "RBLabs")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Photon")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icons/photon.png")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
endif()
set(CPACK_PACKAGE_NAME "Photon")
set(CPACK_PACKAGE_CONTACT "support@rblabs.net")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High-performance native RAW image editor")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
include(CPack)
enable_testing()
add_subdirectory(tests)