From ac6b1552dab64d8b78bd185b9c2d461c2745dc90 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 28 Apr 2025 14:58:34 -0700 Subject: [PATCH] meson: add tests and app options Signed-off-by: Rosen Penev --- meson.build | 141 ++++++++++++++++++++++++---------------------- meson_options.txt | 10 ++++ src/meson.build | 7 +-- 3 files changed, 84 insertions(+), 74 deletions(-) diff --git a/meson.build b/meson.build index 792e415479..e1bc058c14 100644 --- a/meson.build +++ b/meson.build @@ -138,75 +138,80 @@ subdir('include') install_man('man/man1/exiv2.1') -exiv2_sources = files( - 'app/actions.cpp', - 'app/app_utils.cpp', - 'app/exiv2.cpp', - 'app/getopt.cpp', -) - -if host_machine.system() == 'windows' - windows = import('windows') - exiv2_sources += windows.compile_resources('app/utf8.rc', depend_files: 'app/utf8.manifest') -endif - exiv2inc = include_directories('src', 'include/exiv2') -executable( - 'exiv2', - exiv2_sources, - include_directories: exiv2inc, - dependencies: exiv2_dep, - install: true, -) - -samples = { - 'addmoddel': [], - 'conntest': web_dep, - 'convert-test': [], - 'easyaccess-test': [], - 'exifcomment': [], - 'exifdata-test': [], - 'exifdata': [], - 'exifprint': [], - 'exifvalue': [], - 'geotag': expat_dep, - 'ini-test': inih_dep, - 'iotest': [], - 'iptceasy': [], - 'iptcprint': [], - 'iptctest': [], - 'key-test': [], - 'largeiptc-test': [], - 'mmap-test': [], - 'mrwthumb': [], - 'prevtest': [], - 'remotetest': [], - 'stringto-test': [], - 'taglist': [], - 'tiff-test': [], - 'write-test': [], - 'write2-test': [], - 'xmpparse': [], - 'xmpparser-test': [], - 'xmpprint': [], - 'xmpsample': [], - 'xmpdump': [], -} - -foreach s, d : samples - executable(s, 'samples/@0@.cpp'.format(s), dependencies: [exiv2_dep, d], include_directories: exiv2inc) -endforeach +subdir('unitTests') +subdir('po') -gopt = [ - 'getopt-test', - 'metacopy', - 'path-test', -] +if get_option('app') + exiv2_sources = files( + 'app/actions.cpp', + 'app/app_utils.cpp', + 'app/exiv2.cpp', + 'app/getopt.cpp', + ) + + if host_machine.system() == 'windows' + windows = import('windows') + exiv2_sources += windows.compile_resources('app/utf8.rc', depend_files: 'app/utf8.manifest') + endif -ginc = include_directories('app') -foreach g : gopt - executable(g, 'samples/@0@.cpp'.format(g), 'app/getopt.cpp', dependencies: exiv2_dep, include_directories: [exiv2inc, ginc]) -endforeach + executable( + 'exiv2', + exiv2_sources, + include_directories: exiv2inc, + dependencies: exiv2_dep, + install: true, + ) +endif -subdir('unitTests') -subdir('po') +if get_option('app') and get_option('tests') + samples = { + 'addmoddel': [], + 'conntest': web_dep, + 'convert-test': [], + 'easyaccess-test': [], + 'exifcomment': [], + 'exifdata-test': [], + 'exifdata': [], + 'exifprint': [], + 'exifvalue': [], + 'geotag': expat_dep, + 'ini-test': inih_dep, + 'iotest': [], + 'iptceasy': [], + 'iptcprint': [], + 'iptctest': [], + 'jpegparsetest': [], + 'key-test': [], + 'largeiptc-test': [], + 'mmap-test': [], + 'mrwthumb': [], + 'prevtest': [], + 'remotetest': [], + 'stringto-test': [], + 'taglist': [], + 'tiff-test': [], + 'write-test': [], + 'write2-test': [], + 'xmpparse': [], + 'xmpparser-test': [], + 'xmpprint': [], + 'xmpsample': [], + 'xmpdump': [], + } + + foreach s, d : samples + executable(s, 'samples/@0@.cpp'.format(s), dependencies: [exiv2_dep, d], include_directories: exiv2inc) + endforeach + + gopt = [ + 'getopt-test', + 'metacopy', + 'path-test', + ] + + ginc = include_directories('app') + foreach g : gopt + executable(g, 'samples/@0@.cpp'.format(g), 'app/getopt.cpp', dependencies: exiv2_dep, include_directories: [exiv2inc, ginc]) + endforeach +endif diff --git a/meson_options.txt b/meson_options.txt index ca03706ea0..5c6a703324 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,8 @@ +option('app', type : 'boolean', + value: true, + description : 'Build exiv2 executable', +) + option('curl', type : 'feature', description : 'USE Libcurl for HttpIo (WEBREADY)', ) @@ -45,6 +50,11 @@ option('unitTests', type : 'feature', description : 'Build and run unit tests', ) +option('tests', type : 'boolean', + value: false, + description : 'Build and run Python tests', +) + option('webready', type : 'boolean', value: true, description : 'Build with support for webready', diff --git a/src/meson.build b/src/meson.build index 7cb4e6b4d8..13af4f78dd 100644 --- a/src/meson.build +++ b/src/meson.build @@ -116,17 +116,12 @@ if host_machine.system() == 'windows' and get_option('default_library') != 'stat dllapi = '-DEXIV2API=__declspec(dllimport)' endif -cmake = import('cmake') -cmake.write_basic_package_version_file( - name: meson.project_name(), - version: meson.project_version(), -) - pkg = import('pkgconfig') pkg.generate( exiv2, description: 'Exif/IPTC/Xmp C++ metadata library and tools plus ICC Profiles, Previews and more.', url: 'https://exiv2.org', + extra_cflags: dllapi, ) exiv2_dep = declare_dependency(