From 3ada2abb306b5cdbd26f3a608139b2ea09435b0c Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Wed, 25 Feb 2026 16:19:08 +0100 Subject: [PATCH 1/8] fix the meson build --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 04624301..b75f36df 100644 --- a/meson.build +++ b/meson.build @@ -9,8 +9,8 @@ project( version: '2.4.0', ) +subdir('src/avcpp') if not meson.is_subproject() - subdir('src') if get_option('build_samples') subdir('example/api2-samples') @@ -19,8 +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') From 18653310c1c3717679b0137a3181f783374c2c5e Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Wed, 25 Feb 2026 16:19:18 +0100 Subject: [PATCH 2/8] try to re-enable meson in CI --- .github/workflows/cmake-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From e938e94d8c569ae81d9244a8c6920c1dff2bee73 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 14:49:17 +0100 Subject: [PATCH 3/8] add the configuration file to the meson build --- meson.build | 8 +++----- src/avcpp/meson.build | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index b75f36df..187fffab 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,10 @@ 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', ) @@ -21,6 +21,4 @@ if not meson.is_subproject() # endif 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..76c04428 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -2,10 +2,10 @@ 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', ) @@ -35,18 +35,46 @@ av_libs = [ ['postproc', '52.0.0'], ] +conf_data = configuration_data() +if get_option('cpp_std') == 'c++17' + conf_data.set('AVCPP_CXX_STANDARD', '17') +elif get_option('cpp_std') == 'c++20' + conf_data.set('AVCPP_CXX_STANDARD', '20') +elif get_option('cpp_std') == 'c++23' + conf_data.set('AVCPP_CXX_STANDARD', '23') +elif get_option('cpp_std') == 'c++26' + conf_data.set('AVCPP_CXX_STANDARD', '26') +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') + #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 = [ From d545baf77a5452474c1894b50cea29bc6aaf7463 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 14:58:14 +0100 Subject: [PATCH 4/8] globbing is considered a bad practice in meson --- src/avcpp/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index 76c04428..55e91b0f 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -86,6 +86,7 @@ avcpp_sources = [ 'codeccontext.cpp', 'codec.cpp', 'codecparameters.cpp', + 'buffer.cpp', 'dictionary.cpp', 'formatcontext.cpp', 'format.cpp', From e3dd851ac88364430eabd2f7bda1fa3352213b60 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 16:10:03 +0100 Subject: [PATCH 5/8] install the generated file as a header file --- src/avcpp/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index 55e91b0f..e4c51d66 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -71,7 +71,10 @@ endforeach configure_file(input : 'avconfig.h.in', output : 'avconfig.h', configuration : conf_data, - format: 'cmake') + format: 'cmake', + install: true, + install_dir: 'include/avcpp' + ) #setting the include dir to the current folder (src) avcpp_incdir = include_directories('.','filters','..') From 5afc2fe7fb45e5e7759fef953e48b7feec65be90 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 19:08:46 +0100 Subject: [PATCH 6/8] handle gnu C++ settings and warn if the C++ standard is not recognized --- src/avcpp/meson.build | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index e4c51d66..8c65655c 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -36,14 +36,16 @@ av_libs = [ ] conf_data = configuration_data() -if get_option('cpp_std') == 'c++17' +if get_option('cpp_std') == 'c++17' or get_option('cpp_std') == 'gnu++17' conf_data.set('AVCPP_CXX_STANDARD', '17') -elif get_option('cpp_std') == 'c++20' +elif get_option('cpp_std') == 'c++20' or get_option('cpp_std') == 'gnu++20' conf_data.set('AVCPP_CXX_STANDARD', '20') -elif get_option('cpp_std') == 'c++23' +elif get_option('cpp_std') == 'c++23' or get_option('cpp_std') == 'gnu++23' conf_data.set('AVCPP_CXX_STANDARD', '23') -elif get_option('cpp_std') == 'c++26' +elif get_option('cpp_std') == 'c++26' or get_option('cpp_std') == 'gnu++26' conf_data.set('AVCPP_CXX_STANDARD', '26') +else + warning('C++ standard setting ', get_option('cpp_std'), ' not recognized') endif foreach lib : av_libs From defa0e1674ca5e07822eccfc12ac394d1e669a93 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 21:20:13 +0100 Subject: [PATCH 7/8] obviously MSVC has its own setting --- src/avcpp/meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index 8c65655c..97846c81 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -36,16 +36,17 @@ av_libs = [ ] conf_data = configuration_data() -if get_option('cpp_std') == 'c++17' or get_option('cpp_std') == 'gnu++17' +cpp_std = get_option('cpp_std') +if cpp_std in ['c++17', 'gnu++17', 'vc++17'] conf_data.set('AVCPP_CXX_STANDARD', '17') -elif get_option('cpp_std') == 'c++20' or get_option('cpp_std') == 'gnu++20' +elif cpp_std in ['c++20', 'gnu++20', 'vc++20'] conf_data.set('AVCPP_CXX_STANDARD', '20') -elif get_option('cpp_std') == 'c++23' or get_option('cpp_std') == 'gnu++23' +elif cpp_std in ['c++23', 'gnu++23', 'vc++23'] conf_data.set('AVCPP_CXX_STANDARD', '23') -elif get_option('cpp_std') == 'c++26' or get_option('cpp_std') == 'gnu++26' +elif cpp_std in ['c++26', 'gnu++26', 'vc++26'] conf_data.set('AVCPP_CXX_STANDARD', '26') else - warning('C++ standard setting ', get_option('cpp_std'), ' not recognized') + warning('C++ standard setting ', cpp_std, ' not recognized') endif foreach lib : av_libs From c40bf396c617ea3b68354eee84c6413ec966802d Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Thu, 26 Feb 2026 16:19:43 +0100 Subject: [PATCH 8/8] get the project version from a VERSION file --- CMakeLists.txt | 5 +++-- VERSION.txt | 1 + meson.build | 2 +- src/avcpp/meson.build | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 VERSION.txt 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 187fffab..67e084e7 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( 'c_std=c11', 'cpp_std=c++20' ], - version: '2.4.0', + version: files('VERSION.txt'), ) subdir('src/avcpp') diff --git a/src/avcpp/meson.build b/src/avcpp/meson.build index 97846c81..b61f9978 100644 --- a/src/avcpp/meson.build +++ b/src/avcpp/meson.build @@ -7,7 +7,7 @@ if meson.project_name() == '' 'c_std=c11', 'cpp_std=c++20' ], - version: '2.4.0', + version: files('VERSION.txt'), ) endif