You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

178 lines
4.9 KiB

  1. project('foot', 'c',
  2. version: '1.5.2',
  3. license: 'MIT',
  4. meson_version: '>=0.53.0',
  5. default_options: [
  6. 'c_std=c18',
  7. 'warning_level=1',
  8. 'werror=true',
  9. 'b_ndebug=if-release'])
  10. is_debug_build = get_option('buildtype').startswith('debug')
  11. cc = meson.get_compiler('c')
  12. add_project_arguments(
  13. ['-D_POSIX_C_SOURCE=200809L', '-D_GNU_SOURCE=200809L'] +
  14. (is_debug_build
  15. ? ['-D_DEBUG']
  16. : [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
  17. cc.get_supported_arguments(
  18. ['-pedantic',
  19. '-fstrict-aliasing',
  20. '-Wstrict-aliasing']),
  21. language: 'c',
  22. )
  23. # Compute the relative path used by compiler invocations.
  24. source_root = meson.current_source_dir().split('/')
  25. build_root = meson.build_root().split('/')
  26. relative_dir_parts = []
  27. i = 0
  28. in_prefix = true
  29. foreach p : build_root
  30. if i >= source_root.length() or not in_prefix or p != source_root[i]
  31. in_prefix = false
  32. relative_dir_parts += '..'
  33. endif
  34. i += 1
  35. endforeach
  36. i = 0
  37. in_prefix = true
  38. foreach p : source_root
  39. if i >= build_root.length() or not in_prefix or build_root[i] != p
  40. in_prefix = false
  41. relative_dir_parts += p
  42. endif
  43. i += 1
  44. endforeach
  45. relative_dir = join_paths(relative_dir_parts) + '/'
  46. if cc.has_argument('-fmacro-prefix-map=/foo=')
  47. add_project_arguments('-fmacro-prefix-map=@0@='.format(relative_dir), language: 'c')
  48. endif
  49. math = cc.find_library('m')
  50. threads = dependency('threads')
  51. pixman = dependency('pixman-1')
  52. wayland_protocols = dependency('wayland-protocols')
  53. wayland_client = dependency('wayland-client')
  54. wayland_cursor = dependency('wayland-cursor')
  55. xkb = dependency('xkbcommon')
  56. fontconfig = dependency('fontconfig')
  57. tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
  58. fcft = dependency('fcft', version: ['>=2.3.0', '<3.0.0'], fallback: 'fcft')
  59. wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
  60. wscanner = dependency('wayland-scanner', native: true)
  61. wscanner_prog = find_program(
  62. wscanner.get_pkgconfig_variable('wayland_scanner'), native: true)
  63. wl_proto_headers = []
  64. wl_proto_src = []
  65. foreach prot : [
  66. wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml',
  67. wayland_protocols_datadir + '/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
  68. wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml',
  69. wayland_protocols_datadir + '/unstable/primary-selection/primary-selection-unstable-v1.xml',
  70. wayland_protocols_datadir + '/stable/presentation-time/presentation-time.xml',
  71. ]
  72. wl_proto_headers += custom_target(
  73. prot.underscorify() + '-client-header',
  74. output: '@BASENAME@.h',
  75. input: prot,
  76. command: [wscanner_prog, 'client-header', '@INPUT@', '@OUTPUT@'])
  77. wl_proto_src += custom_target(
  78. prot.underscorify() + '-private-code',
  79. output: '@BASENAME@.c',
  80. input: prot,
  81. command: [wscanner_prog, 'private-code', '@INPUT@', '@OUTPUT@'])
  82. endforeach
  83. generate_version_sh = files('generate-version.sh')
  84. version = custom_target(
  85. 'generate_version',
  86. build_always_stale: true,
  87. output: 'version.h',
  88. command: [generate_version_sh, meson.project_version(), '@SOURCE_DIR@', '@OUTPUT@'])
  89. executable(
  90. 'foot',
  91. 'async.c', 'async.h',
  92. 'base64.c', 'base64.h',
  93. 'config.c', 'config.h',
  94. 'commands.c', 'commands.h',
  95. 'csi.c', 'csi.h',
  96. 'dcs.c', 'dcs.h',
  97. 'extract.c', 'extract.h',
  98. 'fdm.c', 'fdm.h',
  99. 'grid.c', 'grid.h',
  100. 'input.c', 'input.h',
  101. 'log.c', 'log.h',
  102. 'macros.h',
  103. 'main.c',
  104. 'misc.c', 'misc.h',
  105. 'osc.c', 'osc.h',
  106. 'quirks.c', 'quirks.h',
  107. 'reaper.c', 'reaper.h',
  108. 'render.c', 'render.h',
  109. 'search.c', 'search.h',
  110. 'selection.c', 'selection.h',
  111. 'server.c', 'server.h',
  112. 'shm.c', 'shm.h',
  113. 'sixel.c', 'sixel.h',
  114. 'sixel-hls.c', 'sixel-hls.h',
  115. 'slave.c', 'slave.h',
  116. 'spawn.c', 'spawn.h',
  117. 'terminal.c', 'terminal.h',
  118. 'tokenize.c', 'tokenize.h',
  119. 'user-notification.h',
  120. 'vt.c', 'vt.h',
  121. 'wayland.c', 'wayland.h',
  122. 'xmalloc.c', 'xmalloc.h',
  123. wl_proto_src + wl_proto_headers, version,
  124. dependencies: [math, threads, pixman, wayland_client, wayland_cursor, xkb, fontconfig,
  125. tllist, fcft],
  126. install: true)
  127. executable(
  128. 'footclient',
  129. 'client.c',
  130. 'log.c', 'log.h',
  131. 'macros.h',
  132. 'xmalloc.c', 'xmalloc.h',
  133. version,
  134. install: true)
  135. tic = find_program('tic', native: true)
  136. custom_target(
  137. 'terminfo',
  138. output: 'f',
  139. input: 'foot.info',
  140. command: [tic, '-x', '-o', '@OUTDIR@', '-e', 'foot,foot-direct', '@INPUT@'],
  141. install: true,
  142. install_dir: join_paths(get_option('datadir'), 'terminfo'))
  143. install_data(
  144. 'LICENSE', 'README.md', 'CHANGELOG.md',
  145. install_dir: join_paths(get_option('datadir'), 'doc', 'foot'))
  146. install_data(
  147. 'foot.desktop', 'foot-server.desktop',
  148. install_dir: join_paths(get_option('datadir'), 'applications'))
  149. install_data('foot.ini', install_dir: join_paths(get_option('datadir'), 'foot'))
  150. subdir('completions')
  151. subdir('doc')
  152. subdir('icons')
  153. # summary(
  154. # {
  155. # '<feature>': false,
  156. # },
  157. # bool_yn: true
  158. # )