CMakeLists.txt 7.89 KB
Newer Older
Nicolas Carion's avatar
Nicolas Carion committed
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
### Find packages files
find_package(LibV4L2)
set_package_properties(LibV4L2 PROPERTIES
    DESCRIPTION "video4linux support libraries"
    URL "http://freecode.com/projects/libv4l"
    TYPE RUNTIME
    PURPOSE "Required for better webcam support")

if(NOT WIN32)
    find_package(PkgConfig QUIET)
    execute_process(
        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=mltdatadir mlt-framework
        OUTPUT_VARIABLE MLT_DATADIR
        RESULT_VARIABLE MLT_DATADIR_failed)
    if(NOT MLT_DATADIR_failed)
        string(REGEX REPLACE "[\r\n]" "" MLT_DATADIR "${MLT_DATADIR}")
    endif()

    execute_process(
        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=meltbin mlt-framework
        OUTPUT_VARIABLE MLT_MELTBIN
        RESULT_VARIABLE MLT_MELTBIN_failed)
    if(NOT MLT_MELTBIN_failed)
        string(REGEX REPLACE "[\r\n]" "" MLT_MELTBIN "${MLT_MELTBIN}")
    endif()
else()
    set(MLT_MELTBIN "melt.exe")
    set(MLT_DATADIR "../share/mlt")
endif()
configure_file(mlt_config.h.in ${CMAKE_BINARY_DIR}/mlt_config.h)

Nicolas Carion's avatar
Nicolas Carion committed
32
33
34
35
36
37
38
39
check_include_files(linux/input.h HAVE_LINUX_INPUT_H)
if(HAVE_LINUX_INPUT_H)
    list(APPEND kdenlive_SRCS
        jogshuttle/jogmanager.cpp
        jogshuttle/jogaction.cpp
        jogshuttle/jogshuttle.cpp
        jogshuttle/jogshuttleconfig.cpp)
endif()
Nicolas Carion's avatar
Nicolas Carion committed
40

41
### Find source files
42
add_subdirectory(abstractmodel)
Nicolas Carion's avatar
Nicolas Carion committed
43
add_subdirectory(assets)
44
add_subdirectory(bin)
Vincent PINON's avatar
Vincent PINON committed
45
add_subdirectory(capture)
46
47
add_subdirectory(dialogs)
add_subdirectory(doc)
Vincent PINON's avatar
Vincent PINON committed
48
add_subdirectory(dvdwizard)
49
50
add_subdirectory(effects)
add_subdirectory(effectslist)
51
add_subdirectory(jobs)
Vincent PINON's avatar
Vincent PINON committed
52
add_subdirectory(lib)
53
add_subdirectory(library)
54
add_subdirectory(mltcontroller)
Vincent PINON's avatar
Vincent PINON committed
55
add_subdirectory(monitor)
56
57
58
59
add_subdirectory(profiles)
add_subdirectory(project)
add_subdirectory(qml)
add_subdirectory(scopes)
60
add_subdirectory(simplekeyframes)
61
add_subdirectory(timeline2)
Vincent PINON's avatar
Vincent PINON committed
62
add_subdirectory(titler)
63
add_subdirectory(transitions)
Vincent PINON's avatar
Vincent PINON committed
64
add_subdirectory(utils)
65
add_subdirectory(widgets)
66
add_subdirectory(xml)
67
if(Qt5WebKitWidgets_FOUND)
Laurent Montel's avatar
Laurent Montel committed
68
69
    add_subdirectory(qt-oauth-lib)
endif()
70
71
## top_SRCS
file(GLOB top_SRCS "*.cpp")
72
# string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/lib/[^;]+;?" "" top_SRCS "${top_SRCS}")
73
74
75
76
77
78
79
80
81
82
83
list(REMOVE_ITEM top_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
list(APPEND kdenlive_SRCS ${top_SRCS})
## Others special cases
kconfig_add_kcfg_files(kdenlive_SRCS kdenlivesettings.kcfgc)
install(FILES kdenlivesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR})
ecm_qt_declare_logging_category(kdenlive_SRCS HEADER kdenlive_debug.h IDENTIFIER KDENLIVE_LOG CATEGORY_NAME org.kde.multimedia.kdenlive)
qt5_add_dbus_adaptor(kdenlive_SRCS org.kdenlive.MainWindow.xml mainwindow.h MainWindow)
## UI's
file(GLOB kdenlive_UIS "ui/*.ui")
ki18n_wrap_ui(kdenlive_UIS ${kdenlive_UIS})
## MOC
84
qt5_wrap_cpp(kdenlive_MOC definitions.h)
85
86
set_property(SOURCE definitions.h PROPERTY SKIP_AUTOMOC ON)

