Commit 7b2134e3 authored by Vincent Pinon's avatar Vincent Pinon

CMakeLists reorganization, fix RTTR on Windows

parent fe082069
......@@ -8,13 +8,8 @@ set (KDE_APPLICATIONS_VERSION_MAJOR "19")
set (KDE_APPLICATIONS_VERSION_MINOR "03")
set (KDE_APPLICATIONS_VERSION_MICRO "70")
option(BUILD_FUZZING "Build fuzzing target" OFF)
if (BUILD_FUZZING)
SET(CMAKE_CXX_COMPILER /usr/bin/clang++)
endif()
set(KDENLIVE_VERSION ${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO})
cmake_minimum_required(VERSION 3.0)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
......@@ -22,17 +17,19 @@ endif()
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# 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)
# Minimum versions of main dependencies.
set(MLT_MIN_MAJOR_VERSION 6)
set(MLT_MIN_MINOR_VERSION 10)
set(MLT_MIN_MINOR_VERSION 12)
set(MLT_MIN_PATCH_VERSION 0)
set(MLT_MIN_VERSION ${MLT_MIN_MAJOR_VERSION}.${MLT_MIN_MINOR_VERSION}.${MLT_MIN_PATCH_VERSION})
set(QT_MIN_VERSION 5.7.0)
# KDE Frameworks
find_package(ECM 5.18.0 REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
include(KDECompilerSettings NO_POLICY_SCOPE)
......@@ -46,63 +43,37 @@ include(ECMMarkNonGuiExecutable)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMEnableSanitizers)
SET(DEFAULT_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "")
include(rttr.CMakeLists.txt)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DTRANSLATION_DOMAIN=\"kdenlive\")
find_package(KF5 REQUIRED COMPONENTS Archive Bookmarks CoreAddons Config ConfigWidgets
DBusAddons KIO WidgetsAddons NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes Declarative Solid
OPTIONAL_COMPONENTS DocTools FileMetaData Crash Purpose)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
SET(DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-unknown-warning-option")
if (BUILD_FUZZING)
SET(CMAKE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -fsanitize=fuzzer-no-link,address")
endif()
# To be switched on when releasing.
option(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
option(BUILD_TESTS "Build tests" ON)
# Qt
set(QT_MIN_VERSION 5.7.0)
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets Svg Quick Concurrent QuickWidgets)
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}")
# 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
RETURN_VALUE TAG_RESULT
)
# git log failed; maybe the repository was checked with depth=1.
if(NOT ${TAG_RESULT} EQUAL 0)
exec_program(${GIT_EXECUTABLE}
${CMAKE_SOURCE_DIR}
ARGS "describe --always"
OUTPUT_VARIABLE KDENLIVE_GIT_REVISION
)
endif()
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()
# 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}")
# Windows
include(CheckIncludeFiles)
check_include_files(malloc.h HAVE_MALLOC_H)
check_include_files(pthread.h HAVE_PTHREAD_H)
if(WIN32)
find_package(DrMinGW)
set(MLT_PREFIX "..")
else()
set(MLT_PREFIX ${MLT_ROOT_DIR})
endif()
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets Svg Quick Concurrent QuickWidgets)
find_package(Qt5 OPTIONAL_COMPONENTS WebKitWidgets QUIET)
# Optional deps status
find_package(KF5 5.23.0 OPTIONAL_COMPONENTS XmlGui QUIET)
if (KF5XmlGui_FOUND)
message(STATUS "Found KF5 >= 5.23.0 enabling icon coloring")
......@@ -111,14 +82,6 @@ else()
set(KF5_ICON_COMPATIBILITY TRUE)
endif()
find_package(KF5 REQUIRED COMPONENTS Archive Bookmarks CoreAddons Config ConfigWidgets
DBusAddons KIO WidgetsAddons NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes
Declarative Solid
OPTIONAL_COMPONENTS DocTools FileMetaData Crash Purpose)
if(WIN32)
find_package(DrMinGW)
endif(WIN32)
if (KF5FileMetaData_FOUND)
message(STATUS "Found KF5 FileMetadata to extract file metadata")
set(KF5_FILEMETADATA TRUE)
......@@ -133,38 +96,56 @@ else()
message(STATUS "KF5 Purpose not found, filesharing disabled")
endif()
# Search MLT package.
find_package(MLT ${MLT_MIN_VERSION} REQUIRED)
set_package_properties(MLT PROPERTIES
DESCRIPTION "Multimedia framework and video playout server for TV broadcasting"
URL "http://mltframework.org"
TYPE RUNTIME
PURPOSE "Required to do video processing")
if(NOT WIN32)
set(MLT_PREFIX ${MLT_ROOT_DIR})
else()
set(MLT_PREFIX "..")
endif()
add_subdirectory(data)
if(KF5DocTools_FOUND)
add_subdirectory(doc)
kdoctools_install(po)
endif()
#add_subdirectory(plugins)
add_subdirectory(renderer)
# 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()
# may need to build "rttr_project" first?
include(rttr.CMakeLists.txt)
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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# Sources
add_subdirectory(src)
add_subdirectory(renderer)
add_subdirectory(thumbnailer)
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})
############################
# Tests
############################
if (BUILD_TESTS)
message(STATUS "Building TESTS")
if (BUILD_TESTING)
message(STATUS "Building tests")
add_subdirectory(tests)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions")
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
......@@ -172,38 +153,17 @@ if (BUILD_TESTS)
${MLTPP_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/lib/external
${CMAKE_CURRENT_SOURCE_DIR}/lib
src
${CMAKE_BINARY_DIR}/rttr-install/include
)
ADD_EXECUTABLE(runTests ${Tests_SRCS})
src)
add_executable(runTests ${Tests_SRCS})
set_property(TARGET runTests PROPERTY CXX_STANDARD 14)
target_link_libraries(runTests kdenliveLib)
ADD_TEST(runTests runTests -d yes)
else()
message(STATUS "Not building TESTS")
add_test(runTests runTests -d yes)
endif()
############################
# Tests
############################
if (BUILD_FUZZING)
message(STATUS "Building FUZZING")
message(STATUS "Building fuzzing")
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_CXX_FLAGS "${KDENLIVE_CXX_FLAGS} -fsanitize=fuzzer-no-link,address")
add_subdirectory(fuzzer)
else()
message(STATUS "Not building FUZZING")
endif()
#add_subdirectory(testingArea)
ki18n_install(po)
if (KF5DocTools_FOUND)
kdoctools_install(po)
endif()
install( FILES kdenlive.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
include(GNUInstallDirs)
install( FILES AUTHORS COPYING README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
configure_file(config-kdenlive.h.cmake config-kdenlive.h @ONLY)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -248,7 +248,7 @@ cmake3 ../kdenlive \
-DPACKAGERS_BUILD=1 \
-DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON \
-DKDE_L10N_AUTO_TRANSLATIONS:BOOL=ON \
-DBUILD_TESTS=FALSE
-DBUILD_TESTING=FALSE
make -j8
make install
......
......@@ -41,7 +41,7 @@ cmake $KDENLIVE_SOURCES \
-DCMAKE_INSTALL_PREFIX:PATH=$BUILD_PREFIX/kdenlive.appdir/usr \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=FALSE \
-DBUILD_TESTS=FALSE
-DBUILD_TESTING=FALSE
# Build and Install Kdenlive (ready for the next phase)
make -j$CPU_COUNT install
......@@ -248,7 +248,7 @@ cmake3 ../kdenlive \
-DPACKAGERS_BUILD=1 \
-DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON \
-DKDE_L10N_AUTO_TRANSLATIONS:BOOL=ON \
-DBUILD_TESTS=FALSE
-DBUILD_TESTING=FALSE
make -j8
make install
......
......@@ -236,5 +236,5 @@ git_pull https://github.com/mltframework/mlt.git
configure_make mlt --enable-gpl --disable-rtaudio
#po->ruby
git_pull git://anongit.kde.org/kdenlive
cmake_make kdenlive -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DPACKAGERS_BUILD=1 -DBUILD_TESTS=FALSE
cmake_make kdenlive -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DPACKAGERS_BUILD=1 -DBUILD_TESTING=FALSE
#-DKDE_L10N_AUTO_TRANSLATIONS:BOOL=ON \
cmake_minimum_required(VERSION 3.5)
# simplify variable expansion
cmake_policy(SET CMP0053 NEW)
cmake_policy(SET CMP0010 NEW)
project(rttr-download NONE)
include(ExternalProject)
ExternalProject_Add(rttr_project
GIT_REPOSITORY https://github.com/rttrorg/rttr.git
GIT_TAG "v0.9.6"
SOURCE_DIR "${CMAKE_BINARY_DIR}/rttr-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/rttr-build"
INSTALL_DIR "${CMAKE_BINARY_DIR}/rttr-install"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=../rttr-install/ -DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_PACKAGE=OFF -DBUILD_STATIC=ONN "${CMAKE_BINARY_DIR}/rttr-src"
BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install
LOG_DOWNLOAD ON
URL https://github.com/rttrorg/rttr/archive/v0.9.6.tar.gz
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_PACKAGE=OFF -DBUILD_STATIC=ON
)
add_custom_target(rttr_final
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/rttr-install/lib*/*.a ${CMAKE_BINARY_DIR}/rttr-install
)
add_dependencies(rttr_final rttr_project)
ExternalProject_Get_Property(rttr_project install_dir)
add_library(rttr_core STATIC IMPORTED)
add_dependencies(rttr_core rttr_project)
file(MAKE_DIRECTORY "${install_dir}/include")
set_target_properties(rttr_core PROPERTIES
IMPORTED_LOCATION "${install_dir}/lib/librttr_core.a"
INTERFACE_INCLUDE_DIRECTORIES "${install_dir}/include")
This diff is collapsed.
......@@ -29,6 +29,5 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/external
${CMAKE_CURRENT_SOURCE_DIR}/lib
../src
${CMAKE_BINARY_DIR}/rttr-install/include
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment