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

pikawidgetsmarshal = gnome.genmarshal('pikawidgetsmarshal',
  prefix: '_pika_widgets_marshal',
  sources: 'pikawidgetsmarshal.list',
  install_header: false,
)

libpikawidgets_sources_introspectable = files(
  'pikabrowser.c',
  'pikabusybox.c',
  'pikabutton.c',
  'pikacairo-utils.c',
  'pikacellrenderercolor.c',
  'pikacellrenderertoggle.c',
  'pikachainbutton.c',
  'pikacolorarea.c',
  'pikacolorbutton.c',
  'pikacolordisplay.c',
  'pikacolordisplaystack.c',
  'pikacolorhexentry.c',
  'pikacolornotebook.c',
  'pikacolorprofilechooserdialog.c',
  'pikacolorprofilecombobox.c',
  'pikacolorprofilestore.c',
  'pikacolorprofileview.c',
  'pikacolorscaleentry.c',
  'pikacolorselection.c',
  'pikacolorselector.c',
  'pikadialog.c',
  'pikaenumcombobox.c',
  'pikaenumlabel.c',
  'pikaenumstore.c',
  'pikaenumwidgets.c',
  'pikafileentry.c',
  'pikaframe.c',
  'pikahelpui.c',
  'pikahintbox.c',
  'pikaicons.c',
  'pikaintcombobox.c',
  'pikaintradioframe.c',
  'pikaintstore.c',
  'pikalabelcolor.c',
  'pikalabeled.c',
  'pikalabelintwidget.c',
  'pikalabelspin.c',
  'pikalabelstringwidget.c',
  'pikalabelentry.c',
  'pikamemsizeentry.c',
  'pikanumberpairentry.c',
  'pikaoffsetarea.c',
  'pikapageselector.c',
  'pikapatheditor.c',
  'pikapickbutton.c',
  'pikapreview.c',
  'pikapreviewarea.c',
  'pikapropwidgets.c',
  'pikaquerybox.c',
  'pikaruler.c',
  'pikascaleentry.c',
  'pikascrolledpreview.c',
  'pikasizeentry.c',
  'pikaspinbutton.c',
  'pikaspinscale.c',
  'pikastringcombobox.c',
  'pikaunitcombobox.c',
  'pikaunitstore.c',
  'pikawidgets-error.c',
  'pikawidgets.c',
  'pikawidgetsutils.c',
  'pikazoommodel.c',
)

libpikawidgets_sources = [
  libpikawidgets_sources_introspectable,
  'pikacolorscale.c',
  'pikacolorscales.c',
  'pikacolorselect.c',
  'pikacontroller.c',
  'pikaeevl.c',
  'pikawidgets-private.c',

  'pikawidgetsenums.c',
  stamp_widgets_enums,

  pikawidgetsmarshal,
  icons_imgs_sources,
  cursors_sources,
  pickers_sources,
]

libpikawidgets_headers_introspectable = files(
  'pikabrowser.h',
  'pikabusybox.h',
  'pikabutton.h',
  'pikacairo-utils.h',
  'pikacellrenderercolor.h',
  'pikacellrenderertoggle.h',
  'pikachainbutton.h',
  'pikacolorarea.h',
  'pikacolorbutton.h',
  'pikacolordisplay.h',
  'pikacolordisplaystack.h',
  'pikacolorhexentry.h',
  'pikacolornotebook.h',
  'pikacolorprofilechooserdialog.h',
  'pikacolorprofilecombobox.h',
  'pikacolorprofilestore.h',
  'pikacolorprofileview.h',
  'pikacolorscaleentry.h',
  'pikacolorselection.h',
  'pikacolorselector.h',
  'pikadialog.h',
  'pikaenumcombobox.h',
  'pikaenumlabel.h',
  'pikaenumstore.h',
  'pikaenumwidgets.h',
  'pikafileentry.h',
  'pikaframe.h',
  'pikahelpui.h',
  'pikahintbox.h',
  'pikaicons.h',
  'pikaintcombobox.h',
  'pikaintradioframe.h',
  'pikalabelcolor.h',
  'pikalabeled.h',
  'pikalabelintwidget.h',
  'pikalabelspin.h',
  'pikalabelentry.h',
  'pikaintstore.h',
  'pikamemsizeentry.h',
  'pikanumberpairentry.h',
  'pikaoffsetarea.h',
  'pikapageselector.h',
  'pikapatheditor.h',
  'pikapickbutton.h',
  'pikapreview.h',
  'pikapreviewarea.h',
  'pikapropwidgets.h',
  'pikaquerybox.h',
  'pikaruler.h',
  'pikascaleentry.h',
  'pikascrolledpreview.h',
  'pikasizeentry.h',
  'pikaspinbutton.h',
  'pikaspinscale.h',
  'pikastringcombobox.h',
  'pikaunitcombobox.h',
  'pikaunitstore.h',
  'pikawidgets-error.h',
  'pikawidgets.h',
  'pikawidgetsenums.h',
  'pikawidgetstypes.h',
  'pikawidgetsutils.h',
  'pikazoommodel.h',
)

libpikawidgets_headers = [
  libpikawidgets_headers_introspectable,
  'pikacolorscale.h',
  'pikacolorscales.h',
  'pikacolorselect.h',
  'pikacontroller.h',
]

libpikawidgets_introspectable = [
  libpikawidgets_sources_introspectable,
  libpikawidgets_headers_introspectable,
]

if platform_osx
  libpikawidgets_sources += [
    'pikapickbutton-quartz.c',
  ]
elif platform_windows
  libpikawidgets_sources += [
    'pikapickbutton-win32.c',
  ]
else
  libpikawidgets_sources += [
    'pikapickbutton-default.c',
    'pikapickbutton-kwin.c',
    'pikapickbutton-xdg.c',
  ]
endif

libpikawidgets = library('pikawidgets-'+ pika_api_version,
  libpikawidgets_sources,
  include_directories: rootInclude,
  dependencies: [
    gegl, gtk3, lcms, math, mscms
  ],
  c_args: [ '-DG_LOG_DOMAIN="LibPikaWidgets"', '-DPIKA_WIDGETS_COMPILATION', ],
  link_with: [
    libpikabase,
    libpikacolor,
    libpikaconfig,
  ],
  vs_module_defs: 'pikawidgets.def',
  install: true,
  version: so_version,
)

install_headers(
  libpikawidgets_headers,
  subdir: pika_api_name / 'libpikawidgets',
)


# Test programs, not installed

test_preview_area = executable('test-preview-area',
  'test-preview-area.c',
  include_directories: rootInclude,
  dependencies: [
    gtk3,
  ],
  c_args: '-DG_LOG_DOMAIN="LibPikaWidgets"',
  link_with: [ libpikawidgets, ],
  install: false,
  build_by_default: false,
)

test_eevl = executable('test-eevl',
  'test-eevl.c',
  include_directories: rootInclude,
  dependencies: [
    glib, gtk3, math,
  ],
  c_args: '-DG_LOG_DOMAIN="LibPikaWidgets"',
  link_with: [ libpikawidgets, ],
  install: false,
)
