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/meson.build b/meson.build index 04624301..a5acfd9a 100644 --- a/meson.build +++ b/meson.build @@ -1,28 +1,24 @@ 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', ) +subdir('src/avcpp') if not meson.is_subproject() - subdir('src') if get_option('build_samples') subdir('example/api2-samples') endif -# if get_option('build_tests') -# subdir('tests') -# endif -else - subdir('src') + if get_option('build_tests') + subdir('tests') + 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..97846c81 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,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', 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..e4eb65f6 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