project('libds', ['c', 'cpp'], license: 'MIT', version: '0.1.3', default_options: [ 'warning_level=3', 'c_std=gnu99', 'buildtype=debug' ] ) cc = meson.get_compiler('c') global_args = cc.get_supported_arguments( '-fvisibility=hidden', ) global_args_maybe = [ '-Wno-unused-parameter', '-Wno-pedantic', ] foreach a : global_args_maybe if cc.has_argument(a) global_args += a endif endforeach add_global_arguments(global_args, language: 'c') # Compute the relative path used by compiler invocations. source_root = meson.current_source_dir().split('/') build_root = meson.global_build_root().split('/') relative_dir_parts = [] i = 0 in_prefix = true foreach p: build_root if i >= source_root.length() or not in_prefix or p != source_root[i] in_prefix = false relative_dir_parts += '..' endif i += 1 endforeach i = 0 in_prefix = true foreach p : source_root if i >= build_root.length() or not in_prefix or build_root[i] != p in_prefix = false relative_dir_parts += p endif i += 1 endforeach relative_dir = join_paths(relative_dir_parts) + '/' if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=') add_project_arguments( '-fmacro-prefix-map=@0@='.format(relative_dir), language: 'c', ) else add_project_arguments( '-D_DS_REL_SRC_DIR="@0@"'.format(relative_dir), language: 'c', ) endif libds_version = meson.project_version() version_arr = libds_version.split('.') libds_version_major = version_arr[0] libds_version_minor = version_arr[1] libds_version_patch = version_arr[2] dir_prefix = get_option('prefix') libds_bindir = join_paths(dir_prefix, get_option('bindir')) libds_inc = include_directories('include') common_inc = [ include_directories('.'), libds_inc ] cdata = configuration_data() cdata.set('LIBDS_VERSION_MAJOR', libds_version_major) cdata.set('LIBDS_VERSION_MINOR', libds_version_minor) cdata.set('LIBDS_VERSION_PATCH', libds_version_patch) wayland_protos = dependency('wayland-protocols', fallback: ['wayland-protocols', 'wayland_protocols'], default_options: ['tests=false'], ) wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') wayland_scanner_dep = dependency('wayland-scanner', native: true) wayland_scanner = find_program( wayland_scanner_dep.get_variable('wayland_scanner'), native: true, ) subdir('src') if get_option('tests') subdir('tests') endif subdir('examples') subdir('clients') subdir('include') configure_file(output: 'config.h', install: false, configuration: cdata)