Skip to content

Commit

Permalink
Merge pull request #452 from OpenShot/release-20200229
Browse files Browse the repository at this point in the history
Release branch for libopenshot 0.2.5 (SO 19)
  • Loading branch information
jonoomph committed Mar 3, 2020
2 parents 63e28a0 + 1ced9d4 commit d0e884d
Show file tree
Hide file tree
Showing 94 changed files with 1,176 additions and 1,465 deletions.
91 changes: 56 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ addons:
- doxygen
- graphviz
- curl
- jq
packages: &ff_common # Common set of FFmpeg packages
- *p_common
- libfdk-aac-dev
Expand All @@ -34,28 +33,13 @@ addons:
- libswresample-dev

matrix:

include:
- name: "FFmpeg 2 GCC (Ubuntu 16.04 Xenial)"
env:
- BUILD_VERSION=ffmpeg2
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET="os_test"
os: linux
dist: xenial
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
packages:
- *ff_common

- name: "FFmpeg 3 GCC (Ubuntu 18.04 Bionic)"
- name: "Coverage (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=ffmpeg3
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
- BUILD_VERSION=coverage_ffmpeg34
- CMAKE_EXTRA_ARGS="-DENABLE_COVERAGE=1"
- TEST_TARGET=coverage
os: linux
dist: bionic
addons:
Expand All @@ -66,6 +50,8 @@ matrix:
packages:
- *ff_common
- qt5-default
- lcov
- binutils-common # For c++filt

- name: "FFmpeg 4 GCC (Ubuntu 18.04 Bionic)"
env:
Expand All @@ -83,6 +69,7 @@ matrix:
packages:
- *ff_common
- qt5-default
- libjsoncpp-dev
- libavcodec58
- libavformat58
- libavdevice58
Expand All @@ -93,14 +80,13 @@ matrix:
- libavresample4
- libswresample3

- name: "FFmpeg 3 Clang (Ubuntu 18.04 Bionic)"
- name: "FFmpeg 3.4 GCC (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=clang_ffmpeg3
- BUILD_VERSION=ffmpeg34
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
compiler: clang
addons:
apt:
sources:
Expand All @@ -109,16 +95,16 @@ matrix:
packages:
- *ff_common
- qt5-default
- libomp-dev
- libjsoncpp-dev


- name: "Coverage (Ubuntu 18.04 Bionic)"
- name: "FFmpeg 3.4 Clang (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=coverage_ffmpeg3
- CMAKE_EXTRA_ARGS="-DENABLE_COVERAGE=1"
- TEST_TARGET=coverage
- BUILD_VERSION=clang_ffmpeg34
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
compiler: clang
addons:
apt:
sources:
Expand All @@ -127,12 +113,47 @@ matrix:
packages:
- *ff_common
- qt5-default
- lcov
- binutils-common # For c++filt
- libomp-dev

- name: "FFmpeg 3.2 GCC (Ubuntu 16.04 Xenial)"
env:
- BUILD_VERSION=ffmpeg32
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET="os_test"
os: linux
dist: xenial
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
- sourceline: 'ppa:jon-hedgerows/ffmpeg-backports'
packages:
- *ff_common
- libavcodec57
- libavdevice57
- libavfilter6
- libavformat57
- libavresample3
- libavutil55
- libpostproc54
- libswresample2
- libswscale4

before_script:
- CODACY_VERSION="$(curl -Ls https://api.bintray.com/packages/codacy/Binaries/codacy-coverage-reporter/versions/_latest | jq -r .name)"
- if [ "x${TEST_TARGET}" = "xcoverage" ]; then curl -Ls -o codacy-coverage-reporter "https://dl.bintray.com/codacy/Binaries/${CODACY_VERSION}/codacy-coverage-reporter-linux"; chmod +x codacy-coverage-reporter; fi
- name: "FFmpeg 2 GCC (Ubuntu 16.04 Xenial)"
env:
- BUILD_VERSION=ffmpeg2
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET="os_test"
os: linux
dist: xenial
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
packages:
- *ff_common

script:
- mkdir -p build; cd build;
Expand All @@ -143,4 +164,4 @@ script:
- cd ..

after_success:
- if [ "x${TEST_TARGET}" = "xcoverage" ]; then ./codacy-coverage-reporter report -l CPP -r build/coverage.info; fi
- if [ "x$TEST_TARGET" = "xcoverage" ]; then bash <(curl -s https://codecov.io/bash) -f build/coverage.info || echo "Codecov did not collect coverage reports"; fi
69 changes: 48 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ For more information, please visit <http://www.openshot.org/>.
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")

################ PROJECT VERSION ####################
set(PROJECT_VERSION_FULL "0.2.4")
set(PROJECT_SO_VERSION 18)
set(PROJECT_VERSION_FULL "0.2.5")
set(PROJECT_SO_VERSION 19)

# Remove the dash and anything following, to get the #.#.# version for project()
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")
Expand Down Expand Up @@ -73,16 +73,37 @@ include(FeatureSummary)
# Optional build settings for libopenshot
option(USE_SYSTEM_JSONCPP "Use system installed JsonCpp, if found" ON)
option(DISABLE_BUNDLED_JSONCPP "Don't fall back to bundled JsonCpp" OFF)
option(DISABLE_TESTS "Don't build unit tests" OFF)
option(ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF)
option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
option(ENABLE_TESTS "Build unit tests (requires UnitTest++)" ON)
option(ENABLE_DOCS "Build API documentation (requires Doxygen)" ON)

# Legacy commandline override
if (DISABLE_TESTS)
if(ENABLE_COVERAGE)
message(WARNING "ENABLE_COVERAGE requires tests, overriding DISABLE_TESTS")
set(ENABLE_TESTS ON)
else()
set(ENABLE_TESTS OFF)
endif()
endif()

if(DEFINED ENABLE_TESTS)
set(ENABLE_TESTS ${ENABLE_TESTS} CACHE BOOL "Build unit tests (requires UnitTest++)" FORCE)
endif()

########## Configure Version.h header ##############
configure_file(include/OpenShotVersion.h.in include/OpenShotVersion.h @ONLY)
# We'll want that installed later
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/OpenShotVersion.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libopenshot)

