-
-
Notifications
You must be signed in to change notification settings - Fork 556
/
CMakeLists.txt
283 lines (252 loc) · 6.89 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
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
# Olive - Non-Linear Video Editor
# Copyright (C) 2020 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Set Olive sources and resources
set(OLIVE_SOURCES
${OLIVE_SOURCES}
core.h
core.cpp
main.cpp
)
# Include resource files for specific platforms
if (WIN32)
set(OLIVE_RESOURCES
${OLIVE_RESOURCES}
packaging/windows/resources.rc
)
elseif(APPLE)
set(OLIVE_ICON packaging/macos/olive.icns)
set(OLIVE_RESOURCES
${OLIVE_RESOURCES}
${OLIVE_ICON}
)
endif()
# Add subdirectories, which will populate the above variables
add_subdirectory(audio)
add_subdirectory(cli)
add_subdirectory(codec)
add_subdirectory(common)
add_subdirectory(config)
add_subdirectory(dialog)
add_subdirectory(node)
add_subdirectory(packaging)
add_subdirectory(panel)
add_subdirectory(render)
add_subdirectory(shaders)
add_subdirectory(task)
add_subdirectory(threading)
add_subdirectory(timeline)
add_subdirectory(ts)
add_subdirectory(tool)
add_subdirectory(ui)
add_subdirectory(undo)
add_subdirectory(widget)
add_subdirectory(window)
# Add translations
qt5_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})
set(QRC_BODY "")
foreach(QM_FILE ${OLIVE_QM_FILES})
get_filename_component(QM_FILENAME_COMPONENT ${QM_FILE} NAME_WE)
string(APPEND QRC_BODY "<file alias=\"${QM_FILENAME_COMPONENT}\">${QM_FILE}</file>\n")
endforeach()
configure_file(ts/translations.qrc.in ts/translations.qrc @ONLY)
set(OLIVE_RESOURCES
${OLIVE_RESOURCES}
${CMAKE_CURRENT_BINARY_DIR}/ts/translations.qrc
)
# Add executable
add_executable(olive-editor
${OLIVE_SOURCES}
${OLIVE_RESOURCES}
)
# Set global definitions
target_compile_definitions(olive-editor PRIVATE ${OLIVE_DEFINITIONS})
# Set include directories
target_include_directories(
olive-editor
PRIVATE
${FFMPEG_INCLUDE_DIRS}
${OCIO_INCLUDE_DIRS}
${OIIO_INCLUDE_DIRS}
${OPENEXR_INCLUDES}
)
# Set compiler options
if(MSVC)
target_compile_options(
olive-editor
PRIVATE
/WX
/wd4267
/wd4244
/experimental:external
/external:anglebrackets
/external:W0
"$<$<CONFIG:RELEASE>:/O2>"
"$<$<COMPILE_LANGUAGE:CXX>:/MP>"
)
else()
target_compile_options(
olive-editor
PRIVATE
"$<$<CONFIG:RELEASE>:-O2>"
-Werror
-Wuninitialized
-pedantic-errors
-Wall
-Wextra
-Wno-unused-parameter
-Wshadow
)
endif()
# Set link libraries
target_link_libraries(
olive-editor
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Multimedia
Qt5::OpenGL
Qt5::Svg
Qt5::Concurrent
OpenGL::GL
FFMPEG::avutil
FFMPEG::avcodec
FFMPEG::avformat
FFMPEG::avfilter
FFMPEG::swscale
FFMPEG::swresample
${OCIO_LIBRARIES}
${OIIO_LIBRARIES}
${OPENEXR_LIBRARIES}
)
# Set Mac-specific properties for application
if (APPLE)
set_target_properties(olive-editor PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/MacOSXBundleInfo.plist.in
MACOSX_BUNDLE_GUI_IDENTIFIER org.olivevideoeditor.Olive
MACOSX_BUNDLE_ICON_FILE olive.icns
RESOURCE "${OLIVE_ICON}"
OUTPUT_NAME "Olive"
)
# Enables use of special functions for slider dragging
if (NOT GoogleCrashpad_FOUND)
target_link_libraries(
olive-editor
PRIVATE
"-framework ApplicationServices"
)
endif()
# HACK: Brew on macOS separates OpenEXR and IlmBase into two folders even though they seem to
# expect to be in one. This includes the IlmBase files as if they were in the same folders
# as the OpenEXR headers. This would be better rolled into FindOpenEXR.cmake.
target_include_directories(
olive-editor
PRIVATE
${ILMBASE_INCLUDES}/OpenEXR
)
endif()
# Set Linux-specific properties for application
if(UNIX AND NOT APPLE)
install(TARGETS olive-editor RUNTIME DESTINATION bin)
endif()
# Enable OTIO if found
if (OpenTimelineIO_FOUND)
target_compile_definitions(olive-editor PRIVATE USE_OTIO)
target_include_directories(
olive-editor
PRIVATE
${OTIO_INCLUDE_DIRS}
)
target_link_libraries(
olive-editor
PRIVATE
${OTIO_LIBRARIES}
)
endif()
# Enable Crashpad if found
if (GoogleCrashpad_FOUND)
# Signal code to use Crashpad
target_compile_definitions(
olive-editor
PRIVATE
USE_CRASHPAD
)
# Include Crashpad headers
target_include_directories(
olive-editor
PRIVATE
${CRASHPAD_INCLUDE_DIRS}
)
# Include Crashpad libs
target_link_libraries(
olive-editor
PRIVATE
${CRASHPAD_LIBRARIES}
)
# Create crash handler executable
add_executable(
olive-crashhandler
dialog/crashhandler/crashhandler.h
dialog/crashhandler/crashhandler.cpp
dialog/crashhandler/crashhandlermain.cpp
)
# Disable console appearing on crash handler dialog
set_target_properties(olive-crashhandler PROPERTIES
WIN32_EXECUTABLE TRUE
)
# Set crash handler includes
target_include_directories(
olive-crashhandler
PRIVATE
${CRASHPAD_INCLUDE_DIRS}
)
# Set crash handler libs
target_link_libraries(
olive-crashhandler
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Network
${CRASHPAD_LIBRARIES}
)
# Set global Olive compiler definitions
target_compile_definitions(olive-crashhandler PRIVATE ${OLIVE_DEFINITIONS})
set(CRASHPAD_HANDLER "crashpad_handler${CMAKE_EXECUTABLE_SUFFIX}")
set(MINIDUMP_STACKWALK "minidump_stackwalk${CMAKE_EXECUTABLE_SUFFIX}")
if(UNIX AND NOT APPLE)
install(TARGETS olive-crashhandler RUNTIME DESTINATION bin)
install(PROGRAMS ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} DESTINATION bin)
install(PROGRAMS ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} DESTINATION bin)
endif()
if(APPLE)
# Move crash handler executables inside Mac app bundle
add_custom_command(TARGET olive-crashhandler POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different olive-crashhandler $<TARGET_FILE_DIR:olive-editor>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} $<TARGET_FILE_DIR:olive-editor>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} $<TARGET_FILE_DIR:olive-editor>
)
endif()
endif()
# Create docs if doxygen was found
if(DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_NAME "Olive")
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
set(DOXYGEN_EXTRACT_ALL "YES")
set(DOXYGEN_EXTRACT_PRIVATE "YES")
doxygen_add_docs(docs ALL ${OLIVE_SOURCES})
endif()