meson.build 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. project('megapixels', 'c', version: '1.3.2')
  2. gnome = import('gnome')
  3. gtkdep = dependency('gtk4')
  4. tiff = dependency('libtiff-4')
  5. zbar = dependency('zbar')
  6. threads = dependency('threads')
  7. # gl = dependency('gl')
  8. epoxy = dependency('epoxy')
  9. cc = meson.get_compiler('c')
  10. libm = cc.find_library('m', required: false)
  11. subdir('data')
  12. conf = configuration_data()
  13. conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
  14. conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))
  15. configure_file(
  16. output: 'config.h',
  17. configuration: conf)
  18. add_global_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'c')
  19. # Define DEBUG for debug builds only (debugoptimized is not included on this one)
  20. if get_option('buildtype') == 'debug'
  21. add_global_arguments('-DDEBUG', language: 'c')
  22. endif
  23. # Workaround for libtiff having ABI changes but not changing the internal
  24. # version number
  25. if get_option('tiffcfapattern')
  26. add_global_arguments('-DLIBTIFF_CFA_PATTERN', language: 'c')
  27. endif
  28. executable('megapixels',
  29. 'src/camera.c',
  30. 'src/camera_config.c',
  31. 'src/device.c',
  32. 'src/flash.c',
  33. 'src/gl_util.c',
  34. 'src/gles2_debayer.c',
  35. 'src/ini.c',
  36. 'src/io_pipeline.c',
  37. 'src/main.c',
  38. 'src/matrix.c',
  39. 'src/pipeline.c',
  40. 'src/process_pipeline.c',
  41. 'src/zbar_pipeline.c',
  42. resources,
  43. include_directories: 'src/',
  44. dependencies: [gtkdep, libm, tiff, zbar, threads, epoxy],
  45. install: true,
  46. link_args: '-Wl,-ldl')
  47. install_data(
  48. [
  49. 'config/pine64,pinephone-1.0.ini',
  50. 'config/pine64,pinephone-1.1.ini',
  51. 'config/pine64,pinephone-1.2.ini',
  52. 'config/pine64,pinetab.ini',
  53. ],
  54. install_dir: get_option('datadir') / 'megapixels/config/')
  55. # Tools
  56. executable('megapixels-list-devices',
  57. 'tools/list_devices.c',
  58. 'src/device.c',
  59. include_directories: 'src/',
  60. dependencies: [gtkdep],
  61. install: true)
  62. executable('megapixels-camera-test',
  63. 'tools/camera_test.c',
  64. 'src/camera.c',
  65. 'src/device.c',
  66. include_directories: 'src/',
  67. dependencies: [gtkdep],
  68. install: true)
  69. # Formatting
  70. clang_format = find_program('clang-format-12', required: false)
  71. if clang_format.found()
  72. format_files = [
  73. 'data/blit.frag',
  74. 'data/blit.vert',
  75. 'data/debayer.frag',
  76. 'data/debayer.vert',
  77. 'data/solid.frag',
  78. 'data/solid.vert',
  79. 'src/camera.c',
  80. 'src/camera.h',
  81. 'src/camera_config.c',
  82. 'src/camera_config.h',
  83. 'src/device.c',
  84. 'src/device.h',
  85. 'src/flash.c',
  86. 'src/flash.h',
  87. 'src/gl_util.c',
  88. 'src/gl_util.h',
  89. 'src/gles2_debayer.c',
  90. 'src/gles2_debayer.h',
  91. 'src/io_pipeline.c',
  92. 'src/io_pipeline.h',
  93. 'src/main.c',
  94. 'src/main.h',
  95. 'src/matrix.c',
  96. 'src/matrix.h',
  97. 'src/pipeline.c',
  98. 'src/pipeline.h',
  99. 'src/process_pipeline.c',
  100. 'src/process_pipeline.h',
  101. 'src/zbar_pipeline.c',
  102. 'src/zbar_pipeline.h',
  103. 'tools/camera_test.c',
  104. 'tools/list_devices.c',
  105. ]
  106. run_target('clang-format',
  107. command: ['clang-format.sh', '-i'] + format_files)
  108. run_target('clang-format-check',
  109. command: ['clang-format.sh', '-n', '-Werror'] + format_files)
  110. endif