#### Work around a GCC < 9 bug with handling of _Pragma() in macros
#### See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.0.0"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-integrated-cpp")
endif()

#### Enable C++11 (for std::shared_ptr support)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -108,7 +129,7 @@ if (ENABLE_COVERAGE)
message(STATUS "Coverage enabled, setting build type to Debug")
endif()
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
append_coverage_compiler_flags()
endif()
add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate report")

Expand All @@ -117,27 +138,33 @@ add_subdirectory(src)

################### DOCUMENTATION ###################
# Find Doxygen (used for documentation)
include(cmake/Modules/UseDoxygen.cmake)

# Doxygen was found
if (TARGET doc)
message(STATUS "Doxygen found, documentation target enabled")
message("\nTo compile documentation in doc/html, run: 'make doc'")

# Install docs, if the user builds them with `make doc`
install(CODE "MESSAGE(\"Checking for documentation files to install...\")")
install(CODE "MESSAGE(\"(Compile with 'make doc' command, requires Doxygen)\")")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html/
DESTINATION ${CMAKE_INSTALL_DOCDIR}/API
MESSAGE_NEVER # Don't spew about file copies
OPTIONAL ) # No error if the docs aren't found
set(DOCS_ENABLED FALSE) # Only set true if Doxygen is found and configured
if (ENABLE_DOCS)
include(cmake/Modules/UseDoxygen.cmake)

# Doxygen was found
if (TARGET doc)
message(STATUS "Doxygen found, documentation target enabled")
set(DOCS_ENABLED TRUE)

# Install docs, if the user builds them with `make doc`
install(CODE "MESSAGE(\"Checking for documentation files to install...\")")
install(CODE "MESSAGE(\"(Compile with 'make doc' command, requires Doxygen)\")")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html/
DESTINATION ${CMAKE_INSTALL_DOCDIR}/API
MESSAGE_NEVER # Don't spew about file copies
OPTIONAL ) # No error if the docs aren't found
endif()
endif()
add_feature_info("Documentation" DOCS_ENABLED "Build API documentation with 'make doc'")

############# PROCESS tests/ DIRECTORY ##############
if(NOT DISABLE_TESTS)
if(ENABLE_TESTS)
set(TESTS_ENABLED TRUE) # May be overridden by tests/CMakeLists.txt
add_subdirectory(tests)
endif()
add_feature_info("Unit tests" TESTS_ENABLED "Compile unit tests for library functions")

############## COVERAGE REPORTING #################
if (ENABLE_COVERAGE)
Expand Down
33 changes: 27 additions & 6 deletions cmake/Modules/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
# 2019-12-19, FeRD (Frank Dana)
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
#
# 2020-01-19, Bob Apthorpe
# - Added gfortran support
#
# 2020-02-17, FeRD (Frank Dana)
# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters
# in EXCLUDEs, and remove manual escaping from gcovr targets
#
# USAGE:
#
# 1. Copy this file into your cmake modules path.
Expand Down Expand Up @@ -122,12 +129,22 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
# Do nothing; exit conditional without error if true
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
# Do nothing; exit conditional without error if true
else()
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
endif()

set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")

set(CMAKE_Fortran_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
FORCE )
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
Expand All @@ -145,6 +162,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_Fortran_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
Expand All @@ -154,7 +172,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
endif()

Expand Down Expand Up @@ -242,6 +260,7 @@ function(setup_target_for_coverage_lcov)

WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)

Expand Down Expand Up @@ -304,9 +323,8 @@ function(setup_target_for_coverage_gcovr_xml)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()

add_custom_target(${Coverage_NAME}
Expand All @@ -321,6 +339,7 @@ function(setup_target_for_coverage_gcovr_xml)
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce Cobertura code coverage report."
)

Expand Down Expand Up @@ -376,9 +395,8 @@ function(setup_target_for_coverage_gcovr_html)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()

add_custom_target(${Coverage_NAME}
Expand All @@ -393,9 +411,11 @@ function(setup_target_for_coverage_gcovr_html)
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}/index.html

BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce HTML code coverage report."
)

Expand All @@ -410,5 +430,6 @@ endfunction() # setup_target_for_coverage_gcovr_html
function(append_coverage_compiler_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # append_coverage_compiler_flags

0 comments on commit d0e884d

Please sign in to comment.