CMakeLists.txt 7.02 KB
Newer Older
Nicolas Carion's avatar
Nicolas Carion committed
1
2
3
4
### Find packages files
find_package(LibV4L2)
set_package_properties(LibV4L2 PROPERTIES
    DESCRIPTION "video4linux support libraries"
Yuri Chornoivan's avatar
Yuri Chornoivan committed
5
    URL "https://linuxtv.org/downloads/v4l-utils/"
Nicolas Carion's avatar
Nicolas Carion committed
6
7
8
9
10
11
    TYPE RUNTIME
    PURPOSE "Required for better webcam support")

if(NOT WIN32)
    find_package(PkgConfig QUIET)
    execute_process(
12
        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=mltdatadir mlt-framework-7
Nicolas Carion's avatar
Nicolas Carion committed
13
14
15
16
17
18
19
        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(
20
        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=meltbin mlt-framework-7
Nicolas Carion's avatar
Nicolas Carion committed
21
22
23
24
25
26
27
28
29
30
31
        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)
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
44
add_subdirectory(audiomixer)
45
add_subdirectory(bin)
Vincent Pinon's avatar
Vincent Pinon committed
46
add_subdirectory(capture)
47
48
49
50
add_subdirectory(dialogs)
add_subdirectory(doc)
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
add_subdirectory(onlineresources)
57
58
59
60
add_subdirectory(profiles)
add_subdirectory(project)
add_subdirectory(qml)
add_subdirectory(scopes)
61
add_subdirectory(simplekeyframes)
62
add_subdirectory(timeline2)
Vincent Pinon's avatar
Vincent Pinon committed
63
add_subdirectory(titler)
64
add_subdirectory(transitions)
Vincent Pinon's avatar
Vincent Pinon committed
65
add_subdirectory(utils)
66
add_subdirectory(widgets)
67
add_subdirectory(xml)
68
69
## top_SRCS
file(GLOB top_SRCS "*.cpp")
Vincent Pinon's avatar
Vincent Pinon committed
70
71
72
if(NOT CRASH_AUTO_TEST)
    list(REMOVE_ITEM top_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp)
endif()
73
# string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/lib/[^;]+;?" "" top_SRCS "${top_SRCS}")
74
75
76
77
78
79
80
81
82
83
84
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
85
qt5_wrap_cpp(kdenlive_MOC definitions.h)
86
87
set_property(SOURCE definitions.h PROPERTY SKIP_AUTOMOC ON)

88
add_library(kdenliveLib STATIC ${kdenlive_SRCS} ${kdenlive_UIS} ${kdenlive_MOC} lib/localeHandling.cpp lib/localeHandling.h)
89

Vincent Pinon's avatar
Vincent Pinon committed
90
qt5_add_resources(kdenlive_extra_SRCS icons.qrc uiresources.qrc)
Vincent Pinon's avatar
Vincent Pinon committed
91
92
## Icon for Windows and OSX
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/icons/*-apps-kdenlive.png")
93
94
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
95
96
target_include_directories(kdenlive
    PRIVATE ${CMAKE_BINARY_DIR}
97
98
99
    )
target_include_directories(kdenlive
	SYSTEM PRIVATE ${MLT_INCLUDE_DIR} ${MLTPP_INCLUDE_DIR})
100
101
target_link_libraries(kdenlive kdenliveLib)
install(TARGETS kdenlive DESTINATION ${BIN_INSTALL_DIR})
102

103
install(FILES kdenliveui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kdenlive)
104

105
106
107

target_include_directories(kdenliveLib
    PRIVATE ${CMAKE_BINARY_DIR}
108
    ${CMAKE_CURRENT_SOURCE_DIR}
Laurent Montel's avatar
Laurent Montel committed
109
110
    ${CMAKE_CURRENT_SOURCE_DIR}/lib/external
    ${CMAKE_CURRENT_SOURCE_DIR}/lib
111
112
113
    )
target_include_directories(kdenliveLib
	SYSTEM  PRIVATE ${MLT_INCLUDE_DIR} ${MLTPP_INCLUDE_DIR})
114
115
# Adds Qt definitions and include directories, and sets QT_LIBRARIES according
# to the components requested in find_package().
116
117
118
# 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).
119
target_link_libraries(kdenliveLib
Laurent Montel's avatar
Laurent Montel committed
120
121
122
123
124
125
126
127
128
129
130
131
132
    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
133
    KF5::Declarative
Laurent Montel's avatar
Laurent Montel committed
134
    KF5::IconThemes
135
    KF5::Solid
Laurent Montel's avatar
Laurent Montel committed
136
    Qt5::Svg
137
    Qt5::Quick
138
    Qt5::QuickControls2
139
140
    Qt5::QuickWidgets
    Qt5::Concurrent
141
    Qt5::Multimedia
Julius Künzel's avatar
Julius Künzel committed
142
    Qt5::NetworkAuth
Laurent Montel's avatar
Laurent Montel committed
143
144
145
146
147
148
    ${OPENGL_LIBRARIES}
    ${OPENGLES_LIBRARIES}
    ${MLT_LIBRARIES}
    ${MLTPP_LIBRARIES}
    ${CMAKE_DL_LIBS}
    ${CMAKE_THREAD_LIBS_INIT}
149
    kiss_fft)
150
if(BUILD_COVERAGE)
Nicolas Carion's avatar
Nicolas Carion committed
151
152
  target_link_libraries(kdenliveLib gcov)
endif()
153
set_property(TARGET kdenliveLib PROPERTY CXX_STANDARD 14)
154
add_definitions(${qt5gui_definitions} -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY)
155

156
# Optional deps
Vincent Pinon's avatar
Vincent Pinon committed
157
158
159
160
161
162
163
164
165
if(CRASH_AUTO_TEST)
    target_compile_definitions(kdenliveLib PRIVATE CRASH_AUTO_TEST)
    if(TARGET RTTR::Core)
        target_link_libraries(kdenliveLib RTTR::Core)
    else()
        target_link_libraries(kdenliveLib RTTR::Core_Lib)
    endif()
endif()

166
167
if(DRMINGW_FOUND)
    target_compile_definitions(kdenlive PRIVATE -DUSE_DRMINGW)
168
    target_include_directories(kdenlive SYSTEM PRIVATE ${DRMINGW_INCLUDE_DIR})
Vincent Pinon's avatar
Vincent Pinon committed
169
    target_link_libraries(kdenlive ${DRMINGW_LIBRARY})
170
171
elseif(KF5Crash_FOUND)
    target_compile_definitions(kdenlive PRIVATE -DKF5_USE_CRASH)
Vincent Pinon's avatar
Vincent Pinon committed
172
    target_link_libraries(kdenlive KF5::Crash)
Vincent Pinon's avatar
Vincent Pinon committed
173
174
endif()

175
176
177
if(KF5_FILEMETADATA)
    target_compile_definitions(kdenliveLib PRIVATE -DKF5_USE_FILEMETADATA)
    target_link_libraries(kdenliveLib KF5::FileMetaData)
178
179
endif()

180
181
182
if(KF5_PURPOSE)
    target_compile_definitions(kdenliveLib PRIVATE -DKF5_USE_PURPOSE)
    target_link_libraries(kdenliveLib KF5::Purpose KF5::PurposeWidgets)
183
184
endif()

Alberto Villa's avatar
Alberto Villa committed
185
if(Q_WS_X11)
186
	target_include_directories(kdenliveLib SYSTEM PRIVATE ${X11_Xlib_INCLUDE_PATH})
187
    target_link_libraries(kdenliveLib ${X11_LIBRARIES})
188
endif()
189

190
if(SDL2_FOUND)
191
    target_link_libraries(kdenliveLib ${SDL2_LIBRARY})
192
elseif(SDL_FOUND)
193
    target_link_libraries(kdenliveLib ${SDL_LIBRARY})
194
endif()
195

196
if(LIBV4L2_FOUND)
197
    target_include_directories(kdenliveLib SYSTEM PRIVATE ${LIBV4L2_INCLUDE_DIR})
198
    target_link_libraries(kdenliveLib ${LIBV4L2_LIBRARY})
199
    target_compile_definitions(kdenliveLib PRIVATE -DUSE_V4L)
200
endif()
201

202
203
204
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
205
endif()
206
207
208
209
210
211
212
213
214
215

if (BUILD_QCH)
    ecm_add_qch(
        Kdenlive_QCH
        NAME kdenlive
        VERSION ${KDENLIVE_VERSION}
        ORG_DOMAIN org.kde
        SOURCE_DIRS
            .
        MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md"
216
217
        TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
        QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
218
219
220
221
        COMPONENT Devel
    )
endif()