CMakeLists.txt 5.88 KB
Newer Older
1
project(Kdenlive)
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
2

3 4
# An odd patch version number means development version, while an even one means
# stable release. An additional number can be used for bugfix-only releases.
5 6

# KDE Application Version, managed by release script
7
set(KDE_APPLICATIONS_VERSION_MAJOR "19")
8 9
set(KDE_APPLICATIONS_VERSION_MINOR "04")
set(KDE_APPLICATIONS_VERSION_MICRO "0")
10 11

set(KDENLIVE_VERSION ${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO})
12

Laurent Montel's avatar
Laurent Montel committed
13
cmake_minimum_required(VERSION 3.0)
Vincent Pinon's avatar
Vincent Pinon committed
14 15 16
if(POLICY CMP0063)
  cmake_policy(SET CMP0063 NEW)
endif()
17
if(POLICY CMP0053)
Laurent Montel's avatar
Laurent Montel committed
18 19
    cmake_policy(SET CMP0053 NEW)
endif()
20

21 22 23 24 25
if(BUILD_FUZZING)
  set(CMAKE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -fsanitize=fuzzer-no-link,address")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option")
Nicolas Carion's avatar
Nicolas Carion committed
26 27
endif()

28 29 30 31 32
# To be switched on when releasing.
option(RELEASE_BUILD "Remove Git revision from program version" ON)
option(BUILD_TESTING "Build tests" ON)
option(BUILD_FUZZING "Build fuzzing target" OFF)

33
# Minimum versions of main dependencies.
34
set(MLT_MIN_MAJOR_VERSION 6)
35
set(MLT_MIN_MINOR_VERSION 12)
36
set(MLT_MIN_PATCH_VERSION 0)
37
set(MLT_MIN_VERSION ${MLT_MIN_MAJOR_VERSION}.${MLT_MIN_MINOR_VERSION}.${MLT_MIN_PATCH_VERSION})
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
38

39
# KDE Frameworks
40
find_package(ECM 5.18.0 REQUIRED CONFIG)
41
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
Kevin Funk's avatar
Kevin Funk committed
42
include(KDECompilerSettings NO_POLICY_SCOPE)
43 44 45 46 47
include(FeatureSummary)
include(ECMInstallIcons)
include(GenerateExportHeader)
include(KDEInstallDirs)
include(KDECMakeSettings)
48
include(ECMOptionalAddSubdirectory)
49 50
include(ECMMarkNonGuiExecutable)
include(ECMAddAppIcon)
Laurent Montel's avatar
Laurent Montel committed
51
include(ECMQtDeclareLoggingCategory)
Nicolas Carion's avatar
Nicolas Carion committed
52
include(ECMEnableSanitizers)
53
add_definitions(-DTRANSLATION_DOMAIN=\"kdenlive\")
54
find_package(KF5 5.45.0 REQUIRED COMPONENTS Archive Bookmarks CoreAddons Config ConfigWidgets
55 56
                            DBusAddons KIO WidgetsAddons NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes Declarative Solid
                 OPTIONAL_COMPONENTS DocTools FileMetaData Crash Purpose)
57

58 59
# Qt
set(QT_MIN_VERSION 5.7.0)
60
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets Svg Quick Concurrent QuickWidgets Multimedia)
61 62 63
find_package(Qt5 OPTIONAL_COMPONENTS WebKitWidgets QUIET)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
set(DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
64

65 66 67 68 69 70
# MLT
find_package(MLT ${MLT_MIN_VERSION} REQUIRED)
set_package_properties(MLT PROPERTIES DESCRIPTION "Multimedia framework"
                URL "https://mltframework.org"
                PURPOSE "Required to do video processing")
message(STATUS "Found MLT++: ${MLTPP_LIBRARIES}")
71

72
# Windows
73 74 75
include(CheckIncludeFiles)
check_include_files(malloc.h HAVE_MALLOC_H)
check_include_files(pthread.h HAVE_PTHREAD_H)
76 77 78 79 80 81
if(WIN32)
    find_package(DrMinGW)
    set(MLT_PREFIX "..")
else()
    set(MLT_PREFIX ${MLT_ROOT_DIR})
endif()
82

83
# Optional deps status
84
find_package(KF5 5.23.0 OPTIONAL_COMPONENTS XmlGui QUIET)
85
if(KF5XmlGui_FOUND)
86 87 88 89 90 91
  message(STATUS "Found KF5 >= 5.23.0 enabling icon coloring")
else()
  message(STATUS "KF5 < 5.23.0 Disable icon coloring")
  set(KF5_ICON_COMPATIBILITY TRUE)
endif()

92
if(KF5FileMetaData_FOUND)
93 94 95 96 97
  message(STATUS "Found KF5 FileMetadata to extract file metadata")
  set(KF5_FILEMETADATA TRUE)
else()
  message(STATUS "KF5 FileMetadata not found, file metadata will not be available")
endif()
98

99
if(KF5Purpose_FOUND)
100 101 102 103 104 105
  message(STATUS "Found KF5 Purpose, filesharing enabled")
  set(KF5_PURPOSE TRUE)
else()
  message(STATUS "KF5 Purpose not found, filesharing disabled")
endif()

106
if(KF5DocTools_FOUND)
Vincent Pinon's avatar
Vincent Pinon committed
107
    add_subdirectory(doc)
108
    kdoctools_install(po)
Vincent Pinon's avatar
Vincent Pinon committed
109
endif()
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

# Get current version.
set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION}")
if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
  # Probably a Git workspace; determine the revision.
  find_package(Git QUIET)
  if(GIT_FOUND)
    exec_program(${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR}
	  ARGS "log -n 1 --pretty=format:\"%h\""
      OUTPUT_VARIABLE KDENLIVE_GIT_REVISION)
    message(STATUS "Kdenlive Git revision: ${KDENLIVE_GIT_REVISION}")
    set(KDENLIVE_VERSION_STRING "${KDENLIVE_VERSION} (rev. ${KDENLIVE_GIT_REVISION})")
  else()
    message(STATUS "Kdenlive Git revision could not be determined")
  endif()
