Warning, /multimedia/kdenlive/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # SPDX-License-Identifier: BSD-2-Clause
0002 # SPDX-FileCopyrightText: Julius Künzel <jk.kdedev@smartlab.uber.space>, Jean-Baptiste Mardelle <jb@kdenlive.org>, Alberto Villa <avilla@FreeBSD.org>, Albert Astals Cid <aacid@kde.org>, Vincent Pinon <vpinon@kde.org>, Laurent Montel <montel@kde.org>, Vincent Pinon <vincent.pinon@asygn.com>, Nicolas Carion <french.ebook.lover@gmail.com>
0003 
0004 cmake_minimum_required(VERSION 3.16)
0005 
0006 # An odd patch version number means development version, while an even one means
0007 # stable release. An additional number can be used for bugfix-only releases.
0008 
0009 # KDE Application Version, managed by release script
0010 set (RELEASE_SERVICE_VERSION_MAJOR "24")
0011 set (RELEASE_SERVICE_VERSION_MINOR "04")
0012 set (RELEASE_SERVICE_VERSION_MICRO "70")
0013 
0014 set(KDENLIVE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0015 
0016 project(Kdenlive VERSION ${KDENLIVE_VERSION})
0017 
0018 include(FeatureSummary)
0019 include(GenerateExportHeader)
0020 
0021 # Register CMake options
0022 option(RELEASE_BUILD "Remove Git revision from program version" ON) # To be switched on when releasing.
0023 option(BUILD_TESTING "Build tests" ON)
0024 option(CRASH_AUTO_TEST "Auto-generate testcases upon some crashes (uses RTTR library, needed for fuzzing)" OFF)
0025 option(BUILD_FUZZING "Build fuzzing target" OFF)
0026 option(NODBUS "Build without DBus IPC" OFF)
0027 option(USE_VERSIONLESS_TARGETS "Use versionless targets" OFF)
0028 option(BUILD_QCH "Build source code documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0029 add_feature_info(QCH ${BUILD_QCH} "Source code documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0030 
0031 option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" OFF)
0032 
0033 # Minimum versions of main dependencies.
0034 set(MLT_MIN_MAJOR_VERSION 7)
0035 set(MLT_MIN_MINOR_VERSION 14)
0036 set(MLT_MIN_PATCH_VERSION 0)
0037 set(MLT_MIN_VERSION ${MLT_MIN_MAJOR_VERSION}.${MLT_MIN_MINOR_VERSION}.${MLT_MIN_PATCH_VERSION})
0038 
0039 # Qt version
0040 set(QT_MIN_VERSION 5.15.2)
0041 set(KF_DEP_VERSION "5.92.0")
0042 
0043 find_package(ECM ${KF_DEP_VERSION} REQUIRED CONFIG)
0044 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
0045 
0046 # Select the Qt version we want to use
0047 # Qt6 is the prefered one, Qt5 the fallback
0048 find_package(Qt6 COMPONENTS Core QUIET)
0049 
0050 if (NOT DEFINED QT_MAJOR_VERSION)
0051     if (TARGET Qt6::Core)
0052         set(QT_MAJOR_VERSION 6)
0053     else()
0054         find_package(Qt5 COMPONENTS Core QUIET)
0055         if (TARGET Qt5::Core)
0056           set(QT_MAJOR_VERSION 5)
0057         endif()
0058     endif()
0059     if(NOT QT_MAJOR_VERSION)
0060         option(BUILD_WITH_QT6 "Build against Qt 6" ON)
0061         if (BUILD_WITH_QT6)
0062             set(QT_MAJOR_VERSION 6)
0063         else()
0064             set(QT_MAJOR_VERSION 5)
0065         endif()
0066     endif()
0067 endif()
0068 
0069 # We don't use this feature and it breakes the DATADIR on Windows.
0070 # While this is a bug in ECM and should be fixed there, we can use is as a quick (workaround) fix
0071 set(KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES TRUE)
0072 
0073 ## include ECM Modules
0074 include(KDECompilerSettings NO_POLICY_SCOPE)
0075 include(ECMInstallIcons)
0076 include(KDEInstallDirs)
0077 include(KDECMakeSettings)
0078 include(ECMOptionalAddSubdirectory)
0079 include(ECMMarkNonGuiExecutable)
0080 include(ECMAddAppIcon)
0081 include(ECMQtDeclareLoggingCategory)
0082 include(ECMEnableSanitizers)
0083 include(ECMAddQch)
0084 include(ECMDeprecationSettings)
0085 remove_definitions(-DQT_NO_CAST_FROM_ASCII) # Defined in KDECompilerSettings, but we don't want that yet
0086 
0087 if (QT_MAJOR_VERSION STREQUAL "6")
0088     set(USE_VERSIONLESS_TARGETS ON)
0089 endif()
0090 
0091 # KDE Frameworks
0092 if (NOT DEFINED KF_MAJOR)
0093   set(KF_MAJOR ${QT_MAJOR_VERSION})
0094 endif()
0095 
0096 if (KF_MAJOR STREQUAL "6")
0097   set(KF_DEP_VERSION "5.240.0")
0098 endif()
0099 
0100 add_definitions(-DTRANSLATION_DOMAIN=\"kdenlive\")
0101 find_package(KF${KF_MAJOR} ${KF_DEP_VERSION}
0102     REQUIRED COMPONENTS
0103     Archive
0104     Bookmarks
0105     Codecs
0106     CoreAddons
0107     Config
0108     ConfigWidgets
0109     KIO
0110     WidgetsAddons
0111     NotifyConfig
0112     NewStuff
0113     XmlGui
0114     Notifications
0115     GuiAddons
0116     TextWidgets
0117     IconThemes
0118     Solid
0119     FileMetaData
0120     Purpose
0121 
0122     OPTIONAL_COMPONENTS
0123     DocTools
0124     Crash
0125 )
0126 
0127 if (KF_MAJOR LESS "6")
0128   find_package(KF${KF_MAJOR} ${KF_DEP_VERSION}
0129       REQUIRED COMPONENTS
0130       Declarative
0131   )
0132 endif()
0133 
0134 ecm_set_disabled_deprecation_versions(
0135     QT ${QT_MIN_VERSION}
0136     KF ${KF_DEP_VERSION}
0137 )
0138 
0139 # Qt targets
0140 find_package(Qt${QT_MAJOR_VERSION}
0141     REQUIRED COMPONENTS
0142     Core Widgets
0143     Svg
0144     Quick
0145     QuickControls2
0146     Concurrent
0147     QuickWidgets
0148     Multimedia
0149     NetworkAuth
0150 )
0151 if (QT_MAJOR_VERSION STREQUAL "6")
0152     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS SvgWidgets)
0153 endif()
0154 if(NOT NODBUS)
0155     find_package(KF${KF_MAJOR} ${KF_DEP_VERSION} REQUIRED COMPONENTS DBusAddons)
0156     find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS DBus)
0157 endif()
0158 add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
0159 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${QT_MAJOR_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}")
0160 
0161 # MLT
0162 find_package(MLT ${MLT_MIN_VERSION} REQUIRED)
0163 set_package_properties(MLT PROPERTIES DESCRIPTION "Multimedia framework"
0164                 URL "https://mltframework.org"
0165                 PURPOSE "Required to do video processing")
0166 message(STATUS "Found MLT++: ${MLTPP_LIBRARIES}")
0167 
0168 # Windows
0169 include(CheckIncludeFiles)
0170 check_include_files(malloc.h HAVE_MALLOC_H)
0171 check_include_files(pthread.h HAVE_PTHREAD_H)
0172 if(WIN32)
0173     find_package(DrMinGW)
0174     set(MLT_PREFIX "..")
0175 else()
0176     set(MLT_PREFIX ${MLT_ROOT_DIR})
0177 endif()
0178 
0179 # macOS
0180 if(APPLE)
0181     set(DATA_INSTALL_PREFIX "")
0182 else()
0183     set(DATA_INSTALL_PREFIX "/kdenlive")
0184 endif()
0185 
0186 if(KF${KF_MAJOR}DocTools_FOUND)
0187     add_subdirectory(doc)
0188     kdoctools_install(po)
0189 endif()
0190 
0191 # Get current version.
0192 set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION}")
0193 if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
0194   # Probably a Git workspace; determine the revision.
0195   find_package(Git QUIET)
0196   if(GIT_FOUND)
0197     exec_program(${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR}
0198           ARGS "log -n 1 --pretty=format:\"%h\""
0199       OUTPUT_VARIABLE KDENLIVE_GIT_REVISION)
0200     message(STATUS "Kdenlive Git revision: ${KDENLIVE_GIT_REVISION}")
0201     set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION} (rev. ${KDENLIVE_GIT_REVISION})")
0202   else()
0203     message(STATUS "Kdenlive Git revision could not be determined")
0204   endif()
0205 endif()
0206 
0207 if(CRASH_AUTO_TEST)
0208   if(BUILD_DESIGNERPLUGIN)
0209     message(SEND_ERROR "The options CRASH_AUTO_TEST and BUILD_DESIGNERPLUGIN do not work together, disable one of both.")
0210   endif()
0211   find_package(RTTR 0.9.6 QUIET)
0212   if(NOT RTTR_FOUND)
0213     message(STATUS "RTTR not found on system, will download source and build it")
0214     include(rttr.CMakeLists.txt)
0215   endif()
0216   if(BUILD_FUZZING)
0217     set(ECM_ENABLE_SANITIZERS fuzzer;address)
0218   endif()
0219 endif()
0220 
0221 set(FFMPEG_SUFFIX "" CACHE STRING "FFmpeg custom suffix")
0222 configure_file(config-kdenlive.h.cmake config-kdenlive.h @ONLY)
0223 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
0224 
0225 # Sources
0226 add_subdirectory(src)
0227 add_subdirectory(renderer)
0228 if(KF${KF_MAJOR}GuiAddons_VERSION VERSION_LESS "5.100")
0229   add_subdirectory(thumbnailer-deprecated)
0230 else()
0231   add_subdirectory(thumbnailer)
0232 endif()
0233 add_subdirectory(data)
0234 
0235 # Install
0236 ki18n_install(po)
0237 
0238 if (BUILD_QCH)
0239     ecm_install_qch_export(
0240         TARGETS Kdenlive_QCH
0241         FILE KdenliveQCHTargets.cmake
0242         DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/kdenlive"
0243         COMPONENT Devel
0244     )
0245 endif()
0246 
0247 include(GNUInstallDirs)
0248 install(FILES AUTHORS README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
0249 install(DIRECTORY LICENSES DESTINATION ${CMAKE_INSTALL_DOCDIR})
0250 
0251 ecm_qt_install_logging_categories(
0252     EXPORT KDENLIVE
0253     FILE kdenlive.categories
0254     DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
0255 )
0256 
0257 # Tests
0258 if(BUILD_TESTING)
0259     add_subdirectory(tests)
0260 endif()
0261 if(BUILD_FUZZING AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
0262     add_subdirectory(fuzzer)
0263 elseif(BUILD_FUZZING)
0264     message(STATUS "Fuzzing build was requested but not enabled because compiler is ${CMAKE_CXX_COMPILER_ID} and not Clang")
0265 endif()
0266 
0267 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0268 
0269 # pre-commit hook
0270 include(KDEGitCommitHooks)
0271 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0272