Skip to content

meson: add tests and app options #3265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 73 additions & 68 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
option('app', type : 'boolean',
value: true,
description : 'Build exiv2 executable',
)

option('curl', type : 'feature',
description : 'USE Libcurl for HttpIo (WEBREADY)',
)
Expand Down Expand Up @@ -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',
Expand Down
7 changes: 1 addition & 6 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading