-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (82 loc) · 2.48 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
cmake_minimum_required(VERSION 3.0)
project(Shotwin)
option(QML_FROM_SOURCE "Load QML files from source" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GetGitRevisionDescription)
git_describe(GIT_VERSION --always --dirty)
configure_file(git_version.h.in git_version.h)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc and uic automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 14)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_package(Qt5 COMPONENTS Core Widgets Sql QuickWidgets Multimedia)
set(SOURCES
main.cpp
mainwindow.cpp
models/datefilteredeventmodel.cpp
models/eventitem.cpp
models/eventmodel.cpp
models/eventortagfilteredphotomodel.cpp
models/photoitem.cpp
models/photomodel.cpp
models/tagmodel.cpp
models/treeproxymodel.cpp
settingsdialog.cpp
shotwin.cpp
thumbnailprovider.cpp
)
set(UIFORMS
mainwindow.ui
settingsdialog.ui
)
set(RESOURCES
resources.qrc
)
set(QMLFILES
BorderedImage.qml
CenteredGridView.qml
FullScreenView.qml
EventView.qml
Main.qml
PhotoView.qml
)
add_executable(${PROJECT_NAME}
${SOURCES}
${UIFORMS}
${RESOURCES}
${QMLFILES}
)
if(QML_FROM_SOURCE)
set_source_files_properties(mainwindow.cpp
PROPERTIES COMPILE_DEFINITIONS
"CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\""
)
endif()
get_target_property(libtype Qt5::Core TYPE)
if(libtype STREQUAL "STATIC_LIBRARY")
get_target_property(qtcorelocation Qt5::Core LOCATION)
get_filename_component(qtcorepath "${qtcorelocation}" DIRECTORY)
set(qtprefix "${qtcorepath}/..")
set(qtqmlprefix "${qtprefix}/share/qt5/qml")
target_link_libraries(${PROJECT_NAME}
${qtqmlprefix}/QtGraphicalEffects/libqtgraphicaleffectsplugin.a
${qtqmlprefix}/QtGraphicalEffects/private/libqtgraphicaleffectsprivate.a
${qtqmlprefix}/QtMultimedia/libdeclarative_multimedia.a
${qtqmlprefix}/QtQuick.2/libqtquick2plugin.a
${qtqmlprefix}/QtQuick/Controls/libqtquickcontrolsplugin.a
${qtqmlprefix}/QtQuick/Layouts/libqquicklayoutsplugin.a
${qtqmlprefix}/QtQuick/Window.2/libwindowplugin.a
${qtprefix}/lib/libQt5MultimediaQuick_p.a
)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC models)
target_link_libraries(${PROJECT_NAME}
Qt5::Widgets
Qt5::Sql
Qt5::QuickWidgets
Qt5::Multimedia
)