meson.build 3.1 KB

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