meson.build 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. project(
  2. 'gamemode',
  3. 'c',
  4. default_options : ['c_std=c11'],
  5. version: '0.2',
  6. license: 'BSD',
  7. )
  8. cc = meson.get_compiler('c')
  9. path_prefix = get_option('prefix')
  10. path_bindir = join_paths(path_prefix, get_option('bindir'))
  11. path_datadir = join_paths(path_prefix, get_option('datadir'))
  12. path_includedir = join_paths(path_prefix, get_option('includedir'))
  13. path_libdir = join_paths(path_prefix, get_option('libdir'))
  14. # Find systemd via pkgconfig
  15. dep_systemd = dependency('libsystemd')
  16. # On non glibc systems this might be a stub, i.e. for musl
  17. libdl = cc.find_library('dl', required: false)
  18. # If the path isn't explicitly set, ask systemd for the systemd user unit directory
  19. path_systemd_unit_dir = get_option('with-systemd-user-unit-dir')
  20. if path_systemd_unit_dir == ''
  21. message('Asking pkg-config for systemd\'s directories')
  22. pkgconfig_systemd = dependency('systemd')
  23. path_systemd_unit_dir = pkgconfig_systemd.get_pkgconfig_variable('systemduserunitdir')
  24. endif
  25. with_daemon = get_option('with-daemon')
  26. with_examples = get_option('with-examples')
  27. # Library is always required
  28. subdir('lib')
  29. # The daemon can be disabled if necessary, allowing multilib builds of the
  30. # main library
  31. if with_daemon == true
  32. subdir('daemon')
  33. # All installed data is currently daemon specific
  34. subdir('data')
  35. endif
  36. # Optionally allow building of examples
  37. if with_examples == true
  38. subdir('example')
  39. endif
  40. report = [
  41. ' Build configuration:',
  42. ' ====================',
  43. '',
  44. ' prefix: @0@'.format(path_prefix),
  45. ' bindir: @0@'.format(path_bindir),
  46. ' datadir: @0@'.format(path_datadir),
  47. ' libdir: @0@'.format(path_libdir),
  48. ' includedir: @0@'.format(path_includedir),
  49. ' systemd user unit directory: @0@'.format(path_systemd_unit_dir),
  50. '',
  51. ' Options:',
  52. ' ========',
  53. '',
  54. ' daemon: @0@'.format(with_daemon),
  55. ' examples: @0@'.format(with_examples),
  56. ]
  57. # Output some stuff to validate the build config
  58. message('\n\n\n' + '\n'.join(report) + '\n\n')