meson.build 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. project('libdng', 'c',
  2. version: '0.1.1',
  3. license: 'MIT',
  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. 'src/dcp.c',
  29. 'src/repack.c',
  30. 'src/repack.h',
  31. ]
  32. add_project_arguments(['-Wno-multichar'], language: 'c')
  33. add_project_arguments('-D_GNU_SOURCE', language: 'c')
  34. libdng = shared_library('dng', lib_src,
  35. version: libdng_so_version,
  36. include_directories: inc,
  37. dependencies: libtiff,
  38. install: true
  39. )
  40. pkg_mod = import('pkgconfig')
  41. pkg_mod.generate(libraries: libdng,
  42. version: libdng_so_version,
  43. name: 'libdng',
  44. filebase: 'libdng',
  45. description: 'The wrapper library to generate DNG files with libtiff')
  46. makedng = executable('makedng', 'util/makedng.c',
  47. link_with: libdng,
  48. include_directories: inc,
  49. install: true,
  50. )
  51. test_dng_validate = find_program('tests/test_dng_validate.sh')
  52. dng_validate = find_program('dng_validate', required: false)
  53. if dng_validate.found()
  54. test('dng_validate', test_dng_validate,
  55. args: [makedng.full_path()],
  56. suite: 'adobe',
  57. )
  58. endif
  59. subdir('tests')
  60. scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7', native: true)
  61. if scdoc.found()
  62. man_pages = ['man/makedng.1.scd']
  63. foreach src : man_pages
  64. topic = src.split('/')[1].split('.')[0]
  65. section = src.split('.')[1]
  66. output = topic + '.' + section
  67. custom_target(
  68. output,
  69. input: files(src),
  70. output: output,
  71. command: [
  72. 'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_variable(pkgconfig: 'scdoc'), output)
  73. ],
  74. install: true,
  75. install_dir: join_paths(get_option('mandir'), 'man' + section),
  76. ) endforeach
  77. endif