Skip to content

Commit

Permalink
Merge branch 'develop' into effect-parenting
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Apr 10, 2021
2 parents c55efd1 + 8cefd49 commit c8c92b5
Show file tree
Hide file tree
Showing 92 changed files with 3,235 additions and 2,212 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
@@ -1,4 +1,4 @@
name: CI Build
name: libopenshot CI Build
on: [push, pull_request]
jobs:
build:
Expand All @@ -13,6 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v2
# Work around a codecov issue detecting commit SHAs
# see: https://community.codecov.io/t/issue-detecting-commit-sha-please-run-actions-checkout-with-fetch-depth-1-or-set-to-0/2571
with:
fetch-depth: 0

- uses: haya14busa/action-cond@v1
id: coverage
Expand All @@ -31,8 +35,13 @@ jobs:
libopenshot-audio-dev \
qtbase5-dev qtbase5-dev-tools \
libfdk-aac-dev libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libpostproc-dev libswresample-dev \
libzmq3-dev libmagick++-dev libunittest++-dev \
libzmq3-dev libmagick++-dev \
libopencv-dev libprotobuf-dev protobuf-compiler
# Install catch2 package from Ubuntu 20.10, since for some reason
# even 20.04 only has Catch 1.12.1 available.
wget https://launchpad.net/ubuntu/+archive/primary/+files/catch2_2.13.0-1_all.deb
sudo dpkg -i catch2_2.13.0-1_all.deb
- name: Build libopenshot
shell: bash
Expand All @@ -47,7 +56,7 @@ jobs:
shell: bash
run: |
pushd build
cmake --build . --target os_test -- VERBOSE=1
cmake --build . --target coverage -- VERBOSE=1
popd
- name: Install libopenshot
Expand All @@ -61,4 +70,3 @@ jobs:
if: ${{ matrix.compiler == 'clang' }}
with:
file: build/coverage.info

91 changes: 64 additions & 27 deletions CMakeLists.txt
Expand Up @@ -73,10 +73,15 @@ 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(ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF)
option(ENABLE_TESTS "Build unit tests (requires UnitTest++)" ON)

option(ENABLE_TESTS "Build unit tests (requires Catch2)" ON)
option(ENABLE_PARALLEL_CTEST "Run CTest using multiple processors" ON)
option(ENABLE_COVERAGE "Scan test coverage using gcov and report" OFF)

option(ENABLE_DOCS "Build API documentation (requires Doxygen)" ON)

option(APPIMAGE_BUILD "Build to install in an AppImage (Linux only)" OFF)
option(ENABLE_MAGICK "Use ImageMagick, if available" ON)
option(ENABLE_OPENCV "Build with OpenCV algorithms (requires Boost, Protobuf 3)" ON)
Expand All @@ -87,7 +92,7 @@ if (DISABLE_TESTS)
endif()

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

#### Work around a GCC < 9 bug with handling of _Pragma() in macros
Expand All @@ -109,7 +114,7 @@ ENDIF(WIN32)
############## Code Coverage #########################
if (ENABLE_COVERAGE AND NOT ENABLE_TESTS)
message(WARNING "ENABLE_COVERAGE requires unit tests, forcing ENABLE_TESTS")
set(ENABLE_TESTS ON CACHE BOOL "Don't build unit tests" FORCE)
set(ENABLE_TESTS ON CACHE BOOL "Build unit tests (requires Catch2 or UnitTest++)" FORCE)
endif()

if (ENABLE_COVERAGE)
Expand Down Expand Up @@ -166,55 +171,87 @@ if (ENABLE_DOCS)
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(ENABLE_TESTS)
set(TESTS_ENABLED TRUE) # May be overridden by tests/CMakeLists.txt
find_package(Catch2 REQUIRED)
if(ENABLE_PARALLEL_CTEST)
# Figure out the amount of parallelism for CTest
include(ProcessorCount)
ProcessorCount(CPU_COUNT)
if(NOT CPU_COUNT EQUAL 0)
message(STATUS "Setting up unit tests to use ${CPU_COUNT} processors")
set(CTEST_OPTIONS "-j${CPU_COUNT}")
endif()
endif()
include(CTest)
include(Catch)
add_subdirectory(tests)
endif()
add_feature_info("Unit tests" TESTS_ENABLED "Compile unit tests for library functions")

############## COVERAGE REPORTING #################
if (ENABLE_COVERAGE)
if (ENABLE_COVERAGE AND DEFINED UNIT_TEST_TARGETS)
setup_target_for_coverage_lcov(
NAME coverage
LCOV_ARGS "--no-external"
EXECUTABLE openshot-test
DEPENDENCIES openshot openshot-test
EXECUTABLE ctest
EXECUTABLE_ARGS ${CTEST_OPTIONS}
DEPENDENCIES openshot ${UNIT_TEST_TARGETS}
EXCLUDE
"bindings/*"
"examples/*"
"${CMAKE_CURRENT_BINARY_DIR}/bindings/*"
"${CMAKE_CURRENT_BINARY_DIR}/src/*_autogen/*"
)
if(NOT TARGET os_test)
add_custom_target(os_test)
add_dependencies(os_test coverage)
endif()
endif()

# Also hook up 'test' as an alias for the 'os_test' target, if possible
# This requires CMake 3.11+, where the CMP0037 policy
# configured to 'NEW' mode will not reserve target names
# unless the corresponding feature is actually used
if (POLICY CMP0037)
cmake_policy(SET CMP0037 NEW)
if(TESTS_ENABLED AND NOT TARGET coverage)
add_custom_target(coverage
COMMAND ctest ${CTEST_OPTIONS}
DEPENDS openshot ${UNIT_TEST_TARGETS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running unit tests (coverage disabled)"
)
endif()
if(TARGET os_test)
if (CMAKE_VERSION VERSION_GREATER 3.11)
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
add_custom_target(test)
add_dependencies(test os_test)
set(TEST_TARGET_NAME "test")
else()
set(TEST_TARGET_NAME "os_test")

if(TARGET test AND NOT TARGET os_test)
add_custom_target(os_test)
add_dependencies(os_test coverage)
endif()

if(TARGET os_test AND NOT TARGET test AND CMAKE_VERSION VERSION_GREATER 3.11)
# Also hook up 'test' as an alias for the 'os_test' target, if possible
# This requires CMake 3.11+, where the CMP0037 policy
# configured to 'NEW' mode will not reserve target names
# unless the corresponding feature is actually used
if (POLICY CMP0037)
cmake_policy(SET CMP0037 NEW)
endif()
add_feature_info("Testrunner" ENABLE_TESTS "Run unit tests with 'make ${TEST_TARGET_NAME}'")
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
add_custom_target(test)
add_dependencies(test os_test)
endif()

###
### Add feature-summary details on non-default built targets
###
set(optional_targets test os_test coverage doc)
set(target_test_description "Build and execute unit tests")
set(target_os_test_description "Build and execute unit tests (legacy target)")
set(target_coverage_description "Run unit tests and (if enabled) collect coverage data")
set(target_doc_description "Build formatted API documentation (HTML+SVG)")
foreach(_tname IN LISTS optional_targets)
if(TARGET ${_tname})
add_feature_info("Non-default target '${_tname}'" TRUE ${target_${_tname}_description})
else()
message(DEBUG "No target ${_tname}")
endif()
endforeach()

########### PRINT FEATURE SUMMARY ##############
feature_summary(WHAT ALL
INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES
DESCRIPTION "Displaying feature summary\n\nBuild configuration:")
DESCRIPTION "Build configuration:")

0 comments on commit c8c92b5

Please sign in to comment.