diff --git a/.github/workflows/cmake-ci.yml b/.github/workflows/cmake-ci.yml index ab9355fe..0c06724f 100644 --- a/.github/workflows/cmake-ci.yml +++ b/.github/workflows/cmake-ci.yml @@ -24,10 +24,10 @@ jobs: include: - os: ubuntu-22.04 build_type: Release - skip_meson: true + skip_meson: false - os: ubuntu-22.04 build_type: Debug - skip_meson: true + skip_meson: false # The CMake configure and build commands are platform agnostic and should work equally diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a879032..30cc8d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required (VERSION 3.19) -# Declare here -set (AVCPP_VERSION 3.0.1) +# Declare the version version.txt +file(READ "VERSION.txt" AVCPP_VERSION) +string(STRIP "${AVCPP_VERSION}" AVCPP_VERSION) if(NOT DEFINED PROJECT_NAME) set(AVCPP_NOT_SUBPROJECT ON) diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 00000000..b5021469 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +3.0.2 diff --git a/meson.build b/meson.build index 04624301..67e084e7 100644 --- a/meson.build +++ b/meson.build @@ -1,16 +1,16 @@ project( 'avcpp', 'cpp', - meson_version: '>= 0.50.0', + meson_version: '>= 0.54.1', default_options : [ 'c_std=c11', - 'cpp_std=c++17' + 'cpp_std=c++20' ], - version: '2.4.0', + version: files('VERSION.txt'), ) +subdir('src/avcpp') if not meson.is_subproject() - subdir('src') if get_option('build_samples') subdir('example/api2-samples') @@ -19,10 +19,6 @@ if not meson.is_subproject() # if get_option('build_tests') # subdir('tests') # endif -else - subdir('src') endif -if meson.version().version_compare('>=0.54.0') - meson.override_dependency('avcpp', avcpp_dep) -endif +meson.override_dependency('avcpp', avcpp_dep) diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index af0296ae..b61f9978 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -2,12 +2,12 @@ if meson.project_name() == '' project( 'avcpp', 'cpp', - meson_version: '>= 0.50.0', + meson_version: '>= 0.54.1', default_options : [ 'c_std=c11', - 'cpp_std=c++17' + 'cpp_std=c++20' ], - version: '2.4.0', + version: files('VERSION.txt'), ) endif @@ -35,18 +35,52 @@ av_libs = [ ['postproc', '52.0.0'], ] +conf_data = configuration_data() +cpp_std = get_option('cpp_std') +if cpp_std in ['c++17', 'gnu++17', 'vc++17'] + conf_data.set('AVCPP_CXX_STANDARD', '17') +elif cpp_std in ['c++20', 'gnu++20', 'vc++20'] + conf_data.set('AVCPP_CXX_STANDARD', '20') +elif cpp_std in ['c++23', 'gnu++23', 'vc++23'] + conf_data.set('AVCPP_CXX_STANDARD', '23') +elif cpp_std in ['c++26', 'gnu++26', 'vc++26'] + conf_data.set('AVCPP_CXX_STANDARD', '26') +else + warning('C++ standard setting ', cpp_std, ' not recognized') +endif + foreach lib : av_libs - avcpp_deps += [ - dependency( + lib_dep = dependency( 'lib@0@'.format(lib[0]), required: true, fallback : ['ffmpeg', 'lib@0@_dep'.format(lib[0])], version : '>=@0@'.format(lib[1])) - ] + avcpp_deps += [ lib_dep ] + lib_version = lib_dep.version().split('.') + conf_data.set( + 'AVCPP_' + lib[0].to_upper() + '_VERSION_MAJOR', + lib_version[0]) + conf_data.set( + 'AVCPP_' + lib[0].to_upper() + '_VERSION_MINOR', + lib_version[1]) + conf_data.set( + 'AVCPP_' + lib[0].to_upper() + '_VERSION_PATCH', + lib_version[2]) + conf_data.set( + 'AVCPP_' + lib[0].to_upper() + '_VERSION_TWEAK', + '0') endforeach +configure_file(input : 'avconfig.h.in', + output : 'avconfig.h', + configuration : conf_data, + format: 'cmake', + install: true, + install_dir: 'include/avcpp' + ) + #setting the include dir to the current folder (src) -avcpp_incdir = include_directories('.','filters') +avcpp_incdir = include_directories('.','filters','..') #listing all the source files avcpp_sources = [ @@ -58,6 +92,7 @@ avcpp_sources = [ 'codeccontext.cpp', 'codec.cpp', 'codecparameters.cpp', + 'buffer.cpp', 'dictionary.cpp', 'formatcontext.cpp', 'format.cpp',