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

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 # An odd patch version number means development version, while an even one means
0004 # stable release. An additional number can be used for bugfix-only releases.
0005 
0006 # KDE Application Version, managed by release script
0007 set (RELEASE_SERVICE_VERSION_MAJOR "22")
0008 set (RELEASE_SERVICE_VERSION_MINOR "11")
0009 set (RELEASE_SERVICE_VERSION_MICRO "70")
0010 
0011 set(KDENLIVE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0012 
0013 project(Kdenlive VERSION ${KDENLIVE_VERSION})
0014 
0015 if(POLICY CMP0063)
0016   cmake_policy(SET CMP0063 NEW)
0017 endif()
0018 if(POLICY CMP0053)
0019     cmake_policy(SET CMP0053 NEW)
0020 endif()
0021 
0022 # To be switched on when releasing.
0023 option(RELEASE_BUILD "Remove Git revision from program version" ON)
0024 option(BUILD_TESTING "Build tests" ON)
0025 option(CRASH_AUTO_TEST "Auto-generate testcases upon some crashes (uses RTTR library, needed for fuzzing)" OFF)
0026 option(BUILD_FUZZING "Build fuzzing target" OFF)
0027 option(NODBUS "Build without DBus IPC" OFF)
0028 option(USE_VERSIONLESS_TARGETS "Use versionless targets" OFF)
0029 
0030 # Minimum versions of main dependencies.
0031 set(MLT_MIN_MAJOR_VERSION 7)
0032 set(MLT_MIN_MINOR_VERSION 8)
0033 set(MLT_MIN_PATCH_VERSION 0)
0034 set(MLT_MIN_VERSION ${MLT_MIN_MAJOR_VERSION}.${MLT_MIN_MINOR_VERSION}.${MLT_MIN_PATCH_VERSION})
0035 
0036 # KDE Frameworks
0037 set(KF_DEP_VERSION "5.86.0")
0038 find_package(ECM ${KF_DEP_VERSION} REQUIRED CONFIG)
0039 set(KDE_COMPILERSETTINGS_LEVEL 5.80)
0040 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
0041 include(KDECompilerSettings NO_POLICY_SCOPE)
0042 include(FeatureSummary)
0043 include(ECMInstallIcons)
0044 include(GenerateExportHeader)
0045 include(KDEInstallDirs)
0046 include(KDECMakeSettings)
0047 include(ECMOptionalAddSubdirectory)
0048 include(ECMMarkNonGuiExecutable)
0049 include(ECMAddAppIcon)
0050 include(ECMQtDeclareLoggingCategory)
0051 include(ECMEnableSanitizers)
0052 include(ECMAddQch)
0053 if (ECM_VERSION VERSION_GREATER_EQUAL "5.89.0")
0054     include(QtVersionOption)
0055 endif()
0056 if (ECM_VERSION VERSION_GREATER_EQUAL "5.91.0")
0057     include(ECMDeprecationSettings)
0058 endif()
0059 
0060 add_definitions(-DTRANSLATION_DOMAIN=\"kdenlive\")
0061 find_package(KF5 ${KF_DEP_VERSION} REQUIRED COMPONENTS Archive Bookmarks Codecs CoreAddons Config ConfigWidgets
0062                             KIO WidgetsAddons NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes Declarative Solid
0063                  OPTIONAL_COMPONENTS DocTools FileMetaData Crash Purpose)
0064 
0065 # Qt
0066 set(QT_MIN_VERSION 5.15.2)
0067 if (NOT DEFINED QT_MAJOR_VERSION)
0068     set(QT_MAJOR_VERSION 5)
0069 endif()
0070 
0071 if (ECM_VERSION VERSION_GREATER_EQUAL "5.91.0")
0072     ecm_set_disabled_deprecation_versions(
0073         QT ${QT_MIN_VERSION}
0074         KF ${KF_DEP_VERSION}
0075     )
0076 endif()
0077 
0078 
0079 find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Core Widgets Svg Quick QuickControls2 Concurrent QuickWidgets Multimedia NetworkAuth)
0080 if (QT_MAJOR_VERSION STREQUAL "6")
0081     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS SvgWidgets)
0082 endif()
0083 if(NOT NODBUS)
0084     find_package(KF5 ${KF_DEP_VERSION} REQUIRED COMPONENTS DBusAddons)
0085     find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS DBus)
0086 endif()
0087 add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
0088 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${QT_MAJOR_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}")
0089 
0090 # MLT
0091 find_package(MLT ${MLT_MIN_VERSION} REQUIRED)
0092 set_package_properties(MLT PROPERTIES DESCRIPTION "Multimedia framework"
0093                 URL "https://mltframework.org"
0094                 PURPOSE "Required to do video processing")
0095 message(STATUS "Found MLT++: ${MLTPP_LIBRARIES}")
0096 
0097 # Windows
0098 include(CheckIncludeFiles)
0099 check_include_files(malloc.h HAVE_MALLOC_H)
0100 check_include_files(pthread.h HAVE_PTHREAD_H)
0101 if(WIN32)
0102     find_package(DrMinGW)
0103     set(MLT_PREFIX "..")
0104 else()
0105     set(MLT_PREFIX ${MLT_ROOT_DIR})
0106 endif()
0107 
0108 # macOS
0109 if(APPLE)
0110     set(DATA_INSTALL_PREFIX "")
0111 else()
0112     set(DATA_INSTALL_PREFIX "/kdenlive")
0113 endif()
0114 
0115 if(KF5FileMetaData_FOUND)
0116   message(STATUS "Found KF5 FileMetadata to extract file metadata")
0117   set(KF5_FILEMETADATA TRUE)
0118 else()
0119   message(STATUS "KF5 FileMetadata not found, file metadata will not be available")
0120 endif()
0121 
0122 if(KF5Purpose_FOUND)
0123   message(STATUS "Found KF5 Purpose, filesharing enabled")
0124   set(KF5_PURPOSE TRUE)
0125 else()
0126   message(STATUS "KF5 Purpose not found, filesharing disabled")
0127 endif()
0128 
0129 if(KF5DocTools_FOUND)
0130     add_subdirectory(doc)
0131     kdoctools_install(po)
0132 endif()
0133 
0134 # Get current version.
0135 set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION}")
0136 if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
0137   # Probably a Git workspace; determine the revision.
0138   find_package(Git QUIET)
0139   if(GIT_FOUND)
0140     exec_program(${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR}
0141           ARGS "log -n 1 --pretty=format:\"%h\""
0142       OUTPUT_VARIABLE KDENLIVE_GIT_REVISION)
0143     message(STATUS "Kdenlive Git revision: ${KDENLIVE_GIT_REVISION}")
0144     set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION} (rev. ${KDENLIVE_GIT_REVISION})")
0145   else()
0146     message(STATUS "Kdenlive Git revision could not be determined")
0147   endif()
0148 endif()
0149 
0150 if(CRASH_AUTO_TEST)
0151   find_package(RTTR 0.9.6 QUIET)
0152   if(NOT RTTR_FOUND)
0153     message(STATUS "RTTR not found on system, will download source and build it")
0154     include(rttr.CMakeLists.txt)
0155   endif()
0156   if(BUILD_FUZZING)
0157     set(ECM_ENABLE_SANITIZERS fuzzer;address)
0158   endif()
0159 endif()
0160 
0161 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0162 
0163 option(BUILD_QCH "Build source code documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0164 add_feature_info(QCH ${BUILD_QCH} "Source code documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0165 
0166 set(FFMPEG_SUFFIX "" CACHE STRING "FFmpeg custom suffix")
0167 configure_file(config-kdenlive.h.cmake config-kdenlive.h @ONLY)
0168 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
0169 
0170 # Sources
0171 add_subdirectory(src)
0172 add_subdirectory(renderer)
0173 add_subdirectory(thumbnailer)
0174 add_subdirectory(data)
0175 ki18n_install(po)
0176 
0177 if (BUILD_QCH)
0178     ecm_install_qch_export(
0179         TARGETS Kdenlive_QCH
0180         FILE KdenliveQCHTargets.cmake
0181         DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/kdenlive"
0182         COMPONENT Devel
0183     )
0184 endif()
0185 
0186 include(GNUInstallDirs)
0187 install(FILES AUTHORS README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
0188 install(DIRECTORY LICENSES DESTINATION ${CMAKE_INSTALL_DOCDIR})
0189 
0190 install(FILES kdenlive.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
0191 
0192 # Tests
0193 if(BUILD_TESTING)
0194     add_subdirectory(tests)
0195 endif()
0196 if(BUILD_FUZZING AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
0197     add_subdirectory(fuzzer)
0198 elseif(BUILD_FUZZING)
0199     message(STATUS "Fuzzing build was requested but not enabled because compiler is ${CMAKE_CXX_COMPILER_ID} and not Clang")
0200 endif()
0201 
0202 # pre-commit hook
0203 include(KDEGitCommitHooks)
0204 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0205