+policy_to_install = get_option('policy-default')
+if policy_to_install == 'auto' or policy_to_install == 'allow-all'
+ srcs_agl_compositor += 'src/policy-default.c'
+ message('Installing allow all policy')
+elif policy_to_install == 'deny-all'
+ srcs_agl_compositor += 'src/policy-deny.c'
+ message('Installing deny all policy')
+elif policy_to_install == 'rba'
+ srcs_agl_compositor += ['src/policy-rba.c', 'src/rba_adapter.cpp']
+ deps_libweston += dependency('librba')
+ message('Installing rba policy')
+endif
+
+# From meson documentation:
+# In order to look for headers in a specific directory you can use args :
+# '-I/extra/include/dir, but this should only be used in exceptional cases for
+# includes that can't be detected via pkg-config and passed via dependencies.
+if libweston_dep.found()
+ if not meson.is_cross_build()
+ if not prefix_path.contains('/usr')
+ dir_path_x11_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_headless_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-headless.h')
+ dir_path_rdp_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-rdp.h')
+ else
+ dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_headless_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
+ dir_path_rdp = join_paths(libweston_version, 'libweston', 'backend-rdp.h')
+ endif
+ else
+ message('Building with cross environment')
+ dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_headless_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
+ dir_path_rdp_backend = join_paths(libweston_version, 'libweston', 'backend-rdp.h')
+ endif
+
+ # do the test
+ if cc.has_header(dir_path_x11_backend)
+ config_h.set('HAVE_BACKEND_X11', 1)
+ message('Building with X11 backend')
+ endif
+
+ if cc.has_header(dir_path_headless_backend)
+ config_h.set('HAVE_BACKEND_HEADLESS', 1)
+ message('Building with headless backend')
+ endif
+
+ if cc.has_header(dir_path_rdp_backend)
+ config_h.set('HAVE_BACKEND_RDP', 1)
+ message('Building with RDP backend')
+ endif
+endif
+
+if dep_libsystemd.found()
+ config_h.set('HAVE_SYSTEMD', 1)
+
+ srcs_agl_compositor += 'src/systemd-notify.c'
+ deps_libweston += dep_libsystemd
+
+ message('Found systemd, enabling notify support')
+endif
+
+if deps_remoting.length() == depnames.length()
+ config_h.set('HAVE_REMOTING', 1)
+ message('Found remoting depends, enabling remoting')
+endif
+
+if get_option('xwayland')
+ config_h.set('BUILD_XWAYLAND', '1')
+
+ srcs_agl_compositor += 'src/xwayland.c'
+ config_h.set_quoted('XSERVER_PATH', get_option('xwayland-path'))
+endif
+
+dir_module_agl_compositor = join_paths(join_paths(prefix_path, get_option('libdir')), 'agl-compositor')
+
+libexec_compositor = shared_library(
+ 'exec_compositor',
+ sources: srcs_agl_compositor,
+ dependencies: deps_libweston,
+ install_dir: dir_module_agl_compositor,
+ install: true,
+ version: meson.project_version(),
+ soversion: 0
+)
+
+dep_libexec_compositor = declare_dependency(
+ link_with: libexec_compositor,
+ include_directories: [ include_directories('.') ],
+ dependencies: deps_libweston,
+)
+
+configure_file(output: 'config.h', configuration: config_h)
+