endif()

Vincent Pinon's avatar
Vincent Pinon committed
127 128
find_package(RTTR 0.9.6 QUIET)
if(NOT RTTR_FOUND)
Nicolas Carion's avatar
Nicolas Carion committed
129
  message(STATUS "RTTR not found on system, will download source and build it")
Vincent Pinon's avatar
Vincent Pinon committed
130 131
  include(rttr.CMakeLists.txt)
endif()
132 133 134 135 136

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

set(FFMPEG_SUFFIX "" CACHE STRING "FFmpeg custom suffix")
configure_file(config-kdenlive.h.cmake config-kdenlive.h @ONLY)
137
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-suggest-override")
138 139

# Sources
140
add_subdirectory(src)
141
add_subdirectory(renderer)
142
add_subdirectory(thumbnailer)
143 144 145 146 147 148
add_subdirectory(data)
ki18n_install(po)

include(GNUInstallDirs)
install(FILES AUTHORS COPYING README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES kdenlive.categories DESTINATION ${KDE_INSTALL_CONFDIR})
149 150 151 152

############################
# Tests
############################
153

154
if(BUILD_TESTING)
155
    message(STATUS "Building tests")
156 157
    add_subdirectory(tests)

158
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions")
159 160 161 162 163 164 165
    include_directories(
        ${CMAKE_BINARY_DIR}
        ${CMAKE_BINARY_DIR}/src
        ${MLT_INCLUDE_DIR}
        ${MLTPP_INCLUDE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/external
        ${CMAKE_CURRENT_SOURCE_DIR}/lib
166 167
        src)
    add_executable(runTests ${Tests_SRCS})
168
    set_property(TARGET runTests PROPERTY CXX_STANDARD 14)
169
    target_link_libraries(runTests kdenliveLib)
170
    add_test(runTests runTests -d yes)
171
endif()
172

173
if(BUILD_FUZZING)
174 175
    message(STATUS "Building fuzzing")
	set(CMAKE_CXX_COMPILER /usr/bin/clang++)
176
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDENLIVE_CXX_FLAGS} -fsanitize=fuzzer-no-link,address")
Nicolas Carion's avatar
Nicolas Carion committed
177 178 179
    add_subdirectory(fuzzer)
endif()