meson.build 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. path_libexecdir = join_paths(path_prefix, get_option('libexecdir'))
  15. # Find systemd via pkgconfig
  16. dep_systemd = dependency('libsystemd')
  17. # Allow meson to figure out how the compiler sets up threading
  18. dep_threads = dependency('threads')
  19. # On non glibc systems this might be a stub, i.e. for musl
  20. libdl = cc.find_library('dl', required: false)
  21. # Set the dbus path as appropriate.
  22. path_dbus_service_dir = get_option('with-dbus-service-dir')
  23. if path_dbus_service_dir == ''
  24. path_dbus_service_dir = join_paths(path_datadir, 'dbus-1', 'services')
  25. endif
  26. path_polkit_action_dir = join_paths(path_datadir, 'polkit-1', 'actions')
  27. with_daemon = get_option('with-daemon')
  28. with_examples = get_option('with-examples')
  29. # Provide config.h so the daemon knows where the helper is
  30. cdata = configuration_data()
  31. cdata.set_quoted('LIBEXECDIR', path_libexecdir)
  32. config_h = configure_file(
  33. configuration: cdata,
  34. output: 'config.h',
  35. )
  36. config_h_dir = include_directories('.')
  37. # Library is always required
  38. subdir('lib')
  39. # The daemon can be disabled if necessary, allowing multilib builds of the
  40. # main library
  41. if with_daemon == true
  42. subdir('daemon')
  43. # All installed data is currently daemon specific
  44. subdir('data')
  45. endif
  46. # Optionally allow building of examples
  47. if with_examples == true
  48. subdir('example')
  49. endif
  50. report = [
  51. ' Build configuration:',
  52. ' ====================',
  53. '',
  54. ' prefix: @0@'.format(path_prefix),
  55. ' bindir: @0@'.format(path_bindir),
  56. ' datadir: @0@'.format(path_datadir),
  57. ' libdir: @0@'.format(path_libdir),
  58. ' libexecdir: @0@'.format(path_libexecdir),
  59. ' includedir: @0@'.format(path_includedir),
  60. ' D-BUS service directory: @0@'.format(path_dbus_service_dir),
  61. ' PolKit Action Directory: @0@'.format(path_polkit_action_dir),
  62. '',
  63. ' Options:',
  64. ' ========',
  65. '',
  66. ' daemon: @0@'.format(with_daemon),
  67. ' examples: @0@'.format(with_examples),
  68. ]
  69. # Output some stuff to validate the build config
  70. message('\n\n\n' + '\n'.join(report) + '\n\n')