-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
196 lines (157 loc) · 6.77 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
# Depends on Qt, QtCoreUtilities, QtWidgetsUtilities, QtXmlUtilities,
# SimpleFugue, VenturousCore.
set(Target_Name Venturous)
set(CAP_Target_Name VENTUROUS)
set(Tool_Name Ventool)
set(PATH_TO_MODULES modules)
set(PATH_TO_VEDG_TOOLS ${PATH_TO_MODULES}/vedgTools)
set(PATH_TO_CMAKE_MODULES
${CMAKE_CURRENT_SOURCE_DIR}/${PATH_TO_VEDG_TOOLS}/CMakeModules)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PATH_TO_CMAKE_MODULES})
include(vedgTools/CMakeLicense)
include(vedgTools/ExecutableQtStart)
set(PREFERENCES_DIR ~/.config/venturous CACHE STRING
"Directory that contains user preferences and playlist.")
option(ALWAYS_EMBED_ICONS
"Always bundle icons with the executable. If disabled, embedding will be done only for WIN32 target."
ON)
option(ADAPT_CUSTOM_ACTIONS_IF_WIN32
"Adapt custom actions for MS Windows for WIN32 target. This option has no effect for other targets."
ON)
option(DEBUG_VENTUROUS "Print details of internal workflow to stdout." OFF)
option(BUILD_VENTOOL "Build ${Tool_Name} along with ${Target_Name}." ON)
project(${Target_Name})
include(vedgTools/SetCxxFlags)
include(vedgTools/ExecutableFindQt)
executableFindQt(Qt5Core Qt5Xml Qt5Widgets . QTCORE QTXML QTGUI)
include(vedgTools/AddErrorPrefixDefinition)
if(DEBUG_VENTUROUS)
set(DEBUG_QT_WIDGETS_UTILITIES TRUE)
endif()
include(vedgTools/ExecutableGetPublicHeadersProperty)
add_subdirectory(${PATH_TO_VEDG_TOOLS}/QtCoreUtilities)
executableGetPublicHeadersProperty(QtCoreUtilities)
add_subdirectory(${PATH_TO_VEDG_TOOLS}/QtWidgetsUtilities)
executableGetPublicHeadersProperty(QtWidgetsUtilities)
add_subdirectory(${PATH_TO_VEDG_TOOLS}/QtXmlUtilities)
executableGetPublicHeadersProperty(QtXmlUtilities)
add_subdirectory(${PATH_TO_MODULES}/VenturousCore)
executableGetPublicHeadersProperty(VenturousCore)
executableGetPublicHeadersProperty(TemplateUtilities)
include(vedgTools/EnableAutomocInSources)
if(DEBUG_VENTUROUS)
add_definitions(
-DDEBUG_VENTUROUS_APPLICATION -DDEBUG_VENTUROUS_MAIN
-DDEBUG_VENTUROUS_ICONS -DDEBUG_VENTUROUS_CUSTOM_ACTIONS
-DDEBUG_VENTUROUS_CUSTOM_ACTIONS_PAGE
-DDEBUG_VENTUROUS_PREFERENCES_COMPONENT
-DDEBUG_VENTUROUS_TREE_WIDGET -DDEBUG_VENTUROUS_PLAYLIST_COMPONENT
-DDEBUG_VENTUROUS_WINDOW_UTILITIES -DDEBUG_VENTUROUS_MAIN_WINDOW
)
set(EXECUTABLE_ARGS "")
else()
set(EXECUTABLE_ARGS WIN32)
endif()
include(vedgTools/StringAppendSlashIfAbsent)
stringAppendSlashIfAbsent(PREFERENCES_DIR)
set(Executable_Name venturous)
set(Icon_Name ${Executable_Name})
add_definitions(
-DPREFERENCES_DIR=\"${PREFERENCES_DIR}\"
-DAPPLICATION_NAME=\"${Target_Name}\"
-DTOOL_NAME=\"${Tool_Name}\"
-DICON_NAME=\"${Icon_Name}\"
)
set(Sources_Path src)
set(GUI_Path ${Sources_Path}/GUI)
set(PreferencesWindow_Path ${GUI_Path}/PreferencesWindow)
set(GeneralPage_Path ${PreferencesWindow_Path}/GeneralPage)
set(PlaybackPage_Path ${PreferencesWindow_Path}/PlaybackPage)
set(AddingDirectoryPage_Path ${PreferencesWindow_Path}/AddingDirectoryPage)
set(CustomActionsPage_Path ${PreferencesWindow_Path}/CustomActionsPage)
set(MainWindow_Path ${GUI_Path}/MainWindow)
set(PreferencesComponent_Path ${MainWindow_Path}/PreferencesComponent)
set(PlaybackComponent_Path ${MainWindow_Path}/PlaybackComponent)
set(PlaylistComponent_Path ${MainWindow_Path}/PlaylistComponent)
set(MainWindowWindow_Path ${MainWindow_Path}/Window)
set(Resources_Path resources)
include_directories(
${PATH_TO_CMAKE_MODULES}/include
${QtCoreUtilities_PublicHeaders_Path}
${QtWidgetsUtilities_PublicHeaders_Path}
${QtXmlUtilities_PublicHeaders_Path}
${TemplateUtilities_PublicHeaders_Path} ${VenturousCore_PublicHeaders_Path}
${Sources_Path} ${GUI_Path}
${PreferencesWindow_Path} ${GeneralPage_Path} ${PlaybackPage_Path}
${AddingDirectoryPage_Path} ${CustomActionsPage_Path}
${MainWindow_Path} ${PreferencesComponent_Path} ${PlaybackComponent_Path}
${PlaylistComponent_Path} ${MainWindowWindow_Path}
)
set(Sources
${Sources_Path}/Application.cpp ${Sources_Path}/FilePattern.cpp
${Sources_Path}/Preferences.cpp ${Sources_Path}/main.cpp
${GUI_Path}/Icons.cpp ${GUI_Path}/Actions.cpp ${GUI_Path}/CustomActions.cpp
${PreferencesWindow_Path}/PreferencesPage.cpp
${PreferencesWindow_Path}/RevertAndRestoreDefaultsTab.cpp
${PreferencesWindow_Path}/PreferencesWindow.cpp
${GeneralPage_Path}/GeneralPage.cpp
${PlaybackPage_Path}/HistoryPreferencesFrame.cpp
${PlaybackPage_Path}/PlaybackPage.cpp
${AddingDirectoryPage_Path}/AddingPolicyFrame.cpp
${AddingDirectoryPage_Path}/PatternListWidget.cpp
${AddingDirectoryPage_Path}/AddingDirectoryPage.cpp
${CustomActionsPage_Path}/CustomActionsPage.cpp
${PreferencesComponent_Path}/PreferencesComponent.cpp
${PlaybackComponent_Path}/HistoryWidget.cpp
${PlaybackComponent_Path}/PlaybackComponent.cpp
${PlaylistComponent_Path}/TreeWidget.cpp
${PlaylistComponent_Path}/PlaylistComponent.cpp
${MainWindowWindow_Path}/MainWindow.cpp
${MainWindowWindow_Path}/MainWindow-init.cpp
${MainWindowWindow_Path}/MainWindow-help.cpp
)
include(vedgTools/QtAddResources)
qtAddResources(Resources ${Resources_Path}/Venturous.qrc)
if(ALWAYS_EMBED_ICONS OR WIN32)
qtAddResources(Resources ${Resources_Path}/SimpleFugue/SimpleFugue.qrc)
add_definitions(-DEMBEDDED_ICONS)
endif()
if(WIN32 AND ADAPT_CUSTOM_ACTIONS_IF_WIN32)
add_definitions(
-DWIN32_DEFAULT_CUSTOM_ACTIONS
-DWIN32_CUSTOM_ACTIONS_USE_BACKSLASH
)
endif()
add_executable(${Executable_Name} ${EXECUTABLE_ARGS} ${Sources} ${Resources})
include(vedgTools/LinkQt)
linkQt(${Executable_Name}
Core Xml Widgets .
${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY}
)
target_link_libraries(${Executable_Name}
QtCoreUtilities QtWidgetsUtilities QtXmlUtilities VenturousCore
)
set(Targets ${Executable_Name})
if(BUILD_VENTOOL)
set(Tool_Executable ventool)
add_definitions(-DTOOL_EXECUTABLE=\"${Tool_Executable}\")
add_executable(${Tool_Executable}
"${Sources_Path}/${Tool_Name}/${Tool_Executable}.cpp")
linkQt(${Tool_Executable} Core . ${QT_QTCORE_LIBRARY})
set(Targets ${Targets} ${Tool_Executable})
endif()
install(TARGETS ${Targets} RUNTIME DESTINATION bin)
install(FILES "${Executable_Name}.desktop" DESTINATION share/applications)
foreach(Icon_Size 16 22 24 32 48 96 256 "scalable")
set(End_Of_Path "${Icon_Size}/apps")
if (${Icon_Size} STREQUAL "scalable")
set(Icon_Extension "svg")
else()
set(End_Of_Path "${Icon_Size}x${End_Of_Path}")
set(Icon_Extension "png")
endif()
install(FILES
"${PATH_TO_MODULES}/SimpleFugue/${End_Of_Path}/${Icon_Name}.${Icon_Extension}"
DESTINATION share/icons/hicolor/${End_Of_Path})
endforeach()