You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Merge branch 'develop' into ferdnyc-patch-1
This commit is contained in:
22
.github/stale.yml
vendored
Normal file
22
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 90
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 10
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- enhancement
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as **stale** because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Only close issues
|
||||
only: issues
|
||||
# Don't close issues which are assigned to somebody
|
||||
exemptAssignees: true
|
||||
@@ -24,7 +24,7 @@ linux-builder:
|
||||
- ~/auto-update-docs "$CI_PROJECT_DIR/build" "$CI_COMMIT_REF_NAME"
|
||||
- mv install-x64/lib/python3.4/site-packages/*openshot* install-x64/python
|
||||
- echo -e "CI_PROJECT_NAME:$CI_PROJECT_NAME\nCI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME\nCI_COMMIT_SHA:$CI_COMMIT_SHA\nCI_JOB_ID:$CI_JOB_ID" > "install-x64/share/$CI_PROJECT_NAME"
|
||||
- git log $(git describe --tags --abbrev=0)..HEAD --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
- git log $(git describe --tags --abbrev=0 @^)..@ --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
when: always
|
||||
except:
|
||||
- tags
|
||||
@@ -46,12 +46,12 @@ mac-builder:
|
||||
- export LIBOPENSHOT_AUDIO_DIR=$CI_PROJECT_DIR/build/install-x64
|
||||
- mkdir -p build; cd build;
|
||||
- mkdir -p install-x64/python;
|
||||
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc48/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/local/opt/gcc48/bin/gcc-4.8 -DCMAKE_PREFIX_PATH=/usr/local/qt5/5.5/clang_64 -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib -DPython_FRAMEWORKS=/Library/Frameworks/Python.framework/ -D"CMAKE_BUILD_TYPE:STRING=Debug" -D"CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" -D"CMAKE_OSX_DEPLOYMENT_TARGET=10.9" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" ../
|
||||
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc48/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/local/opt/gcc48/bin/gcc-4.8 -DCMAKE_PREFIX_PATH=/usr/local/qt5/5.5/clang_64 -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib -DPython_FRAMEWORKS=/Library/Frameworks/Python.framework/ -D"CMAKE_BUILD_TYPE:STRING=Release" -D"CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" -D"CMAKE_OSX_DEPLOYMENT_TARGET=10.9" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" ../
|
||||
- make
|
||||
- make install
|
||||
- mv install-x64/lib/python3.6/site-packages/*openshot* install-x64/python
|
||||
- echo -e "CI_PROJECT_NAME:$CI_PROJECT_NAME\nCI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME\nCI_COMMIT_SHA:$CI_COMMIT_SHA\nCI_JOB_ID:$CI_JOB_ID" > "install-x64/share/$CI_PROJECT_NAME"
|
||||
- git log $(git describe --tags --abbrev=0)..HEAD --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
- git log $(git describe --tags --abbrev=0 @^)..@ --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
when: always
|
||||
except:
|
||||
- tags
|
||||
@@ -79,8 +79,8 @@ windows-builder-x64:
|
||||
- mingw32-make install
|
||||
- Move-Item -Force -path "install-x64\lib\python3.7\site-packages\*openshot*" -destination "install-x64\python\"
|
||||
- New-Item -path "install-x64/share/" -Name "$CI_PROJECT_NAME" -Value "CI_PROJECT_NAME:$CI_PROJECT_NAME`nCI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME`nCI_COMMIT_SHA:$CI_COMMIT_SHA`nCI_JOB_ID:$CI_JOB_ID" -ItemType file -force
|
||||
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0)
|
||||
- git log "$PREV_GIT_LABEL..HEAD" --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0 '@^')
|
||||
- git log "$PREV_GIT_LABEL..@" --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"
|
||||
when: always
|
||||
except:
|
||||
- tags
|
||||
@@ -108,8 +108,8 @@ windows-builder-x86:
|
||||
- mingw32-make install
|
||||
- Move-Item -Force -path "install-x86\lib\python3.7\site-packages\*openshot*" -destination "install-x86\python\"
|
||||
- New-Item -path "install-x86/share/" -Name "$CI_PROJECT_NAME" -Value "CI_PROJECT_NAME:$CI_PROJECT_NAME`nCI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME`nCI_COMMIT_SHA:$CI_COMMIT_SHA`nCI_JOB_ID:$CI_JOB_ID" -ItemType file -force
|
||||
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0)
|
||||
- git log "$PREV_GIT_LABEL..HEAD" --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x86/share/$CI_PROJECT_NAME.log"
|
||||
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0 '@^')
|
||||
- git log "$PREV_GIT_LABEL..@" --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x86/share/$CI_PROJECT_NAME.log"
|
||||
when: always
|
||||
except:
|
||||
- tags
|
||||
|
||||
83
.travis.yml
83
.travis.yml
@@ -18,6 +18,7 @@ addons:
|
||||
- qtmultimedia5-dev
|
||||
- doxygen
|
||||
- graphviz
|
||||
- curl
|
||||
packages: &ff_common # Common set of FFmpeg packages
|
||||
- *p_common
|
||||
- libfdk-aac-dev
|
||||
@@ -33,20 +34,12 @@ addons:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: "FFmpeg 2 GCC (Ubuntu 16.04 Xenial)"
|
||||
env: BUILD_VERSION=ffmpeg2
|
||||
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)"
|
||||
env: BUILD_VERSION=ffmpeg3
|
||||
- name: "Coverage + FFmpeg 3.4 GCC (Ubuntu 18.04 Bionic)"
|
||||
env:
|
||||
- BUILD_VERSION=coverage_ffmpeg34
|
||||
- CMAKE_EXTRA_ARGS="-DENABLE_COVERAGE=1"
|
||||
- TEST_TARGET=coverage
|
||||
os: linux
|
||||
dist: bionic
|
||||
addons:
|
||||
@@ -57,9 +50,15 @@ matrix:
|
||||
packages:
|
||||
- *ff_common
|
||||
- qt5-default
|
||||
- libjsoncpp-dev
|
||||
- lcov
|
||||
- binutils-common # For c++filt
|
||||
|
||||
- name: "FFmpeg 4 GCC (Ubuntu 18.04 Bionic)"
|
||||
env: BUILD_VERSION=ffmpeg4
|
||||
env:
|
||||
- BUILD_VERSION=ffmpeg4
|
||||
- CMAKE_EXTRA_ARGS=""
|
||||
- TEST_TARGET=test
|
||||
os: linux
|
||||
dist: bionic
|
||||
addons:
|
||||
@@ -71,6 +70,7 @@ matrix:
|
||||
packages:
|
||||
- *ff_common
|
||||
- qt5-default
|
||||
- libjsoncpp-dev
|
||||
- libavcodec58
|
||||
- libavformat58
|
||||
- libavdevice58
|
||||
@@ -81,8 +81,11 @@ matrix:
|
||||
- libavresample4
|
||||
- libswresample3
|
||||
|
||||
- name: "FFmpeg 3 Clang (Ubuntu 18.04 Bionic)"
|
||||
env: BUILD_VERSION=ffmpeg3
|
||||
- name: "FFmpeg 3.4 Clang (Ubuntu 18.04 Bionic)"
|
||||
env:
|
||||
- BUILD_VERSION=clang_ffmpeg34
|
||||
- CMAKE_EXTRA_ARGS=""
|
||||
- TEST_TARGET=test
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: clang
|
||||
@@ -96,9 +99,53 @@ matrix:
|
||||
- qt5-default
|
||||
- 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
|
||||
|
||||
- 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;
|
||||
- cmake -DCMAKE_BUILD_TYPE:STRING="Debug" ../
|
||||
- cmake -DCMAKE_BUILD_TYPE:STRING="Debug" ${CMAKE_EXTRA_ARGS} ../
|
||||
- make VERBOSE=1
|
||||
- make os_test
|
||||
- make ${TEST_TARGET}
|
||||
- make install DESTDIR="$BUILD_VERSION"
|
||||
- cd ..
|
||||
|
||||
after_success:
|
||||
- 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
|
||||
|
||||
100
CMakeLists.txt
100
CMakeLists.txt
@@ -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.3-dev1")
|
||||
set(PROJECT_SO_VERSION 17)
|
||||
set(PROJECT_VERSION_FULL "0.2.5-dev2")
|
||||
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}")
|
||||
@@ -66,12 +66,44 @@ Generating build files for OpenShot with CMake ${CMAKE_VERSION}
|
||||
# in order to properly configure CMAKE_INSTALL_LIBDIR path
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Collect and display summary of options/dependencies
|
||||
include(FeatureSummary)
|
||||
|
||||
################ OPTIONS ##################
|
||||
# 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(ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" 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)
|
||||
@@ -85,29 +117,67 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
############## Code Coverage #########################
|
||||
if (DISABLE_TESTS AND ENABLE_COVERAGE)
|
||||
message(WARNING "ENABLE_COVERAGE requires tests, overriding DISABLE_TESTS")
|
||||
set(DISABLE_TESTS OFF CACHE BOOL "Don't build unit tests" FORCE)
|
||||
endif()
|
||||
|
||||
if (ENABLE_COVERAGE)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
message(STATUS "Coverage enabled, setting build type to Debug")
|
||||
endif()
|
||||
include(CodeCoverage)
|
||||
append_coverage_compiler_flags()
|
||||
endif()
|
||||
add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate report")
|
||||
|
||||
############## PROCESS src/ DIRECTORIES ##############
|
||||
add_subdirectory(src)
|
||||
|
||||
################### DOCUMENTATION ###################
|
||||
# Find Doxygen (used for documentation)
|
||||
include(cmake/Modules/UseDoxygen.cmake)
|
||||
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")
|
||||
message("\nTo compile documentation in doc/html, run: 'make doc'")
|
||||
# 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 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
|
||||
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)
|
||||
setup_target_for_coverage_lcov(
|
||||
NAME coverage
|
||||
LCOV_ARGS "--no-external"
|
||||
EXECUTABLE openshot-test
|
||||
DEPENDENCIES openshot-test)
|
||||
message("Generate coverage report with 'make coverage'")
|
||||
endif()
|
||||
|
||||
########### PRINT FEATURE SUMMARY ##############
|
||||
feature_summary(WHAT ALL
|
||||
INCLUDE_QUIET_PACKAGES
|
||||
FATAL_ON_MISSING_REQUIRED_PACKAGES
|
||||
DESCRIPTION "Displaying feature summary\n\nBuild configuration:")
|
||||
|
||||
435
cmake/Modules/CodeCoverage.cmake
Normal file
435
cmake/Modules/CodeCoverage.cmake
Normal file
@@ -0,0 +1,435 @@
|
||||
# Copyright (c) 2012 - 2017, Lars Bilke
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# CHANGES:
|
||||
#
|
||||
# 2012-01-31, Lars Bilke
|
||||
# - Enable Code Coverage
|
||||
#
|
||||
# 2013-09-17, Joakim Söderberg
|
||||
# - Added support for Clang.
|
||||
# - Some additional usage instructions.
|
||||
#
|
||||
# 2016-02-03, Lars Bilke
|
||||
# - Refactored functions to use named parameters
|
||||
#
|
||||
# 2017-06-02, Lars Bilke
|
||||
# - Merged with modified version from github.com/ufz/ogs
|
||||
#
|
||||
# 2019-05-06, Anatolii Kurotych
|
||||
# - Remove unnecessary --coverage flag
|
||||
#
|
||||
# 2019-12-13, FeRD (Frank Dana)
|
||||
# - Deprecate COVERAGE_LCOVR_EXCLUDES and COVERAGE_GCOVR_EXCLUDES lists in favor
|
||||
# of tool-agnostic COVERAGE_EXCLUDES variable, or EXCLUDE setup arguments.
|
||||
# - CMake 3.4+: All excludes can be specified relative to BASE_DIRECTORY
|
||||
# - All setup functions: accept BASE_DIRECTORY, EXCLUDE list
|
||||
# - Set lcov basedir with -b argument
|
||||
# - Add automatic --demangle-cpp in lcovr, if 'c++filt' is available (can be
|
||||
# overridden with NO_DEMANGLE option in setup_target_for_coverage_lcovr().)
|
||||
# - Delete output dir, .info file on 'make clean'
|
||||
# - Remove Python detection, since version mismatches will break gcovr
|
||||
# - Minor cleanup (lowercase function names, update examples...)
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 2. Add the following line to your CMakeLists.txt:
|
||||
# include(CodeCoverage)
|
||||
#
|
||||
# 3. Append necessary compiler flags:
|
||||
# append_coverage_compiler_flags()
|
||||
#
|
||||
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
|
||||
#
|
||||
# 4. If you need to exclude additional directories from the report, specify them
|
||||
# using full paths in the COVERAGE_EXCLUDES variable before calling
|
||||
# setup_target_for_coverage_*().
|
||||
# Example:
|
||||
# set(COVERAGE_EXCLUDES
|
||||
# '${PROJECT_SOURCE_DIR}/src/dir1/*'
|
||||
# '/path/to/my/src/dir2/*')
|
||||
# Or, use the EXCLUDE argument to setup_target_for_coverage_*().
|
||||
# Example:
|
||||
# setup_target_for_coverage_lcov(
|
||||
# NAME coverage
|
||||
# EXECUTABLE testrunner
|
||||
# EXCLUDE "${PROJECT_SOURCE_DIR}/src/dir1/*" "/path/to/my/src/dir2/*")
|
||||
#
|
||||
# 4.a NOTE: With CMake 3.4+, COVERAGE_EXCLUDES or EXCLUDE can also be set
|
||||
# relative to the BASE_DIRECTORY (default: PROJECT_SOURCE_DIR)
|
||||
# Example:
|
||||
# set(COVERAGE_EXCLUDES "dir1/*")
|
||||
# setup_target_for_coverage_gcovr_html(
|
||||
# NAME coverage
|
||||
# EXECUTABLE testrunner
|
||||
# BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
|
||||
# EXCLUDE "dir2/*")
|
||||
#
|
||||
# 5. Use the functions described below to create a custom make target which
|
||||
# runs your test executable and produces a code coverage report.
|
||||
#
|
||||
# 6. Build a Debug build:
|
||||
# cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# make
|
||||
# make my_coverage_target
|
||||
#
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Check prereqs
|
||||
find_program( GCOV_PATH gcov )
|
||||
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
|
||||
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
|
||||
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
|
||||
find_program( CPPFILT_PATH NAMES c++filt )
|
||||
|
||||
if(NOT GCOV_PATH)
|
||||
message(FATAL_ERROR "gcov not found! Aborting...")
|
||||
endif() # NOT GCOV_PATH
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
|
||||
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
|
||||
endif()
|
||||
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
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."
|
||||
FORCE )
|
||||
set(CMAKE_C_FLAGS_COVERAGE
|
||||
${COVERAGE_COMPILER_FLAGS}
|
||||
CACHE STRING "Flags used by the C compiler during coverage builds."
|
||||
FORCE )
|
||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||
""
|
||||
CACHE STRING "Flags used for linking binaries during coverage builds."
|
||||
FORCE )
|
||||
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
|
||||
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
|
||||
|
||||
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" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||
link_libraries(gcov)
|
||||
endif()
|
||||
|
||||
# Defines a target for running and collection code coverage information
|
||||
# Builds dependencies, runs the given executable and outputs reports.
|
||||
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||
# the coverage generation will not complete.
|
||||
#
|
||||
# setup_target_for_coverage_lcov(
|
||||
# NAME testrunner_coverage # New target name
|
||||
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||
# DEPENDENCIES testrunner # Dependencies to build first
|
||||
# BASE_DIRECTORY "../" # Base directory for report
|
||||
# # (defaults to PROJECT_SOURCE_DIR)
|
||||
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||
# NO_DEMANGLE # Don't demangle C++ symbols
|
||||
# # even if c++filt is found
|
||||
# )
|
||||
function(setup_target_for_coverage_lcov)
|
||||
|
||||
set(options NO_DEMANGLE)
|
||||
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
|
||||
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT LCOV_PATH)
|
||||
message(FATAL_ERROR "lcov not found! Aborting...")
|
||||
endif() # NOT LCOV_PATH
|
||||
|
||||
if(NOT GENHTML_PATH)
|
||||
message(FATAL_ERROR "genhtml not found! Aborting...")
|
||||
endif() # NOT GENHTML_PATH
|
||||
|
||||
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||
if(${Coverage_BASE_DIRECTORY})
|
||||
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||
else()
|
||||
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||
set(LCOV_EXCLUDES "")
|
||||
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES})
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||
endif()
|
||||
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
|
||||
|
||||
# Conditional arguments
|
||||
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
|
||||
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
|
||||
endif()
|
||||
|
||||
# Setup target
|
||||
add_custom_target(${Coverage_NAME}
|
||||
|
||||
# Cleanup lcov
|
||||
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . -b ${BASEDIR} --zerocounters
|
||||
# Create baseline to make sure untouched files show up in the report
|
||||
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b ${BASEDIR} -o ${Coverage_NAME}.base
|
||||
|
||||
# Run tests
|
||||
COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||
|
||||
# Capturing lcov counters and generating report
|
||||
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
|
||||
# add baseline counters
|
||||
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base -a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total
|
||||
# filter collected data to final coverage report
|
||||
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove ${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info
|
||||
|
||||
# Generate HTML output
|
||||
COMMAND ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o ${Coverage_NAME} ${Coverage_NAME}.info
|
||||
|
||||
# Set output files as GENERATED (will be removed on 'make clean')
|
||||
BYPRODUCTS
|
||||
${Coverage_NAME}.base
|
||||
${Coverage_NAME}.capture
|
||||
${Coverage_NAME}.total
|
||||
${Coverage_NAME}.info
|
||||
${Coverage_NAME} # report directory
|
||||
|
||||
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."
|
||||
)
|
||||
|
||||
# Show where to find the lcov info report
|
||||
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
|
||||
)
|
||||
|
||||
endfunction() # setup_target_for_coverage_lcov
|
||||
|
||||
# Defines a target for running and collection code coverage information
|
||||
# Builds dependencies, runs the given executable and outputs reports.
|
||||
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||
# the coverage generation will not complete.
|
||||
#
|
||||
# setup_target_for_coverage_gcovr_xml(
|
||||
# NAME ctest_coverage # New target name
|
||||
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||
# DEPENDENCIES executable_target # Dependencies to build first
|
||||
# BASE_DIRECTORY "../" # Base directory for report
|
||||
# # (defaults to PROJECT_SOURCE_DIR)
|
||||
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||
# )
|
||||
function(setup_target_for_coverage_gcovr_xml)
|
||||
|
||||
set(options NONE)
|
||||
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT GCOVR_PATH)
|
||||
message(FATAL_ERROR "gcovr not found! Aborting...")
|
||||
endif() # NOT GCOVR_PATH
|
||||
|
||||
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||
if(${Coverage_BASE_DIRECTORY})
|
||||
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||
else()
|
||||
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||
set(GCOVR_EXCLUDES "")
|
||||
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||
endif()
|
||||
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
|
||||
|
||||
# Combine excludes to several -e arguments
|
||||
set(GCOVR_EXCLUDE_ARGS "")
|
||||
foreach(EXCLUDE ${GCOVR_EXCLUDES})
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
|
||||
endforeach()
|
||||
|
||||
add_custom_target(${Coverage_NAME}
|
||||
# Run tests
|
||||
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||
|
||||
# Running gcovr
|
||||
COMMAND ${GCOVR_PATH} --xml
|
||||
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
|
||||
--object-directory=${PROJECT_BINARY_DIR}
|
||||
-o ${Coverage_NAME}.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."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
|
||||
)
|
||||
endfunction() # setup_target_for_coverage_gcovr_xml
|
||||
|
||||
# Defines a target for running and collection code coverage information
|
||||
# Builds dependencies, runs the given executable and outputs reports.
|
||||
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||
# the coverage generation will not complete.
|
||||
#
|
||||
# setup_target_for_coverage_gcovr_html(
|
||||
# NAME ctest_coverage # New target name
|
||||
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||
# DEPENDENCIES executable_target # Dependencies to build first
|
||||
# BASE_DIRECTORY "../" # Base directory for report
|
||||
# # (defaults to PROJECT_SOURCE_DIR)
|
||||
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||
# )
|
||||
function(setup_target_for_coverage_gcovr_html)
|
||||
|
||||
set(options NONE)
|
||||
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT GCOVR_PATH)
|
||||
message(FATAL_ERROR "gcovr not found! Aborting...")
|
||||
endif() # NOT GCOVR_PATH
|
||||
|
||||
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||
if(${Coverage_BASE_DIRECTORY})
|
||||
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||
else()
|
||||
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||
set(GCOVR_EXCLUDES "")
|
||||
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||
endif()
|
||||
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
|
||||
|
||||
# Combine excludes to several -e arguments
|
||||
set(GCOVR_EXCLUDE_ARGS "")
|
||||
foreach(EXCLUDE ${GCOVR_EXCLUDES})
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
|
||||
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
|
||||
endforeach()
|
||||
|
||||
add_custom_target(${Coverage_NAME}
|
||||
# Run tests
|
||||
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||
|
||||
# Create folder
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
|
||||
|
||||
# Running gcovr
|
||||
COMMAND ${GCOVR_PATH} --html --html-details
|
||||
-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."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
|
||||
)
|
||||
|
||||
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
|
||||
@@ -1,28 +1,115 @@
|
||||
# - Try to find RESVG
|
||||
# Once done this will define
|
||||
# RESVG_FOUND - System has RESVG
|
||||
# RESVG_INCLUDE_DIRS - The RESVG include directories
|
||||
# RESVG_LIBRARIES - The libraries needed to use RESVG
|
||||
find_path ( RESVG_INCLUDE_DIR ResvgQt.h
|
||||
PATHS ${RESVGDIR}/include/resvg
|
||||
$ENV{RESVGDIR}/include/resvg
|
||||
$ENV{RESVGDIR}/include
|
||||
/usr/include/resvg
|
||||
/usr/include
|
||||
/usr/local/include/resvg
|
||||
/usr/local/include )
|
||||
# vim: ts=2 sw=2
|
||||
#[=======================================================================[.rst:
|
||||
FindRESVG
|
||||
---------
|
||||
Try to find the shared-library build of resvg, the Rust SVG library
|
||||
|
||||
find_library ( RESVG_LIBRARY NAMES resvg
|
||||
PATHS /usr/lib
|
||||
/usr/local/lib
|
||||
$ENV{RESVGDIR}
|
||||
$ENV{RESVGDIR}/lib )
|
||||
IMPORTED targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
set ( RESVG_LIBRARIES ${RESVG_LIBRARY} )
|
||||
set ( RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIR} )
|
||||
This module defines :prop_tgt:`IMPORTED` target ``RESVG::resvg`` when
|
||||
the library and headers are found.
|
||||
|
||||
include ( FindPackageHandleStandardArgs )
|
||||
# handle the QUIETLY and REQUIRED arguments and set RESVG_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args ( RESVG "Could NOT find RESVG, using Qt SVG parsing instead" RESVG_LIBRARY RESVG_INCLUDE_DIR )
|
||||
mark_as_advanced( RESVG_LIBRARY RESVG_INCLUDE_DIR )
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
RESVG_FOUND - Library and header files found
|
||||
RESVG_INCLUDE_DIRS - Include directory path
|
||||
RESVG_LIBRARIES - Link path to the library
|
||||
RESVG_DEFINITIONS - Compiler switches (currently unused)
|
||||
|
||||
Backwards compatibility
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
For compatibility with previous versions of this module, uppercase names
|
||||
for FFmpeg and for all components are also recognized, and all-uppercase
|
||||
versions of the cache variables are also created.
|
||||
|
||||
Control variables
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following variables can be used to provide path hints to the module:
|
||||
|
||||
RESVGDIR - Set in the calling CMakeLists.txt or on the command line
|
||||
ENV{RESVGDIR} - An environment variable in the cmake process context
|
||||
|
||||
Copyright (c) 2020, FeRD (Frank Dana) <ferdnyc@gmail.com>
|
||||
#]=======================================================================]
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# CMake 3.4+ only: Convert relative paths to absolute
|
||||
if(DEFINED RESVGDIR AND CMAKE_VERSION VERSION_GREATER 3.4)
|
||||
get_filename_component(RESVGDIR "${RESVGDIR}" ABSOLUTE
|
||||
BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
find_path(RESVG_INCLUDE_DIRS
|
||||
ResvgQt.h
|
||||
PATHS
|
||||
${RESVGDIR}
|
||||
${RESVGDIR}/include
|
||||
$ENV{RESVGDIR}
|
||||
$ENV{RESVGDIR}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
PATH_SUFFIXES
|
||||
resvg
|
||||
capi/include
|
||||
resvg/capi/include
|
||||
)
|
||||
|
||||
find_library(RESVG_LIBRARIES
|
||||
NAMES resvg
|
||||
PATHS
|
||||
${RESVGDIR}
|
||||
${RESVGDIR}/lib
|
||||
$ENV{RESVGDIR}
|
||||
$ENV{RESVGDIR}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
PATH_SUFFIXES
|
||||
resvg
|
||||
target/release
|
||||
resvg/target/release
|
||||
)
|
||||
|
||||
if (RESVG_INCLUDE_DIRS AND RESVG_LIBRARIES)
|
||||
set(RESVG_FOUND TRUE)
|
||||
endif()
|
||||
set(RESVG_LIBRARIES ${RESVG_LIBRARIES} CACHE STRING "The Resvg library link path")
|
||||
set(RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIRS} CACHE STRING "The Resvg include directories")
|
||||
set(RESVG_DEFINITIONS "" CACHE STRING "The Resvg CFLAGS")
|
||||
|
||||
mark_as_advanced(RESVG_LIBRARIES RESVG_INCLUDE_DIRS RESVG_DEFINITIONS)
|
||||
|
||||
# Give a nice error message if some of the required vars are missing.
|
||||
find_package_handle_standard_args(RESVG
|
||||
"Could NOT find RESVG, using Qt SVG parsing instead"
|
||||
RESVG_LIBRARIES RESVG_INCLUDE_DIRS )
|
||||
|
||||
# Export target
|
||||
if(RESVG_FOUND AND NOT TARGET RESVG::resvg)
|
||||
message(STATUS "Creating IMPORTED target RESVG::resvg")
|
||||
if (WIN32)
|
||||
# Windows mis-links SHARED library targets
|
||||
add_library(RESVG::resvg UNKNOWN IMPORTED)
|
||||
else()
|
||||
# Linux needs SHARED to link because libresvg has no SONAME
|
||||
add_library(RESVG::resvg SHARED IMPORTED)
|
||||
set_property(TARGET RESVG::resvg APPEND PROPERTY
|
||||
IMPORTED_NO_SONAME TRUE)
|
||||
endif()
|
||||
|
||||
set_property(TARGET RESVG::resvg APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${RESVG_INCLUDE_DIRS}")
|
||||
|
||||
set_property(TARGET RESVG::resvg APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS "${RESVG_DEFINITIONS}")
|
||||
|
||||
set_property(TARGET RESVG::resvg APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${RESVG_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
@@ -1,43 +1,59 @@
|
||||
# Locate UNITTEST
|
||||
# Locate UnitTest++
|
||||
# This module defines
|
||||
# UNITTEST++_LIBRARY
|
||||
# UNITTEST++_FOUND, if false, do not try to link to gdal
|
||||
# UNITTEST++_INCLUDE_DIR, where to find the headers
|
||||
# UnitTest++_FOUND, if successful
|
||||
# UnitTest++_LIBRARIES, the library path
|
||||
# UnitTest++_INCLUDE_DIRS, where to find the headers
|
||||
|
||||
FIND_PATH(UNITTEST++_INCLUDE_DIR UnitTest++.h
|
||||
${UNITTEST_DIR}/include/unittest++
|
||||
$ENV{UNITTEST_DIR}/include/unittest++
|
||||
$ENV{UNITTEST_DIR}/src
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_UnitTest QUIET UnitTest++)
|
||||
set(UnitTest++_VERSION ${PC_UnitTest_VERSION})
|
||||
endif()
|
||||
|
||||
|
||||
FIND_PATH(UnitTest++_INCLUDE_DIRS UnitTest++.h
|
||||
DOC
|
||||
"Location of UnitTest++ header files"
|
||||
PATH_SUFFIXES
|
||||
unittest++
|
||||
UnitTest++ # Fedora, Arch
|
||||
unittest-cpp # openSUSE
|
||||
HINTS
|
||||
${PC_UnitTest++_INCLUDEDIR}
|
||||
${PC_UnitTest++_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${UnitTest++_ROOT}
|
||||
${UNITTEST_DIR}
|
||||
$ENV{UNITTEST_DIR}/src
|
||||
$ENV{UNITTEST_DIR}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/usr/include/unittest++
|
||||
/usr/include/UnitTest++ # Fedora
|
||||
/usr/include/unittest-cpp # openSUSE
|
||||
/usr/local/include/UnitTest++/ # Arch
|
||||
/sw/include # Fink
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/local/include/UnitTest++
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment]/include
|
||||
/usr/freeware/include
|
||||
/usr/freeware
|
||||
)
|
||||
|
||||
FIND_LIBRARY(UNITTEST++_LIBRARY
|
||||
NAMES unittest++ UnitTest++
|
||||
PATHS
|
||||
${UNITTEST_DIR}/lib
|
||||
$ENV{UNITTEST_DIR}/lib
|
||||
$ENV{UNITTEST_DIR}/build
|
||||
FIND_LIBRARY(UnitTest++_LIBRARIES
|
||||
NAMES unittest++ UnitTest++
|
||||
DOC
|
||||
"Location of UnitTest++ shared library"
|
||||
HINTS
|
||||
${PC_UnitTest++_LIBDIR}
|
||||
${PC_UnitTest++_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${UnitTest++_ROOT}
|
||||
${UnitTest++_ROOT}/lib
|
||||
${UNITTEST_DIR}
|
||||
$ENV{UNITTEST_DIR}
|
||||
$ENV{UNITTEST_DIR}/lib
|
||||
$ENV{UNITTEST_DIR}/build
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/usr/lib64/ # Fedora
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
@@ -46,13 +62,24 @@ FIND_LIBRARY(UNITTEST++_LIBRARY
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
SET(UNITTEST++_FOUND "NO")
|
||||
IF(UNITTEST++_LIBRARY AND UNITTEST++_INCLUDE_DIR)
|
||||
SET(UNITTEST++_FOUND "YES")
|
||||
ENDIF(UNITTEST++_LIBRARY AND UNITTEST++_INCLUDE_DIR)
|
||||
if(UnitTest++_LIBRARIES AND UnitTest++_INCLUDE_DIRS)
|
||||
set(UnitTest++_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set UNITTEST++_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(UNITTEST++ DEFAULT_MSG
|
||||
UNITTEST++_LIBRARY UNITTEST++_INCLUDE_DIR)
|
||||
find_package_handle_standard_args(UnitTest++
|
||||
REQUIRED_VARS
|
||||
UnitTest++_LIBRARIES
|
||||
UnitTest++_INCLUDE_DIRS
|
||||
VERSION_VAR
|
||||
UnitTest++_VERSION
|
||||
)
|
||||
|
||||
# Excessive backwards-compatibility paranoia
|
||||
set(UnitTest++_LIBRARY "${UnitTest++_LIBRARIES}" PARENT_SCOPE)
|
||||
set(UnitTest++_INCLUDE_DIR "${UnitTest++_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
# Even more excessive backwards-compatibility paranoia
|
||||
set(UNITTEST++_FOUND "${UnitTest++_FOUND}" PARENT_SCOPE)
|
||||
set(UNITTEST++_LIBRARY "${UnitTest++_LIBRARIES}" PARENT_SCOPE)
|
||||
set(UNITTEST++_INCLUDE_DIR "${UnitTest++_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
|
||||
|
||||
15
codecov.yml
Normal file
15
codecov.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
codecov:
|
||||
branch: default
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
base: pr # Only post a status to pull requests
|
||||
informational: true # Don't block PRs based on coverage stats (yet?)
|
||||
ignore:
|
||||
- "/src/examples"
|
||||
- "/src/Qt/demo"
|
||||
- "/thirdparty"
|
||||
- "/doc"
|
||||
- "/cmake"
|
||||
- "/*.md"
|
||||
@@ -26,7 +26,7 @@ The following table summarizes our current level of support:
|
||||
|
||||
## Supported FFmpeg Versions
|
||||
|
||||
* HW accel is supported from FFmpeg version 3.2 (3.3 for nVidia drivers)
|
||||
* HW accel is supported from FFmpeg version 3.4
|
||||
* HW accel was removed for nVidia drivers in Ubuntu for FFmpeg 4+
|
||||
|
||||
**Notice:** The FFmpeg versions of Ubuntu and PPAs for Ubuntu show the
|
||||
|
||||
@@ -31,14 +31,6 @@
|
||||
#ifndef OPENSHOT_AUDIOBUFFERSOURCE_H
|
||||
#define OPENSHOT_AUDIOBUFFERSOURCE_H
|
||||
|
||||
/// Do not include the juce unittest headers, because it collides with unittest++
|
||||
#define __JUCE_UNITTEST_JUCEHEADER__
|
||||
|
||||
#ifndef _NDEBUG
|
||||
/// Define NO debug for JUCE on mac os
|
||||
#define _NDEBUG
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
#include "JuceHeader.h"
|
||||
|
||||
|
||||
@@ -31,14 +31,6 @@
|
||||
#ifndef OPENSHOT_AUDIOREADERSOURCE_H
|
||||
#define OPENSHOT_AUDIOREADERSOURCE_H
|
||||
|
||||
/// Do not include the juce unittest headers, because it collides with unittest++
|
||||
#define __JUCE_UNITTEST_JUCEHEADER__
|
||||
|
||||
#ifndef _NDEBUG
|
||||
/// Define NO debug for JUCE on mac os
|
||||
#define _NDEBUG
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
#include "ReaderBase.h"
|
||||
#include "JuceHeader.h"
|
||||
|
||||
@@ -31,16 +31,6 @@
|
||||
#ifndef OPENSHOT_RESAMPLER_H
|
||||
#define OPENSHOT_RESAMPLER_H
|
||||
|
||||
/// Do not include the juce unittest headers, because it collides with unittest++
|
||||
#ifndef __JUCE_UNITTEST_JUCEHEADER__
|
||||
#define __JUCE_UNITTEST_JUCEHEADER__
|
||||
#endif
|
||||
|
||||
#ifndef _NDEBUG
|
||||
// Define NO debug for JUCE on mac os
|
||||
#define _NDEBUG
|
||||
#endif
|
||||
|
||||
#include "AudioBufferSource.h"
|
||||
#include "Exceptions.h"
|
||||
#include "JuceHeader.h"
|
||||
|
||||
@@ -110,9 +110,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
virtual std::string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
|
||||
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
|
||||
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::Value for this object
|
||||
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
|
||||
virtual ~CacheBase() = default;
|
||||
|
||||
};
|
||||
|
||||
@@ -129,9 +129,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -157,10 +157,10 @@ namespace openshot
|
||||
std::string Name() { return "ChunkReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open the reader. This is required before you can access frames or data from the reader.
|
||||
void Open();
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
#ifndef OPENSHOT_CLIP_H
|
||||
#define OPENSHOT_CLIP_H
|
||||
|
||||
/// Do not include the juce unittest headers, because it collides with unittest++
|
||||
#ifndef __JUCE_UNITTEST_JUCEHEADER__
|
||||
#define __JUCE_UNITTEST_JUCEHEADER__
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <QtGui/QImage>
|
||||
@@ -192,18 +187,18 @@ namespace openshot {
|
||||
openshot::ReaderBase* Reader();
|
||||
|
||||
/// Override End() method
|
||||
float End(); ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
float End() const; ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Get all properties for a specific frame (perfect for a UI to display the current state
|
||||
/// of all properties at any time)
|
||||
std::string PropertiesJSON(int64_t requested_frame);
|
||||
std::string PropertiesJSON(int64_t requested_frame) const override;
|
||||
|
||||
/// @brief Remove an effect from the clip
|
||||
/// @param effect Remove an effect from the clip.
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
#ifndef OPENSHOT_CLIPBASE_H
|
||||
#define OPENSHOT_CLIPBASE_H
|
||||
|
||||
/// Do not include the juce unittest headers, because it collides with unittest++
|
||||
#ifndef __JUCE_UNITTEST_JUCEHEADER__
|
||||
#define __JUCE_UNITTEST_JUCEHEADER__
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include "Exceptions.h"
|
||||
@@ -61,10 +56,10 @@ namespace openshot {
|
||||
std::string previous_properties; ///< This string contains the previous JSON properties
|
||||
|
||||
/// Generate JSON for a property
|
||||
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
|
||||
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const;
|
||||
|
||||
/// Generate JSON choice for a property (dropdown properties)
|
||||
Json::Value add_property_choice_json(std::string name, int value, int selected_value);
|
||||
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -78,12 +73,12 @@ namespace openshot {
|
||||
bool operator>= ( ClipBase& a) { return (Position() >= a.Position()); }
|
||||
|
||||
/// Get basic properties
|
||||
std::string Id() { return id; } ///< Get the Id of this clip object
|
||||
float Position() { return position; } ///< Get position on timeline (in seconds)
|
||||
int Layer() { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
|
||||
float Start() { return start; } ///< Get start position (in seconds) of clip (trim start of video)
|
||||
float End() { return end; } ///< Get end position (in seconds) of clip (trim end of video)
|
||||
float Duration() { return end - start; } ///< Get the length of this clip (in seconds)
|
||||
std::string Id() const { return id; } ///< Get the Id of this clip object
|
||||
float Position() const { return position; } ///< Get position on timeline (in seconds)
|
||||
int Layer() const { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
|
||||
float Start() const { return start; } ///< Get start position (in seconds) of clip (trim start of video)
|
||||
float End() const { return end; } ///< Get end position (in seconds) of clip (trim end of video)
|
||||
float Duration() const { return end - start; } ///< Get the length of this clip (in seconds)
|
||||
|
||||
/// Set basic properties
|
||||
void Id(std::string value) { id = value; } ///> Set the Id of this clip object
|
||||
@@ -93,14 +88,14 @@ namespace openshot {
|
||||
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
|
||||
|
||||
/// Get and Set JSON methods
|
||||
virtual std::string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
|
||||
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
|
||||
virtual std::string Json() const = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() const = 0; ///< Generate Json::Value for this object
|
||||
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
|
||||
|
||||
/// Get all properties for a specific frame (perfect for a UI to display the current state
|
||||
/// of all properties at any time)
|
||||
virtual std::string PropertiesJSON(int64_t requested_frame) = 0;
|
||||
virtual std::string PropertiesJSON(int64_t requested_frame) const = 0;
|
||||
|
||||
virtual ~ClipBase() = default;
|
||||
};
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace openshot {
|
||||
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace openshot {
|
||||
Coordinate(double x, double y);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user