#***************************************************************************
#*   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(Qt4 REQUIRED)
FIND_PACKAGE(KActivities) 

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

INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} ${KDE4_INCLUDES} ${QT_INCLUDES} ${QT_QTWEBKIT_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/skgbasemodeler
)
LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})

SET(skgbasegui_SRCS
   skguniqueapplication.cpp
   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
   skglineedit.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
 )
 
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
   skglineeditdesignerplugin.cpp
   skgcalculatoreditdesignerplugin.cpp
   skggraphicsviewdesignerplugin.cpp
   skgshowdesignerplugin.cpp
   skgtablewithgraphdesignerplugin.cpp
   skgdateeditdesignerplugin.cpp
   skgprogressbardesignerplugin.cpp
   skgperiodeditdesignerplugin.cpp
 ) 

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

kde4_add_kcfg_files(skgbasegui_SRCS skgbasegui_settings.kcfgc )

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

if (KActivities_FOUND)
    MESSAGE( STATUS "     KActivity FOUND" )
    TARGET_LINK_LIBRARIES(skgbasegui ${KACTIVITIES_LIBRARY})
endif (KActivities_FOUND)

TARGET_LINK_LIBRARIES(skgbasegui ${KDE4_KPARTS_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY} skgbasemodeler)
SET_TARGET_PROPERTIES( skgbasegui PROPERTIES VERSION ${SKG_VERSION} SOVERSION ${SOVERSION} )

TARGET_LINK_LIBRARIES(skgbaseguidesigner ${KDE4_KPARTS_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTWEBKIT_LIBRARY} skgbasegui skgbasemodeler)

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

INSTALL(FILES ${PROJECT_SOURCE_DIR}/skgmainpanel.rc  DESTINATION  ${DATA_INSTALL_DIR}/skg )
INSTALL(FILES ${PROJECT_SOURCE_DIR}/skgbasegui_settings.kcfg  DESTINATION  ${KCFG_INSTALL_DIR} )
INSTALL(FILES ${PROJECT_SOURCE_DIR}/skg-plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})

kde4_install_icons(${ICON_INSTALL_DIR})
