#***************************************************************************
#*   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
   skgtabwidgetdesignerplugin.cpp
   skgtabwidget.cpp
   skgtablewidgetdesignerplugin.cpp
   skgtablewidget.cpp
   skgtabpage.cpp
   skginterfaceplugin.cpp
   skgwidgetcollectiondesignerplugin.cpp
   skgtableviewdesignerplugin.cpp
   skgtableview.cpp
   skgfilteredtableviewdesignerplugin.cpp
   skgfilteredtableview.cpp
   skgtreeviewdesignerplugin.cpp
   skgtreeview.cpp
   skgcomboboxdesignerplugin.cpp
   skgcombobox.cpp
   skgcolorbuttondesignerplugin.cpp
   skgcolorbutton.cpp
   skgzoomselectordesignerplugin.cpp
   skgzoomselector.cpp
   skglineeditdesignerplugin.cpp
   skglineedit.cpp
   skgcalculatoreditdesignerplugin.cpp
   skgcalculatoredit.cpp
   skggraphicsviewdesignerplugin.cpp
   skggraphicsscene.cpp
   skggraphicsview.cpp
   skghtmlboardwidget.cpp
   skgboardwidget.cpp   
   skgtablewithgraphdesignerplugin.cpp
   skgtablewithgraph.cpp
   skgdateeditdesignerplugin.cpp
   skgprogressbardesignerplugin.cpp
   skgdateedit.cpp
   skgprogressbar.cpp
   kdateedit.cpp
   kdatepickerpopup.cpp
   kdatevalidator.cpp
   skgdatepickerpopup.cpp
   skgsortfilterproxymodel.cpp
   skgflowlayout.cpp
   skgwebview.cpp
   skgwebviewdesignerplugin.cpp
   skgshowdesignerplugin.cpp
   skgshow.cpp
   skgwidgetselectordesignerplugin.cpp
   skgwidgetselector.cpp
 )

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

kde4_add_kcfg_files(skgbasegui_SRCS skgbasegui_settings.kcfgc )

KDE4_ADD_LIBRARY(skgbasegui SHARED ${skgbasegui_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} skgbasemodeler)
SET_TARGET_PROPERTIES( skgbasegui PROPERTIES VERSION ${SKG_VERSION} SOVERSION ${SOVERSION} )

########### install files ###############
INSTALL(TARGETS skgbasegui ${INSTALL_TARGETS_DEFAULT_ARGS}  )
IF(SKG_BUILD_TEST)
  IF(WIN32)
    INSTALL(TARGETS skgbasegui LIBRARY ARCHIVE DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/designer )
  ELSE(WIN32)
    INSTALL(TARGETS skgbasegui 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})
