#***************************************************************************
#*   Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr  *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU General Public License as published by  *
#*   the Free Software Foundation; either version 2 of the License, or     *
#*   (at your option) any later version.                                   *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU General Public License for more details.                          *
#*                                                                         *
#*   You should have received a copy of the GNU General Public License     *
#*   along with this program.  If not, see <http://www.gnu.org/licenses/>  *
#***************************************************************************
MESSAGE( STATUS "..:: CMAKE SKGBASEGUI ::..")

PROJECT(SKGBASEGUI)

FIND_PACKAGE(KF5Activities) 
FIND_PACKAGE(KF5 5.0.0 REQUIRED COMPONENTS 
  GuiAddons             # Tier 1
  Notifications         # Tier 3  
  NotifyConfig          # Tier 3  
)

MESSAGE( STATUS "     QT_QTWEBKIT_INCLUDE_DIR  : " ${QT_QTWEBKIT_INCLUDE_DIR} )

LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})

SET(skgbasegui_SRCS
   skgmainpanel.cpp
   skgobjectmodelbase.cpp
   skgwidget.cpp
   skgperiodedit.cpp
   skgtabwidget.cpp
   skgtablewidget.cpp
   skgtabpage.cpp
   skginterfaceplugin.cpp
   skgtableview.cpp
   skgfilteredtableview.cpp
   skgtreeview.cpp
   skgcombobox.cpp
   skgcolorbutton.cpp
   skgzoomselector.cpp
   skgcalculatoredit.cpp
   skggraphicsscene.cpp
   skggraphicsview.cpp
   skghtmlboardwidget.cpp
   skgboardwidget.cpp   
   skgtablewithgraph.cpp
   skgdateedit.cpp
   skgprogressbar.cpp
   kdateedit.cpp
   kdatepickerpopup.cpp
   kdatevalidator.cpp
   skgsortfilterproxymodel.cpp
   skgflowlayout.cpp
   skgwebview.cpp
   skgshow.cpp
   skgwidgetselector.cpp
   skgsimpleperiodedit.cpp
 )
 
SET(skgbasegui_designer_SRCS
   skgwidgetcollectiondesignerplugin.cpp
   skgtabwidgetdesignerplugin.cpp
   skgtablewidgetdesignerplugin.cpp
   skgtableviewdesignerplugin.cpp
   skgfilteredtableviewdesignerplugin.cpp
   skgtreeviewdesignerplugin.cpp
   skgcomboboxdesignerplugin.cpp
   skgcolorbuttondesignerplugin.cpp
   skgwidgetselectordesignerplugin.cpp
   skgwebviewdesignerplugin.cpp
   skgzoomselectordesignerplugin.cpp
   skgcalculatoreditdesignerplugin.cpp
   skggraphicsviewdesignerplugin.cpp
   skgshowdesignerplugin.cpp
   skgtablewithgraphdesignerplugin.cpp
   skgdateeditdesignerplugin.cpp
   skgprogressbardesignerplugin.cpp
   skgperiodeditdesignerplugin.cpp
   skgsimpleperiodeditdesignerplugin.cpp
 ) 

ki18n_wrap_ui(skgbasegui_SRCS skgmainpanel_base.ui skgmainpanel_pref.ui skggraphicsview.ui skgtablewithgraph.ui skgcolorbutton.ui skgzoomselector.ui skgperiodedit.ui skgfilteredtableview.ui skgwidgetselector.ui )

kconfig_add_kcfg_files(skgbasegui_SRCS skgbasegui_settings.kcfgc )

ADD_LIBRARY(skgbasegui SHARED ${skgbasegui_SRCS})
ADD_LIBRARY(skgbaseguidesigner SHARED ${skgbasegui_SRCS} ${skgbasegui_designer_SRCS})

if (KActivities_FOUND)
    MESSAGE( STATUS "     KActivity FOUND" )
    TARGET_LINK_LIBRARIES(skgbasegui LINK_PUBLIC KF5::Activities)
endif (KActivities_FOUND)

TARGET_LINK_LIBRARIES(skgbasegui LINK_PUBLIC KF5::Parts KF5::KIOFileWidgets KF5::NotifyConfig KF5::Notifications Qt5::QuickWidgets Qt5::PrintSupport Qt5::Svg Qt5::WebKitWidgets Qt5::Designer skgbasemodeler)
SET_TARGET_PROPERTIES( skgbasegui PROPERTIES VERSION ${SKG_VERSION} SOVERSION ${SOVERSION} )

TARGET_LINK_LIBRARIES(skgbaseguidesigner LINK_PUBLIC KF5::Parts KF5::KIOFileWidgets KF5::NotifyConfig KF5::Notifications Qt5::QuickWidgets Qt5::PrintSupport Qt5::Svg Qt5::WebKitWidgets Qt5::Designer skgbasemodeler)

GENERATE_EXPORT_HEADER(skgbasegui BASE_NAME skgbasegui)

########### install files ###############
INSTALL(TARGETS skgbasegui ${INSTALL_TARGETS_DEFAULT_ARGS}  )
IF(SKG_BUILD_TEST)
  IF(WIN32)
    INSTALL(TARGETS skgbaseguidesigner LIBRARY ARCHIVE DESTINATION ${PLUGIN_INSTALL_DIR}/designer )
  ELSE(WIN32)
    INSTALL(TARGETS skgbaseguidesigner LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}/designer )
  ENDIF(WIN32)
ENDIF(SKG_BUILD_TEST)  

INSTALL(FILES ${PROJECT_SOURCE_DIR}/skgmainpanel.rc  DESTINATION  ${KDE_INSTALL_KXMLGUI5DIR}/skg )
INSTALL(FILES ${PROJECT_SOURCE_DIR}/skgbasegui_settings.kcfg  DESTINATION  ${KDE_INSTALL_KCFGDIR} )
INSTALL(FILES ${PROJECT_SOURCE_DIR}/org.kde.skg-plugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})

INSTALL(DIRECTORY icons_breeze/ DESTINATION ${ICON_INSTALL_DIR}/breeze/actions/22 FILES_MATCHING PATTERN "*.svgz")
INSTALL(DIRECTORY icons_breeze-dark/ DESTINATION ${ICON_INSTALL_DIR}/breeze-dark/actions/22 FILES_MATCHING PATTERN "*.svgz")

ECM_INSTALL_ICONS(ICONS
    icons_hicolor/16-actions-skg-chart-bubble.png
    icons_hicolor/22-actions-skg-chart-bubble.png
    icons_hicolor/32-actions-skg-chart-bubble.png
    icons_hicolor/48-actions-skg-chart-bubble.png
    icons_hicolor/64-actions-skg-chart-bubble.png
    icons_hicolor/128-actions-skg-chart-bubble.png
    icons_hicolor/256-actions-skg-chart-bubble.png
    icons_hicolor/512-actions-skg-chart-bubble.png
    icons_hicolor/sc-actions-skg-chart-bubble.svgz
    DESTINATION ${ICON_INSTALL_DIR}
    THEME hicolor
)
