meson.build 2.4 KB

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