stamp_config_enums = custom_target('stamp-config-enums.h',
  input : [
    files(
      'config-enums.h'
    ),
  ],
  output: [ 'stamp-config-enums.h', ],
  command: [
    mkenums_wrap, perl,
    meson.project_source_root(), meson.current_source_dir(),
    meson.current_build_dir(),
    'config-',
    '#include <gio/gio.h>\n'              +
    '#include "libpikabase/pikabase.h"\n',
    '#include "pika-intl.h"'
  ],
  build_by_default: true
)

libappconfig_sources = [
  'pikaconfig-dump.c',
  'pikaconfig-file.c',
  'pikaconfig-utils.c',
  'pikacoreconfig.c',
  'pikadialogconfig.c',
  'pikadisplayconfig.c',
  'pikadisplayoptions.c',
  'pikaearlyrc.c',
  'pikageglconfig.c',
  'pikaguiconfig.c',
  'pikapluginconfig.c',
  'pikarc-deserialize.c',
  'pikarc-serialize.c',
  'pikarc-unknown.c',
  'pikarc.c',
  'pikaxmlparser.c',

  'config-enums.c',
  stamp_config_enums,
]

libappconfig = static_library('appconfig',
  libappconfig_sources,
  include_directories: [ rootInclude, rootAppInclude, ],
  c_args: '-DG_LOG_DOMAIN="Pika-Config"',
  dependencies: [
    cairo, gegl, gdk_pixbuf, gio, gio_specific, libmypaint,
  ],
)

test('app-config',
  executable('test-config',
    [ 'test-config.c', app_debug_files, ],

    dependencies: [
      appstream_glib,
      libapp_dep,
    ],
    link_with: [
      libpikabase,
      libpikaconfig,
      libpikacolor,
      libpikamath,
      libpikamodule,
      libpikathumb,

      libappconfig,
    ],
    install: false,
  ),
  suite: 'app'
)
