if (NOT IS_ABSOLUTE ${IDE_LOGO_PATH})
  set(IDE_LOGO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${IDE_LOGO_PATH}")
endif()
configure_file(core_logo.qrc.cmakein core_logo_cmake.qrc)

add_qtc_plugin(Core
  DEPENDS Qt::PrintSupport Qt::Qml Qt::Sql Qt::Gui Qt::GuiPrivate
  PUBLIC_DEPENDS Aggregation ExtensionSystem Utils app_version
  SOURCES
    actionmanager/actioncontainer.cpp actionmanager/actioncontainer.h actionmanager/actioncontainer_p.h
    actionmanager/actionmanager.cpp actionmanager/actionmanager.h actionmanager/actionmanager_p.h
    actionmanager/command.cpp actionmanager/command.h actionmanager/command_p.h
    actionmanager/commandbutton.cpp actionmanager/commandbutton.h
    actionmanager/commandmappings.cpp actionmanager/commandmappings.h
    actionmanager/commandsfile.cpp actionmanager/commandsfile.h
    actionsfilter.cpp actionsfilter.h
    basefilewizard.cpp basefilewizard.h
    basefilewizardfactory.cpp basefilewizardfactory.h
    ${CMAKE_CURRENT_BINARY_DIR}/core_logo_cmake.qrc
    core.qrc
    core_global.h
    coreconstants.h
    coreicons.cpp coreicons.h
    corejsextensions.cpp corejsextensions.h
    coreplugin.cpp coreplugin.h
    coreplugintr.h
    designmode.cpp designmode.h
    dialogs/addtovcsdialog.cpp dialogs/addtovcsdialog.h
    dialogs/codecselector.cpp dialogs/codecselector.h
    dialogs/externaltoolconfig.cpp dialogs/externaltoolconfig.h
    dialogs/filepropertiesdialog.cpp dialogs/filepropertiesdialog.h
    dialogs/ioptionspage.cpp dialogs/ioptionspage.h
    dialogs/newdialog.cpp dialogs/newdialog.h
    dialogs/newdialogwidget.cpp dialogs/newdialogwidget.h
    dialogs/openwithdialog.cpp dialogs/openwithdialog.h
    dialogs/promptoverwritedialog.cpp dialogs/promptoverwritedialog.h
    dialogs/readonlyfilesdialog.cpp dialogs/readonlyfilesdialog.h
    dialogs/restartdialog.cpp dialogs/restartdialog.h
    dialogs/saveitemsdialog.cpp dialogs/saveitemsdialog.h
    dialogs/settingsdialog.cpp dialogs/settingsdialog.h
    dialogs/shortcutsettings.cpp dialogs/shortcutsettings.h
    diffservice.cpp diffservice.h
    documentmanager.cpp documentmanager.h
    editmode.cpp editmode.h
    editormanager/documentmodel.cpp editormanager/documentmodel.h editormanager/documentmodel_p.h
    editormanager/editorarea.cpp editormanager/editorarea.h
    editormanager/editormanager.cpp editormanager/editormanager.h editormanager/editormanager_p.h
    editormanager/editorview.cpp editormanager/editorview.h
    editormanager/editorwindow.cpp editormanager/editorwindow.h
    editormanager/ieditor.cpp editormanager/ieditor.h
    editormanager/ieditorfactory.cpp editormanager/ieditorfactory.h editormanager/ieditorfactory_p.h
    editormanager/iexternaleditor.cpp editormanager/iexternaleditor.h
    editormanager/openeditorsview.cpp editormanager/openeditorsview.h
    editormanager/openeditorswindow.cpp editormanager/openeditorswindow.h
    editormanager/systemeditor.cpp editormanager/systemeditor.h
    editortoolbar.cpp editortoolbar.h
    externaltool.cpp externaltool.h
    externaltoolmanager.cpp externaltoolmanager.h
    fancyactionbar.cpp fancyactionbar.h
    fancyactionbar.qrc
    fancytabwidget.cpp fancytabwidget.h
    featureprovider.cpp featureprovider.h
    fileutils.cpp fileutils.h
    find/basetextfind.cpp find/basetextfind.h
    find/currentdocumentfind.cpp find/currentdocumentfind.h
    find/find.qrc
    find/findplugin.cpp find/findplugin.h
    find/findtoolbar.cpp find/findtoolbar.h
    find/findtoolwindow.cpp find/findtoolwindow.h
    find/highlightscrollbarcontroller.cpp find/highlightscrollbarcontroller.h
    find/ifindfilter.cpp find/ifindfilter.h
    find/ifindsupport.cpp find/ifindsupport.h
    find/itemviewfind.cpp find/itemviewfind.h
    find/optionspopup.cpp find/optionspopup.h
    find/searchresultcolor.h
    find/searchresultitem.h
    find/searchresulttreeitemdelegate.cpp find/searchresulttreeitemdelegate.h
    find/searchresulttreeitemroles.h
    find/searchresulttreeitems.cpp find/searchresulttreeitems.h
    find/searchresulttreemodel.cpp find/searchresulttreemodel.h
    find/searchresulttreeview.cpp find/searchresulttreeview.h
    find/searchresultwidget.cpp find/searchresultwidget.h
    find/searchresultwindow.cpp find/searchresultwindow.h
    find/textfindconstants.h
    findplaceholder.cpp findplaceholder.h
    foldernavigationwidget.cpp
    foldernavigationwidget.h
    generalsettings.cpp generalsettings.h
    generatedfile.cpp generatedfile.h
    helpitem.cpp helpitem.h
    helpmanager.cpp helpmanager.h helpmanager_implementation.h
    icontext.cpp icontext.h
    icore.cpp icore.h
    idocument.cpp idocument.h
    idocumentfactory.cpp idocumentfactory.h
    ifilewizardextension.h
    imode.cpp imode.h
    inavigationwidgetfactory.cpp inavigationwidgetfactory.h
    ioutputpane.cpp ioutputpane.h
    iversioncontrol.cpp iversioncontrol.h
    iwelcomepage.cpp iwelcomepage.h
    iwizardfactory.cpp iwizardfactory.h
    jsexpander.cpp jsexpander.h
    locator/basefilefilter.cpp locator/basefilefilter.h
    locator/commandlocator.cpp locator/commandlocator.h
    locator/directoryfilter.cpp locator/directoryfilter.h
    locator/executefilter.cpp locator/executefilter.h
    locator/externaltoolsfilter.cpp locator/externaltoolsfilter.h
    locator/filesystemfilter.cpp locator/filesystemfilter.h
    locator/ilocatorfilter.cpp locator/ilocatorfilter.h
    locator/javascriptfilter.cpp locator/javascriptfilter.h
    locator/locator.cpp locator/locator.h
    locator/locatorconstants.h
    locator/locatorfiltersfilter.cpp locator/locatorfiltersfilter.h
    locator/locatormanager.cpp locator/locatormanager.h
    locator/locatorsearchutils.cpp locator/locatorsearchutils.h
    locator/locatorsettingspage.cpp locator/locatorsettingspage.h
    locator/locatorwidget.cpp locator/locatorwidget.h
    locator/opendocumentsfilter.cpp locator/opendocumentsfilter.h
    locator/spotlightlocatorfilter.h locator/spotlightlocatorfilter.cpp
    locator/urllocatorfilter.cpp locator/urllocatorfilter.h
    loggingviewer.cpp loggingviewer.h
    loggingmanager.cpp loggingmanager.h
    mainwindow.cpp mainwindow.h
    manhattanstyle.cpp manhattanstyle.h
    messagebox.cpp messagebox.h
    messagemanager.cpp messagemanager.h
    messageoutputwindow.cpp messageoutputwindow.h
    mimetypemagicdialog.cpp mimetypemagicdialog.h
    mimetypesettings.cpp mimetypesettings.h
    minisplitter.cpp minisplitter.h
    modemanager.cpp modemanager.h
    navigationsubwidget.cpp navigationsubwidget.h
    navigationwidget.cpp navigationwidget.h
    opendocumentstreeview.cpp opendocumentstreeview.h
    outputpane.cpp outputpane.h
    outputpanemanager.cpp outputpanemanager.h
    outputwindow.cpp outputwindow.h
    patchtool.cpp patchtool.h
    plugindialog.cpp plugindialog.h
    plugininstallwizard.cpp plugininstallwizard.h
    progressmanager/futureprogress.cpp progressmanager/futureprogress.h
    progressmanager/processprogress.cpp progressmanager/processprogress.h
    progressmanager/progressbar.cpp progressmanager/progressbar.h
    progressmanager/progressmanager.cpp progressmanager/progressmanager.h progressmanager/progressmanager_p.h
    progressmanager/progressview.cpp progressmanager/progressview.h
    progressmanager/taskprogress.cpp progressmanager/taskprogress.h
    rightpane.cpp rightpane.h
    settingsdatabase.cpp settingsdatabase.h
    sidebar.cpp sidebar.h
    sidebarwidget.cpp sidebarwidget.h
    statusbarmanager.cpp statusbarmanager.h
    styleanimator.cpp styleanimator.h
    systemsettings.cpp systemsettings.h
    textdocument.cpp textdocument.h
    themechooser.cpp themechooser.h
    vcsmanager.cpp vcsmanager.h
    versiondialog.cpp versiondialog.h
    welcomepagehelper.cpp welcomepagehelper.h
    windowsupport.cpp windowsupport.h
  EXPLICIT_MOC dialogs/filepropertiesdialog.h
)

extend_qtc_plugin(Core
  CONDITION SHOW_BUILD_DATE
  DEFINES QTC_SHOW_BUILD_DATE
)

extend_qtc_plugin(Core
  CONDITION WITH_TESTS
  SOURCES
    locator/locator_test.cpp
    locator/locatorfiltertest.cpp locator/locatorfiltertest.h
    testdatadir.cpp testdatadir.h
)

extend_qtc_plugin(Core
  CONDITION WIN32
  SOURCES progressmanager/progressmanager_win.cpp
)

extend_qtc_plugin(Core
  CONDITION APPLE
  DEPENDS ${FWAppKit}
  SOURCES
    progressmanager/progressmanager_mac.mm
)

extend_qtc_plugin(Core
  CONDITION (NOT WIN32) AND (NOT APPLE)
  SOURCES progressmanager/progressmanager_x11.cpp
)

extend_qtc_plugin(Core
  CONDITION BUILD_WITH_CRASHPAD
  DEFINES ENABLE_CRASHPAD
)

if ((NOT WIN32) AND (NOT APPLE))
  # install logo
  foreach(size 16 24 32 48 64 128 256 512)
    install(
      FILES ${IDE_LOGO_PATH}/images/logo/${size}/QtProject-qtcreator.png
      DESTINATION share/icons/hicolor/${size}x${size}/apps
    )
  endforeach()
endif()

set(FONTS_BASE "${QtCreator_SOURCE_DIR}/src/share/3rdparty/studiofonts/")
qt_add_resources(Core
  CoreWelcomeScreenFonts_rcc
  BASE ${FONTS_BASE}
  PREFIX "studiofonts"
  FILES "${FONTS_BASE}/TitilliumWeb-Regular.ttf"
)