87
add_library(kdenliveLib STATIC ${kdenlive_SRCS} ${kdenlive_UIS} ${kdenlive_MOC})
88

89
qt5_add_resources(kdenlive_extra_SRCS icons.qrc ui/resources.qrc uiresources.qrc)
Vincent Pinon's avatar
Vincent Pinon committed
90
91
## Icon for Windows and OSX
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/icons/*-apps-kdenlive.png")
92
93
ecm_add_app_icon(kdenlive ICONS ${ICONS_SRCS}) # icon name = variable name
add_executable(kdenlive main.cpp ${kdenlive_extra_SRCS} ${kdenlive})
Vincent Pinon's avatar
Vincent Pinon committed
94
95
96
target_include_directories(kdenlive
    PRIVATE ${CMAKE_BINARY_DIR}
    SYSTEM ${MLT_INCLUDE_DIR} ${MLTPP_INCLUDE_DIR})
97
98
target_link_libraries(kdenlive kdenliveLib)
install(TARGETS kdenlive DESTINATION ${BIN_INSTALL_DIR})
99

100
install(FILES kdenliveui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kdenlive)
101

102
103
104

target_include_directories(kdenliveLib
    PRIVATE ${CMAKE_BINARY_DIR}
105
    ${CMAKE_CURRENT_SOURCE_DIR}
Laurent Montel's avatar
Laurent Montel committed
106
107
    ${CMAKE_CURRENT_SOURCE_DIR}/lib/external
    ${CMAKE_CURRENT_SOURCE_DIR}/lib
108
    SYSTEM ${MLT_INCLUDE_DIR} ${MLTPP_INCLUDE_DIR})
109
110
# Adds Qt definitions and include directories, and sets QT_LIBRARIES according
# to the components requested in find_package().
111
112
113
# KDE definitions and include directories *must* always come first, Qt follows
# (to avoid breaking builds when KDE and/or Qt are installed to different
# prefixes).
114
target_link_libraries(kdenliveLib
Laurent Montel's avatar
Laurent Montel committed
115
116
117
118
119
120
121
122
123
124
125
126
127
    KF5::WidgetsAddons
    KF5::Archive
    KF5::CoreAddons
    KF5::KIOCore
    KF5::KIOFileWidgets
    KF5::KIOWidgets
    KF5::NotifyConfig
    KF5::NewStuff
    KF5::DBusAddons
    KF5::XmlGui
    KF5::GuiAddons
    KF5::Notifications
    KF5::TextWidgets
128
    KF5::Declarative
Laurent Montel's avatar
Laurent Montel committed
129
    KF5::IconThemes
130
    KF5::Solid
Laurent Montel's avatar
Laurent Montel committed
131
    Qt5::Svg
132
133
134
    Qt5::Quick
    Qt5::QuickWidgets
    Qt5::Concurrent
135
    Qt5::Multimedia
Laurent Montel's avatar
Laurent Montel committed
136
137
138
139
140
141
    ${OPENGL_LIBRARIES}
    ${OPENGLES_LIBRARIES}
    ${MLT_LIBRARIES}
    ${MLTPP_LIBRARIES}
    ${CMAKE_DL_LIBS}
    ${CMAKE_THREAD_LIBS_INIT}
142
    kiss_fft)
143
if(TARGET RTTR::Core)
144
145
146
147
     target_link_libraries(kdenliveLib RTTR::Core)
else()
     target_link_libraries(kdenliveLib RTTR::Core_Lib)
endif()
148

149
if(BUILD_COVERAGE)
Nicolas Carion's avatar
Nicolas Carion committed
150
151
  target_link_libraries(kdenliveLib gcov)
endif()
152
set_property(TARGET kdenliveLib PROPERTY CXX_STANDARD 14)
153
154
155
SET(KDENLIVE_CXX_FLAGS  "${DEFAULT_CXX_FLAGS} -Wall -pedantic -Wextra")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wcast-qual -Wcast-align -Wfloat-equal -Wpointer-arith")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wunreachable-code -Wchar-subscripts -Wcomment -Wformat")
156
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wmain -Wmissing-braces")
157
158
159
160
161
162
163
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wparentheses -Wsequence-point -Wreturn-type -Wswitch")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wuninitialized -Wreorder -Wundef -Wshadow -Wwrite-strings")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wmissing-noreturn -Wsign-compare -Wsign-conversion -Wunused")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wstrict-aliasing -Wconversion -Wdisabled-optimization -Wno-undef")
SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wunused-parameter -Wshadow -Wno-variadic-macros -Wno-float-conversion")
if(KDENLIVE_COMPILER_IS_GNUCXX)
    SET(KDENLIVE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -Wlogical-op -Wunsafe-loop-optimizations ")
164
endif()
165
166
167
168
set_target_properties(kdenliveLib PROPERTIES COMPILE_FLAGS "${KDENLIVE_CXX_FLAGS}")
add_definitions(${qt5gui_definitions} -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY)
# To compile kiss_fft.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
169

170
171
172
# Optional deps
if(DRMINGW_FOUND)
    target_compile_definitions(kdenlive PRIVATE -DUSE_DRMINGW)
Vincent Pinon's avatar
Vincent Pinon committed
173
	target_include_directories(kdenlive PRIVATE SYSTEM ${DRMINGW_INCLUDE_DIR})
Vincent Pinon's avatar
Vincent Pinon committed
174
    target_link_libraries(kdenlive ${DRMINGW_LIBRARY})
175
176
elseif(KF5Crash_FOUND)
    target_compile_definitions(kdenlive PRIVATE -DKF5_USE_CRASH)
Vincent Pinon's avatar
Vincent Pinon committed
177
    target_link_libraries(kdenlive KF5::Crash)
Vincent Pinon's avatar
Vincent Pinon committed
178
179
endif()

180
181
182
if(KF5_FILEMETADATA)
    target_compile_definitions(kdenliveLib PRIVATE -DKF5_USE_FILEMETADATA)
    target_link_libraries(kdenliveLib KF5::FileMetaData)
183
184
endif()

185
186
187
if(KF5_PURPOSE)
    target_compile_definitions(kdenliveLib PRIVATE -DKF5_USE_PURPOSE)
    target_link_libraries(kdenliveLib KF5::Purpose KF5::PurposeWidgets)
188
189
endif()

190
if(Qt5WebKitWidgets_FOUND)
Laurent Montel's avatar
Laurent Montel committed
191
    message(STATUS "Found Qt5 WebKitWidgets. You can use your Freesound.org credentials to download files")
192
    target_compile_definitions(kdenliveLib PRIVATE -DQT5_USE_WEBKIT)
193
    target_link_libraries(kdenliveLib Qt5::WebKitWidgets)
194
else()
Laurent Montel's avatar
Laurent Montel committed
195
    message(STATUS "Qt5 WebKitWidgets not found. You cannot use your Freesound.org credentials, only preview files can be downloaded from the Online Resources Widget")
196
197
endif()

Alberto Villa's avatar
Alberto Villa committed
198
if(Q_WS_X11)
199
    target_include_directories(kdenliveLib PRIVATE SYSTEM ${X11_Xlib_INCLUDE_PATH})
200
    target_link_libraries(kdenliveLib ${X11_LIBRARIES})
201
endif()
202

203
if(SDL2_FOUND)
204
    target_link_libraries(kdenliveLib ${SDL2_LIBRARY})
205
elseif(SDL_FOUND)
206
    target_link_libraries(kdenliveLib ${SDL_LIBRARY})
207
endif()
208

209
if(LIBV4L2_FOUND)
210
    target_include_directories(kdenliveLib PRIVATE SYSTEM ${LIBV4L2_INCLUDE_DIR})
211
    target_link_libraries(kdenliveLib ${LIBV4L2_LIBRARY})
212
    target_compile_definitions(kdenliveLib PRIVATE -DUSE_V4L)
213
endif()
214

215
216
217
if(HAVE_LINUX_INPUT_H)
    target_compile_definitions(kdenliveLib PRIVATE -DUSE_JOGSHUTTLE)
    target_link_libraries(kdenliveLib media_ctrl)
Laurent Montel's avatar
Laurent Montel committed
218
endif()