meson.build 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/solid.frag',
  94. 'data/solid.vert',
  95. 'src/camera.c',
  96. 'src/camera.h',
  97. 'src/camera_config.c',
  98. 'src/camera_config.h',
  99. 'src/device.c',
  100. 'src/device.h',
  101. 'src/flash.c',
  102. 'src/flash.h',
  103. 'src/gl_util.c',
  104. 'src/gl_util.h',
  105. 'src/gles2_debayer.c',
  106. 'src/gles2_debayer.h',
  107. 'src/io_pipeline.c',
  108. 'src/io_pipeline.h',
  109. 'src/main.c',
  110. 'src/main.h',
  111. 'src/matrix.c',
  112. 'src/matrix.h',
  113. 'src/mode.c',
  114. 'src/mode.h',
  115. 'src/pipeline.c',
  116. 'src/pipeline.h',
  117. 'src/process_pipeline.c',
  118. 'src/process_pipeline.h',
  119. 'src/zbar_pipeline.c',
  120. 'src/zbar_pipeline.h',
  121. 'tools/camera_test.c',
  122. 'tools/list_devices.c',
  123. ]
  124. run_target('clang-format',
  125. command: ['clang-format.sh', '-i'] + format_files)
  126. run_target('clang-format-check',
  127. command: ['clang-format.sh', '-n', '-Werror'] + format_files)
  128. endif