meson.build 3.7 KB

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