From 3ada2abb306b5cdbd26f3a608139b2ea09435b0c Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Wed, 25 Feb 2026 16:19:08 +0100 Subject: [PATCH 1/9] 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/9] 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/9] 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/9] 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/9] 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/9] 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/9] 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 a7fb611885ffc415f9f66de36c21655d69229d6f Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Fri, 27 Feb 2026 11:17:31 +0100 Subject: [PATCH 8/9] make the unit tests work in meson --- meson.build | 6 +++--- subprojects/catch2.wrap | 17 +++++++++-------- tests/meson.build | 27 ++++++++------------------- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/meson.build b/meson.build index 187fffab..a5acfd9a 100644 --- a/meson.build +++ b/meson.build @@ -16,9 +16,9 @@ if not meson.is_subproject() subdir('example/api2-samples') endif -# if get_option('build_tests') -# subdir('tests') -# endif + if get_option('build_tests') + subdir('tests') + endif endif meson.override_dependency('avcpp', avcpp_dep) diff --git a/subprojects/catch2.wrap b/subprojects/catch2.wrap index 2e200858..fc428019 100644 --- a/subprojects/catch2.wrap +++ b/subprojects/catch2.wrap @@ -1,10 +1,11 @@ [wrap-file] -directory = Catch2-2.11.3 +directory = Catch2-3.13.0 +source_url = https://github.com/catchorg/Catch2/archive/v3.13.0.tar.gz +source_filename = Catch2-3.13.0.tar.gz +source_hash = 650795f6501af514f806e78c554729847b98db6935e69076f36bb03ed2e985ef +source_fallback_url = https://wrapdb.mesonbuild.com/v2/catch2_3.13.0-1/get_source/Catch2-3.13.0.tar.gz +wrapdb_version = 3.13.0-1 -source_url = https://github.com/catchorg/Catch2/archive/v2.11.3.zip -source_filename = Catch2-2.11.3.zip -source_hash = c5a0a7510379c6f37f70b329986a335a7b8489d67ac417ce8f4262d0cae4cc5d - -patch_url = https://wrapdb.mesonbuild.com/v1/projects/catch2/2.11.3/1/get_zip -patch_filename = catch2-2.11.3-1-wrap.zip -patch_hash = 63c09cb68280435040ad304b3dd87ecfe69dbc216608991d0a82569a63119e57 +[provide] +catch2 = catch2_dep +catch2-with-main = catch2_with_main_dep diff --git a/tests/meson.build b/tests/meson.build index ff77bf00..31885e30 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,29 +1,18 @@ #get catch2 -catch2 = dependency('catch2', required: true, fallback:['catch2','catch2_dep']) +catch2 = dependency('catch2-with-main', required: true) -#create main_test as library and export the dependency -main_test = static_library( - 'main_test', - 'test-main.cpp', - dependencies: [catch2, avcpp_dep] -) - -main_test_dep = declare_dependency( - link_with : main_test, - dependencies : catch2, - version: meson.project_version() -) - -#make both dependencies into one array -deps = [avcpp_dep] -deps += main_test_dep +deps = [avcpp_dep, catch2] tests = [ - 'Frame', 'AvDeleter', - 'Packet', + 'Buffer', + 'Codec', 'Format', + 'Frame', + 'Packet', + 'PixelSampleFormat', 'Rational', + 'TimeStamp' ] #create all the tests From 58e3d95d918a702395991244e1ead9d9c0bc77f9 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Fri, 27 Feb 2026 11:21:36 +0100 Subject: [PATCH 9/9] fix case sensitive OS --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 31885e30..e4eb65f6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -12,7 +12,7 @@ tests = [ 'Packet', 'PixelSampleFormat', 'Rational', - 'TimeStamp' + 'Timestamp' ] #create all the tests