meson.build 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. project('megapixels', 'c', version: '1.4.3')
  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/mode.c',
  40. 'src/pipeline.c',
  41. 'src/process_pipeline.c',
  42. 'src/zbar_pipeline.c',
  43. resources,
  44. include_directories: 'src/',
  45. dependencies: [gtkdep, libm, tiff, zbar, threads, epoxy],
  46. install: true,
  47. link_args: '-Wl,-ldl')
  48. install_data(
  49. [
  50. 'config/pine64,pinephone-1.0.ini',
  51. 'config/pine64,pinephone-1.1.ini',
  52. 'config/pine64,pinephone-1.2.ini',
  53. 'config/pine64,pinetab.ini',
  54. ],
  55. install_dir: get_option('datadir') / 'megapixels/config/')
  56. # Tools
  57. executable('megapixels-list-devices',
  58. 'tools/list_devices.c',
  59. 'src/device.c',
  60. 'src/mode.c',
  61. include_directories: 'src/',
  62. dependencies: [gtkdep],
  63. install: true)
  64. executable('megapixels-camera-test',
  65. 'tools/camera_test.c',
  66. 'src/camera.c',
  67. 'src/device.c',
  68. 'src/mode.c',
  69. include_directories: 'src/',
  70. dependencies: [gtkdep],
  71. install: true)
  72. # Formatting
  73. clang_format = find_program('clang-format-14', required: false)
  74. if clang_format.found()
  75. format_files = [
  76. 'data/blit.frag',
  77. 'data/blit.vert',
  78. 'data/debayer.frag',
  79. 'data/debayer.vert',
  80. 'data/solid.frag',
  81. 'data/solid.vert',
  82. 'src/camera.c',
  83. 'src/camera.h',
  84. 'src/camera_config.c',
  85. 'src/camera_config.h',
  86. 'src/device.c',
  87. 'src/device.h',
  88. 'src/flash.c',
  89. 'src/flash.h',
  90. 'src/gl_util.c',
  91. 'src/gl_util.h',
  92. 'src/gles2_debayer.c',
  93. 'src/gles2_debayer.h',
  94. 'src/io_pipeline.c',
  95. 'src/io_pipeline.h',
  96. 'src/main.c',
  97. 'src/main.h',
  98. 'src/matrix.c',
  99. 'src/matrix.h',
  100. 'src/mode.c',
  101. 'src/mode.h',
  102. 'src/pipeline.c',
  103. 'src/pipeline.h',
  104. 'src/process_pipeline.c',
  105. 'src/process_pipeline.h',
  106. 'src/zbar_pipeline.c',
  107. 'src/zbar_pipeline.h',
  108. 'tools/camera_test.c',
  109. 'tools/list_devices.c',
  110. ]
  111. run_target('clang-format',
  112. command: ['clang-format.sh', '-i'] + format_files)
  113. run_target('clang-format-check',
  114. command: ['clang-format.sh', '-n', '-Werror'] + format_files)
  115. endif