api_version = '0.1'

{{name_}}_sources = [

]

{{name_}}_headers = [
  '{{name}}.h',
]

version_split = meson.project_version().split('.')
MAJOR_VERSION = version_split[0]
MINOR_VERSION = version_split[1]
MICRO_VERSION = version_split[2]

version_conf = configuration_data()
version_conf.set('VERSION', meson.project_version())
version_conf.set('MAJOR_VERSION', MAJOR_VERSION)
version_conf.set('MINOR_VERSION', MINOR_VERSION)
version_conf.set('MICRO_VERSION', MICRO_VERSION)

configure_file(
  input: '{{name}}-version.h.in',
  output: '{{name}}-version.h',
  configuration: version_conf,
  install: true,
  install_dir: join_paths(get_option('includedir'), '{{name}}')
)

{{name_}}_deps = [
  dependency('gio-2.0', version: '>= 2.50'),
]

{{name_}}_lib = shared_library('{{name}}-' + api_version,
  {{name_}}_sources,
  dependencies: {{name_}}_deps,
  install: true,
)

install_headers({{name_}}_headers, subdir: '{{name}}')

pkg = import('pkgconfig')

pkg.generate(
  description: 'A shared library for ...',
    libraries: {{name_}}_lib,
         name: '{{name}}',
     filebase: '{{name}}-' + api_version,
      version: meson.project_version(),
      subdirs: '{{name}}',
     requires: 'glib-2.0',
  install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
