1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
project('libdng', 'c',
version: '0.2.2',
license: 'MIT',
default_options: ['c_std=c11'],
)
libtiff = dependency('libtiff-4')
# We use libtool-version numbers because it's easier to understand.
# Before making a release, the libdng_so_*
# numbers should be modified. The components are of the form C:R:A.
# a) If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0.
# b) If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
libdng_lt_c=3
libdng_lt_r=0
libdng_lt_a=2
libdng_so_version = '@0@.@1@.@2@'.format((libdng_lt_c - libdng_lt_a),
libdng_lt_a,
libdng_lt_r)
inc = include_directories('include')
install_headers('include/libdng.h')
lib_src = [
'src/libdng.c',
'src/dng.h',
'src/mode.c',
'src/mode.h',
'src/dcp.c',
'src/repack.c',
'src/repack.h',
]
add_project_arguments(['-Wno-multichar'], language: 'c')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
libdng = shared_library('dng', lib_src,
version: libdng_so_version,
include_directories: inc,
dependencies: libtiff,
install: true
)
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries: libdng,
version: libdng_so_version,
name: 'libdng',
filebase: 'libdng',
description: 'The wrapper library to generate DNG files with libtiff')
makedng = executable('makedng', 'util/makedng.c',
link_with: libdng,
include_directories: inc,
install: true,
)
makedng = executable('dumpdng', 'util/dumpdng.c',
link_with: libdng,
include_directories: inc,
install: true,
)
test_dng_validate = find_program('tests/test_dng_validate.sh')
dng_validate = find_program('dng_validate', required: false)
if dng_validate.found()
test('dng_validate', test_dng_validate,
args: [makedng.full_path()],
suite: 'adobe',
)
endif
subdir('tests')
scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7', native: true)
if scdoc.found()
man_pages = ['man/makedng.1.scd']
foreach src : man_pages
topic = src.split('/')[1].split('.')[0]
section = src.split('.')[1]
output = topic + '.' + section
custom_target(
output,
input: files(src),
output: output,
command: [
'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_variable(pkgconfig: 'scdoc'), output)
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man' + section),
) endforeach
endif
|