meson.build 2.3 KB

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