meson.build 3.2 KB

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