meson.build 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. executable('movie_audio_rec',
  61. 'movie_audio_rec.c',
  62. dependencies: [ dependency('libpulse-simple') ],
  63. install : true,
  64. install_dir: get_option('libexecdir') / 'megapixels/',
  65. )
  66. install_data(
  67. [
  68. 'mpegize.py'
  69. ],
  70. install_dir: get_option('libexecdir') / 'megapixels/',
  71. )
  72. configure_file(
  73. input: 'movie.sh.in',
  74. output: 'movie.sh',
  75. configuration: {'LIBEXECDIR': join_paths(get_option('prefix'), get_option('libexecdir')) / 'megapixels/'},
  76. install_dir: get_option('datadir') / 'megapixels/',
  77. install_mode: 'rwxr-xr-x',
  78. )
  79. install_data(
  80. [
  81. 'config/pine64,pinephone,rear.dcp',
  82. 'config/pine64,pinephone,front.dcp',
  83. ],
  84. install_dir: get_option('datadir') / 'megapixels/config/')
  85. # Formatting
  86. clang_format = find_program('clang-format-14', required: false)
  87. if clang_format.found()
  88. format_files = [
  89. 'data/blit.frag',
  90. 'data/blit.vert',
  91. 'data/debayer.frag',
  92. 'data/debayer.vert',
  93. 'data/debayer_packed.frag',
  94. 'data/solid.frag',
  95. 'data/solid.vert',
  96. 'src/camera.c',
  97. 'src/camera.h',
  98. 'src/camera_config.c',
  99. 'src/camera_config.h',
  100. 'src/device.c',
  101. 'src/device.h',
  102. 'src/flash.c',
  103. 'src/flash.h',
  104. 'src/gl_util.c',
  105. 'src/gl_util.h',
  106. 'src/gles2_debayer.c',
  107. 'src/gles2_debayer.h',
  108. 'src/io_pipeline.c',
  109. 'src/io_pipeline.h',
  110. 'src/main.c',
  111. 'src/main.h',
  112. 'src/matrix.c',
  113. 'src/matrix.h',
  114. 'src/mode.c',
  115. 'src/mode.h',
  116. 'src/pipeline.c',
  117. 'src/pipeline.h',
  118. 'src/process_pipeline.c',
  119. 'src/process_pipeline.h',
  120. 'src/zbar_pipeline.c',
  121. 'src/zbar_pipeline.h',
  122. 'tools/camera_test.c',
  123. 'tools/list_devices.c',
  124. ]
  125. run_target('clang-format',
  126. command: ['clang-format.sh', '-i'] + format_files)
  127. run_target('clang-format-check',
  128. command: ['clang-format.sh', '-n', '-Werror'] + format_files)
  129. endif