meson.build 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. project('libmegapixels', 'c',
  2. version: '0.1.0',
  3. license: 'GPL',
  4. )
  5. libconfig = dependency('libconfig')
  6. # We use libtool-version numbers because it's easier to understand.
  7. # Before making a release, the libmegapixels_so_*
  8. # numbers should be modified. The components are of the form C:R:A.
  9. # a) If binary compatibility has been broken (eg removed or changed interfaces)
  10. # change to C+1:0:0.
  11. # b) If interfaces have been changed or added, but binary compatibility has
  12. # been preserved, change to C+1:0:A+1
  13. # c) If the interface is the same as the previous version, change to C:R+1:A
  14. libmegapixels_lt_c=1
  15. libmegapixels_lt_r=0
  16. libmegapixels_lt_a=0
  17. libmegapixels_so_version = '@0@.@1@.@2@'.format((libmegapixels_lt_c - libmegapixels_lt_a),
  18. libmegapixels_lt_a,
  19. libmegapixels_lt_r)
  20. inc = include_directories('include')
  21. install_headers('include/libmegapixels.h')
  22. lib_src = [
  23. 'src/findconfig.c',
  24. 'src/log.c',
  25. 'src/mode.c',
  26. 'src/util.c',
  27. 'src/parse.c',
  28. 'src/pipeline.c',
  29. 'src/aaa.c',
  30. 'src/flash.c',
  31. ]
  32. libmegapixels = shared_library('megapixels', lib_src,
  33. version: libmegapixels_so_version,
  34. include_directories: inc,
  35. dependencies: libconfig,
  36. install: true
  37. )
  38. pkg_mod = import('pkgconfig')
  39. pkg_mod.generate(libraries: libmegapixels,
  40. version: libmegapixels_so_version,
  41. name: 'libmegapixels',
  42. filebase: 'libmegapixels',
  43. description: 'The camera control bits from Megapixels')
  44. conf = configuration_data()
  45. conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
  46. conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))
  47. configure_file(
  48. output: 'config.h',
  49. configuration: conf)
  50. executable('megapixels-findconfig', 'util/findconfig.c',
  51. link_with: libmegapixels,
  52. include_directories: inc,
  53. install: true,
  54. )
  55. executable('megapixels-getframe', 'util/getframe.c',
  56. link_with: libmegapixels,
  57. include_directories: inc,
  58. install: true,
  59. )
  60. executable('megapixels-configlint', 'util/configlint.c',
  61. link_with: libmegapixels,
  62. include_directories: inc,
  63. install: true,
  64. )
  65. cc = meson.get_compiler('c')
  66. m_dep = cc.find_library('m', required : false)
  67. executable('megapixels-sensorprofile', 'util/sensorprofile.c',
  68. link_with: libmegapixels,
  69. include_directories: inc,
  70. install: true,
  71. dependencies: m_dep
  72. )
  73. install_data(
  74. [
  75. 'config/pine64,pinephone.conf',
  76. 'config/pine64,pinephone-pro.conf',
  77. 'config/pine64,pinetab.conf',
  78. 'config/purism,librem5.conf',
  79. 'config/xiaomi,scorpio.conf',
  80. ],
  81. install_dir: get_option('datadir') / 'megapixels/config/'
  82. )
  83. subdir('tests')