Add cmake and clang format and linter

This commit is contained in:
2021-02-13 04:08:43 +00:00
parent 1674ec4061
commit d0933f43c9
16 changed files with 13060 additions and 12188 deletions
+115
View File
@@ -0,0 +1,115 @@
# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
with section("parse"):
# Specify structure for custom cmake functions
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
## Override configurations per-command where available
#override_spec = {}
# Specify variable tags.
vartags = []
# Specify property tags.
proptags = []
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):
# How wide to allow formatted cmake files
line_width = 150
# How many spaces to tab for indent
tab_size = 2
max_pargs_hwrap = 8
## If true, lines are indented using tab characters (utf-8 0x09) instead of
## <tab_size> space characters (utf-8 0x20). In cases where the layout would
## require a fractional tab character, the behavior of the fractional
## indentation is governed by <fractional_tab_policy>
#use_tabchars = False
# Format command names consistently as 'lower' or 'upper' case
command_case = 'upper'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'upper'
# ----------------------------
# Options affecting the linter
# ----------------------------
with section("lint"):
# a list of lint codes to disable
disabled_codes = ["C0103"]
# regular expression pattern describing valid function names
function_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid macro names
macro_pattern = '[0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern = '_[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with local
# scope
local_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern = '_[0-9a-z_]+'
# regular expression pattern describing valid names for public directory
# variables
public_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern = '[A-Z][0-9A-Z_]+'
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser.
max_conditionals_custom_parser = 2
# Require at least this many newlines between statements
min_statement_spacing = 1
# Require no more than this many newlines between statements
max_statement_spacing = 2
max_returns = 6
max_branches = 12
max_arguments = 5
max_localvars = 15
max_statements = 50
# -------------------------------
# Options affecting file encoding
# -------------------------------
with section("encode"):
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# Specify the encoding of the input file. Defaults to utf-8
input_encoding = 'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = 'utf-8'
+30
View File
@@ -0,0 +1,30 @@
fail_fast: false
repos:
- repo: local
hooks:
- id: cmake-configure
name: Cmake Configure
entry: cmake -B build
pass_filenames: false
language: system
- id: cmake-build
name: Cmake Build
entry: cmake --build build
pass_filenames: false
language: system
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/pocc/pre-commit-hooks
rev: python
hooks:
- id: clang-format
args: [--style=file, -i]
- id: clang-tidy
args: [-p=build]
args: [-checks=clang-diagnostic-return-type]
+84 -71
View File
@@ -1,34 +1,39 @@
###
### CMakeLists for calyp
###
#
# CMakeLists for calyp
#
cmake_minimum_required( VERSION 3.2.0 )
CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0)
######################################################################################
# ####################################################################################################################################################
# CMake functions
######################################################################################
# ####################################################################################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(cmake/ModulesFct.cmake)
INCLUDE(FeatureSummary)
INCLUDE(GNUInstallDirs)
######################################################################################
# ####################################################################################################################################################
# Project Definition
######################################################################################
SET( PROJECT_NAME "calyp" CACHE INTERNAL "" FORCE )
SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
# ####################################################################################################################################################
SET(PROJECT_NAME
"calyp"
CACHE INTERNAL "" FORCE)
SET(PROJECT_LIBRARY
"Calyp"
CACHE INTERNAL "" FORCE)
PROJECT(${PROJECT_NAME})
SET(CALYP_VERSION_MAJOR "1")
SET(CALYP_VERSION_MINOR "1")
SET(CALYP_VERSION_PATCH "0")
SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
SET(CALYP_VERSION
"${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}"
CACHE INTERNAL "" FORCE)
######################################################################################
# ####################################################################################################################################################
# Variables
######################################################################################
# ####################################################################################################################################################
OPTION(BUILD_APP "Build GUI Application" ON)
OPTION(BUILD_TOOLS "Build Command Line Application" ON)
@@ -43,55 +48,56 @@ OPTION( USE_SSE "Build with SSE support" OFF )
OPTION(USE_WERROR "Warnings as errors" OFF)
OPTION(USE_STATIC "Use static libs" OFF)
######################################################################################
# ####################################################################################################################################################
# Release configuration
######################################################################################
# ####################################################################################################################################################
# To be switched on when releasing.
OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
# Get current version.
set(CALYP_VERSION_STRING "${CALYP_VERSION}")
if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
SET(CALYP_VERSION_STRING "${CALYP_VERSION}")
IF(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
# Probably a Git workspace; determine the revision.
FIND_PACKAGE(Git QUIET)
if(GIT_FOUND)
exec_program(${GIT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}
IF(GIT_FOUND)
EXEC_PROGRAM(
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
ARGS "describe --tags"
OUTPUT_VARIABLE CALYP_GIT_REVISION
RETURN_VALUE TAG_RESULT
)
RETURN_VALUE TAG_RESULT)
# git describe --tags failed; maybe the repository was checked with depth=1.
if(NOT ${TAG_RESULT} EQUAL 0)
exec_program(${GIT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}
IF(NOT ${TAG_RESULT} EQUAL 0)
EXEC_PROGRAM(
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
ARGS "describe --always"
OUTPUT_VARIABLE CALYP_GIT_REVISION
)
endif()
message(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
set(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
else()
message(STATUS "Calyp Git revision could not be determined")
endif()
endif()
OUTPUT_VARIABLE CALYP_GIT_REVISION)
ENDIF()
MESSAGE(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
SET(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
ELSE()
MESSAGE(STATUS "Calyp Git revision could not be determined")
ENDIF()
ENDIF()
SET(UPDATE_CHANNEL "stable" CACHE STRING "Update channel" )
SET(UPDATE_CHANNEL
"stable"
CACHE STRING "Update channel")
# CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml )
######################################################################################
# ####################################################################################################################################################
# Dependencies
######################################################################################
# ####################################################################################################################################################
IF(BUILD_DOC)
FIND_PACKAGE(Doxygen)
SET(BUILD_DOC ${Doxygen_FOUND})
ENDIF()
SET_PACKAGE_PROPERTIES(Doxygen PROPERTIES URL "http://www.doxygen.org/" DESCRIPTION "Doxygen" TYPE OPTIONAL)
SET_PACKAGE_PROPERTIES(
Doxygen PROPERTIES
URL "http://www.doxygen.org/"
DESCRIPTION "Doxygen"
TYPE OPTIONAL)
IF(BUILD_TESTS)
FIND_PACKAGE(GTest)
@@ -100,7 +106,9 @@ IF( BUILD_TESTS )
ENABLE_TESTING()
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
ENDIF()
SET( CALYP_TEST_DATA_DIR "CALYP_TEST_DATA_DIR" CACHE PATH "Location of video information for testing")
SET(CALYP_TEST_DATA_DIR
"CALYP_TEST_DATA_DIR"
CACHE PATH "Location of video information for testing")
ENDIF()
OPTION(USE_OPENCV "Add OpenCV support" ON)
@@ -121,7 +129,11 @@ IF( USE_OPENCV )
SET(USE_OPENCV FALSE)
ENDIF()
ENDIF()
SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in CalypFrame" TYPE OPTIONAL)
SET_PACKAGE_PROPERTIES(
OpenCV PROPERTIES
URL "http://opencv.willowgarage.com"
DESCRIPTION "OpenCV library support in CalypFrame"
TYPE OPTIONAL)
OPTION(USE_FFMPEG "Add FFMPEG support" ON)
IF(USE_FFMPEG)
@@ -132,23 +144,28 @@ IF( USE_FFMPEG )
ENDIF()
SET(USE_FFMPEG ${FFMPEG_FOUND})
ENDIF()
SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in CalypStream" TYPE OPTIONAL)
SET_PACKAGE_PROPERTIES(
FFmpeg PROPERTIES
URL "http://ffmpeg.org/"
DESCRIPTION "Libav library support in CalypStream"
TYPE OPTIONAL)
IF(WIN32)
SET(USE_STATIC ON)
INCLUDE(cmake/Win32.cmake)
ENDIF()
######################################################################################
# ####################################################################################################################################################
# CMake Defin1itions
######################################################################################
# ####################################################################################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(FeatureSummary)
# must go before the project command
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
SET(CMAKE_CONFIGURATION_TYPES
"Debug;Release"
CACHE STRING "Configs" FORCE)
IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
ENDIF()
@@ -156,14 +173,14 @@ SET( CMAKE_CXX_FLAGS "" )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
######################################################################################
# ####################################################################################################################################################
# Compiler options
######################################################################################
# ####################################################################################################################################################
SET(CMAKE_CXX_STANDARD 14)
if(CMAKE_COMPILER_IS_GNUCXX)
IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-std=gnu++0x)
endif()
ENDIF()
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "No build type selected, default to Release")
@@ -172,24 +189,22 @@ ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
ADD_DEFINITIONS(
-DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
#-DQT_NO_SIGNALS_SLOTS_KEYWORDS
#-DQT_USE_QSTRINGBUILDER
# -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER
)
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
# endif()
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
endif()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
ENDIF()
IF(USE_WERROR)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
@@ -198,10 +213,9 @@ ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
######################################################################################
# ####################################################################################################################################################
# Configure targets
######################################################################################
# ####################################################################################################################################################
ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface")
ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool")
@@ -224,12 +238,11 @@ IF( ${BUILD_EXAMPLES} )
ADD_SUBDIRECTORY(examples)
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
######################################################################################
# ####################################################################################################################################################
# Final information dump
######################################################################################
# ####################################################################################################################################################
MESSAGE("")
MESSAGE(STATUS "${PROJECT_NAME} INFORMATION")
MESSAGE(STATUS "Version: " "${CALYP_VERSION_STRING}")
+28 -29
View File
@@ -1,12 +1,9 @@
###
### CMakeLists for calyp app component
###
#
# CMakeLists for calyp app component
#
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external
${CMAKE_CURRENT_SOURCE_DIR}/dialog
${CMAKE_CURRENT_SOURCE_DIR}/docks
${CMAKE_CURRENT_SOURCE_DIR}/widgets )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/dialog
${CMAKE_CURRENT_SOURCE_DIR}/docks ${CMAKE_CURRENT_SOURCE_DIR}/widgets)
OPTION(USE_QTDBUS "Build with QtDBus" ON)
OPTION(USE_FERVOR "Add Fervor support" OFF)
@@ -19,16 +16,21 @@ LIST(APPEND QT_MODULES Core Gui Widgets Concurrent )
IF(USE_QTDBUS)
FIND_PACKAGE(Qt5DBus)
SET_PACKAGE_PROPERTIES(Qt5DBus PROPERTIES DESCRIPTION "Support for Qt5 DBus messages between instances" TYPE OPTIONAL )
SET_PACKAGE_PROPERTIES(
Qt5DBus PROPERTIES
DESCRIPTION "Support for Qt5 DBus messages between instances"
TYPE OPTIONAL)
IF(${Qt5DBus_FOUND})
SET(USE_QTDBUS ${Qt5DBus_FOUND}) # TODO: fix this stupid variable
SET( USE_QTDBUS ${Qt5DBus_FOUND} PARENT_SCOPE)
SET(USE_QTDBUS
${Qt5DBus_FOUND}
PARENT_SCOPE)
LIST(APPEND QT_LINKER_LIBS Qt5::DBus)
LIST(APPEND QT_MODULES DBus)
ENDIF()
ENDIF()
set(Calyp_App_SRCS
SET(Calyp_App_SRCS
# Main
main.cpp
MainWindow.cpp
@@ -61,20 +63,15 @@ set(Calyp_App_SRCS
# Docks
docks/FramePropertiesDock.cpp
docks/ModuleHandleDock.cpp
docks/QualityMeasurementSidebar.cpp
)
docks/QualityMeasurementSidebar.cpp)
IF(USE_QTDBUS)
LIST(APPEND Calyp_App_SRCS DBusAppAdaptor.cpp)
ENDIF()
SET(Calyp_App_UI "")
set(Calyp_App_UI "" )
set(Calyp_App_RCC
resources/${PROJECT_NAME}.qrc
)
SET(Calyp_App_RCC resources/${PROJECT_NAME}.qrc)
IF(USE_FERVOR)
@@ -108,7 +105,11 @@ IF( USE_FERVOR )
ENDIF()
ENDIF()
SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "https://github.com/pypt/fervor" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL )
SET_PACKAGE_PROPERTIES(
Fervor PROPERTIES
URL "https://github.com/pypt/fervor"
DESCRIPTION "Fervor lib includes check for updates feature"
TYPE OPTIONAL)
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
QT5_WRAP_UI(Calyp_App_UI_Wrap ${Calyp_App_UI})
@@ -119,21 +120,22 @@ SET( CMAKE_AUTOMOC ON )
# Windows application icon
IF(WIN32)
set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
SET(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
IF(MSVC)
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
ADD_CUSTOM_COMMAND(
OUTPUT ${WINDOWS_RES_FILE}
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
)
COMMENT "Add icon on windows platform")
ELSE()
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
ADD_CUSTOM_COMMAND(
OUTPUT ${WINDOWS_RES_FILE}
COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
)
COMMENT "Add icon on windows platform")
ENDIF()
ENDIF()
ADD_EXECUTABLE(${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib)
@@ -143,6 +145,3 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin )
INSTALL(FILES resources/calyp.desktop DESTINATION share/applications)
INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps)
INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages)
+3 -3
View File
@@ -1,5 +1,5 @@
###
### CMakeLists for calyp external components
###
#
# CMakeLists for calyp external components
#
ADD_SUBDIRECTORY(qcustomplot)
+5 -13
View File
@@ -1,20 +1,12 @@
###
### CMakeLists for qcustomplot
###
#
# CMakeLists for qcustomplot
#
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
set(qcustomplot_SRCS
qcustomplot.cpp
qcustomplot.h
)
SET(qcustomplot_SRCS qcustomplot.cpp qcustomplot.h)
ADD_LIBRARY(QCustomPlotLib STATIC ${qcustomplot_SRCS})
TARGET_LINK_LIBRARIES( QCustomPlotLib
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::PrintSupport
)
TARGET_LINK_LIBRARIES(QCustomPlotLib Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC .)
+2121 -1598
View File
File diff suppressed because it is too large Load Diff
+612 -356
View File
File diff suppressed because it is too large Load Diff
+86 -102
View File
@@ -1,147 +1,131 @@
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
# * Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
#
# Once done this will define
# FFMPEG_FOUND - System has the all required components.
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
# Once done this will define FFMPEG_FOUND - System has the all required components. FFMPEG_INCLUDE_DIRS - Include directory necessary for
# using the required components headers. FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. FFMPEG_DEFINITIONS - Compiler
# switches required for using the required ffmpeg components.
#
# For each of the components it will additionally set.
# - AVCODEC
# - AVDEVICE
# - AVFORMAT
# - AVUTIL
# - POSTPROCESS
# - SWSCALE
# the following variables will be defined
# <component>_FOUND - System has <component>
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
# <component>_LIBRARIES - Link these to use <component>
# <component>_DEFINITIONS - Compiler switches required for using <component>
# For each of the components it will additionally set. - AVCODEC - AVDEVICE - AVFORMAT - AVUTIL - POSTPROCESS - SWSCALE the following variables will
# be defined <component>_FOUND - System has <component> <component>_INCLUDE_DIRS - Include directory necessary for using the <component>
# headers <component>_LIBRARIES - Link these to use <component> <component>_DEFINITIONS - Compiler switches required for using <component>
# <component>_VERSION - The components version
#
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org> Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org> Copyright (c) 2011, Michael Jansen,
# <kde@michael-jansen.biz>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Redistribution and use is allowed according to the terms of the BSD license. For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(FindPackageHandleStandardArgs)
INCLUDE(FindPackageHandleStandardArgs)
# The default components were taken from a survey over other FindFFMPEG.cmake files
if (NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
endif ()
IF(NOT FFmpeg_FIND_COMPONENTS)
SET(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
ENDIF()
#
### Macro: set_component_found
# Macro: set_component_found
#
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
#
macro(set_component_found _component )
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
MACRO(set_component_found _component)
IF(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
# message(STATUS " - ${_component} found.")
set(${_component}_FOUND TRUE)
else ()
SET(${_component}_FOUND TRUE)
ELSE()
# message(STATUS " - ${_component} not found.")
endif ()
endmacro()
ENDIF()
ENDMACRO()
#
### Macro: find_component
# Macro: find_component
#
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
# include directories.
# Checks for the given component by invoking pkgconfig and then looking up the libraries and include directories.
#
macro(find_component _component _pkgconfig _library _header)
MACRO(find_component _component _pkgconfig _library _header)
if (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_${_component} ${_pkgconfig})
endif ()
endif (NOT WIN32)
IF(NOT WIN32)
# use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(PC_${_component} ${_pkgconfig})
ENDIF()
ENDIF(NOT WIN32)
find_path(${_component}_INCLUDE_DIRS ${_header}
HINTS
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES
ffmpeg
)
FIND_PATH(
${_component}_INCLUDE_DIRS ${_header}
HINTS ${PC_LIB${_component}_INCLUDEDIR} ${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg)
find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS}
)
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
set_component_found(${_component})
mark_as_advanced(
${_component}_INCLUDE_DIRS
FIND_LIBRARY(
${_component}_LIBRARIES
${_component}_DEFINITIONS
${_component}_VERSION)
NAMES ${_library}
HINTS ${PC_LIB${_component}_LIBDIR} ${PC_LIB${_component}_LIBRARY_DIRS})
endmacro()
SET(${_component}_DEFINITIONS
${PC_${_component}_CFLAGS_OTHER}
CACHE STRING "The ${_component} CFLAGS.")
SET(${_component}_VERSION
${PC_${_component}_VERSION}
CACHE STRING "The ${_component} version number.")
SET_COMPONENT_FOUND(${_component})
MARK_AS_ADVANCED(${_component}_INCLUDE_DIRS ${_component}_LIBRARIES ${_component}_DEFINITIONS ${_component}_VERSION)
ENDMACRO()
# Check for cached results. If there are skip the costly part.
if (NOT FFMPEG_LIBRARIES)
IF(NOT FFMPEG_LIBRARIES)
# Check for all possible component.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
FIND_COMPONENT(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
FIND_COMPONENT(AVFORMAT libavformat avformat libavformat/avformat.h)
FIND_COMPONENT(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
FIND_COMPONENT(AVUTIL libavutil avutil libavutil/avutil.h)
FIND_COMPONENT(SWSCALE libswscale swscale libswscale/swscale.h)
FIND_COMPONENT(POSTPROC libpostproc postproc libpostproc/postprocess.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach (_component ${FFmpeg_FIND_COMPONENTS})
if (${_component}_FOUND)
FOREACH(_component ${FFmpeg_FIND_COMPONENTS})
IF(${_component}_FOUND)
# message(STATUS "Required component ${_component} present.")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
else ()
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
SET(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
LIST(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
ELSE()
# message(STATUS "Required component ${_component} missing.")
endif ()
endforeach ()
ENDIF()
ENDFOREACH()
# Build the include path with duplicates removed.
if (FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif ()
IF(FFMPEG_INCLUDE_DIRS)
LIST(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
ENDIF()
# cache the vars.
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS}
CACHE STRING "The FFmpeg include directories." FORCE)
SET(FFMPEG_LIBRARIES
${FFMPEG_LIBRARIES}
CACHE STRING "The FFmpeg libraries." FORCE)
SET(FFMPEG_DEFINITIONS
${FFMPEG_DEFINITIONS}
CACHE STRING "The FFmpeg cflags." FORCE)
mark_as_advanced(FFMPEG_INCLUDE_DIRS
FFMPEG_LIBRARIES
FFMPEG_DEFINITIONS)
MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS)
endif ()
ENDIF()
# Now set the noncached _FOUND vars for the components.
foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
set_component_found(${_component})
endforeach ()
FOREACH(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
SET_COMPONENT_FOUND(${_component})
ENDFOREACH()
# Compile the list of required vars
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
foreach (_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
endforeach ()
SET(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
FOREACH(_component ${FFmpeg_FIND_COMPONENTS})
LIST(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
ENDFOREACH()
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
+3 -5
View File
@@ -1,7 +1,5 @@
###
### CMakeLists for examples
###
#
# CMakeLists for examples
#
ADD_SUBDIRECTORY(modules)
+4 -9
View File
@@ -1,16 +1,12 @@
###
### CMakeLists for modules_example
###
#
# CMakeLists for modules_example
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
PROJECT("modules_example")
# THIS
# FIND_PACKAGE( Calyp )
#INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} )
# OR
# THIS FIND_PACKAGE( Calyp ) INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} ) OR
INCLUDE_DIRECTORIES(../../lib)
ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp)
@@ -18,4 +14,3 @@ TARGET_LINK_LIBRARIES( FrameBinarization ${CALYP_LINKER_LIBS} )
ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp)
TARGET_LINK_LIBRARIES(AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY} ${CALYP_LINKER_LIBS})
+12 -31
View File
@@ -1,12 +1,12 @@
###
### CMakeLists for calyp lib component
###
#
# CMakeLists for calyp lib component
#
INCLUDE(GNUInstallDirs)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
set(Calyp_Lib_SRCS
SET(Calyp_Lib_SRCS
LibMemory.h
CalypLib.h
CalypDefs.h
@@ -29,8 +29,7 @@ set(Calyp_Lib_SRCS
CalypOptions.cpp
# Modules
CalypModuleIf.h
CalypOpenCVModuleIf.h
)
CalypOpenCVModuleIf.h)
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY})
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
@@ -53,14 +52,7 @@ IF( USE_OPENCV )
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
ENDIF()
set(Calyp_Lib_HEADERS
CalypDefs.h
CalypFrame.h
CalypStream.h
CalypOptions.h
CalypModuleIf.h
CalypOpenCVModuleIf.h
)
SET(Calyp_Lib_HEADERS CalypDefs.h CalypFrame.h CalypStream.h CalypOptions.h CalypModuleIf.h CalypOpenCVModuleIf.h)
CONFIGURE_FILE(CalypConfig.cmake.in CalypConfig.cmake @ONLY)
@@ -72,29 +64,18 @@ ELSE()
ADD_LIBRARY(${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS})
ENDIF()
TARGET_LINK_LIBRARIES(${PROJECT_LIBRARY} ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES})
TARGET_LINK_LIBRARIES( ${PROJECT_LIBRARY}
${FFMPEG_LIBRARIES}
${OpenCV_LIBRARIES}
)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY} PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
)
SET_TARGET_PROPERTIES( ${PROJECT_LIBRARY}
PROPERTIES VERSION ${CALYP_VERSION}
SOVERSION ${CALYP_VERSION_MAJOR}
)
SET_TARGET_PROPERTIES(${PROJECT_LIBRARY} PROPERTIES VERSION ${CALYP_VERSION} SOVERSION ${CALYP_VERSION_MAJOR})
IF(NOT USE_STATIC)
INSTALL( TARGETS ${PROJECT_LIBRARY}
INSTALL(
TARGETS ${PROJECT_LIBRARY}
RUNTIME DESTINATION bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake DESTINATION share/calyp)
ENDIF()
+3 -4
View File
@@ -1,6 +1,6 @@
###
### CMakeLists for playuver lib tests component
###
#
# CMakeLists for playuver lib tests component
#
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
@@ -8,4 +8,3 @@ ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\")
ADD_EXECUTABLE(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests.cpp)
TARGET_LINK_LIBRARIES(PlaYUVerFrameQualityTests ${PROJECT_LIBRARY} gtest gtest_main)
ADD_TEST(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests)
+7 -7
View File
@@ -1,15 +1,15 @@
###
### CMakeLists for calyp modules component
###
#
# CMakeLists for calyp modules component
#
OPTION(CALYP_THREADED_MODULES "Use threads for modules" OFF)
SET( CALYP_EXTRA_MODULES_DIR "CALYP_EXTRA_MODULES_DIR" CACHE PATH "Location of extra Calyp modules")
SET(CALYP_EXTRA_MODULES_DIR
"CALYP_EXTRA_MODULES_DIR"
CACHE PATH "Location of extra Calyp modules")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(Calyp_Mod_SRCS
CalypModulesFactory.cpp
)
SET(Calyp_Mod_SRCS CalypModulesFactory.cpp)
#
# Modules List
+5 -9
View File
@@ -1,18 +1,14 @@
###
### CMakeLists for playuver lib tests component
###
#
# CMakeLists for playuver lib tests component
#
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\")
foreach(module ${MODULES_LIST_NAME})
FOREACH(module ${MODULES_LIST_NAME})
ADD_EXECUTABLE(TestModuleCreate_${module} TestModuleCreate.cpp)
TARGET_COMPILE_DEFINITIONS(TestModuleCreate_${module} PUBLIC -DCALYP_TEST_MODULE_NAME=\"${module}\")
TARGET_LINK_LIBRARIES(TestModuleCreate_${module} ${PROJECT_LIBRARY} CalypModules gtest gtest_main)
ADD_TEST(TestModuleCreate_${module} TestModuleCreate_${module})
endforeach(module ${MODULES_LIST_NAME})
ENDFOREACH(module ${MODULES_LIST_NAME})
+5 -14
View File
@@ -1,22 +1,13 @@
###
### CMakeLists for calyp tools component
###
#
# CMakeLists for calyp tools component
#
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(Calyp_Tools_SRCS
main.cpp
CalypTools.cpp
CalypToolsCmdParser.cpp
)
SET(Calyp_Tools_SRCS main.cpp CalypTools.cpp CalypToolsCmdParser.cpp)
ADD_EXECUTABLE(${PROJECT_NAME}Tools ${Calyp_Tools_SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME}Tools ${PROJECT_LIBRARY} CalypModules)
INSTALL(TARGETS ${PROJECT_NAME}Tools DESTINATION bin)