#! /usr/bin/env python
## This script demonstrates how to build and install
## a simple kde program having KconfigXT settings
## with scons
##
## Thomas Nagy, 2004, 2005

## This file can be reused freely for any project (see COPYING)

############################
## load the config

## Use the environment and the tools set in the top-level
## SConstruct file (set with 'Export') - this is very important

Import( 'env' )
myenv=env.Copy()

#############################
## the programs to build

# The sources for our program - only .ui, .skel and .cpp are accepted
kgraphviewer_sources="""
preferencesReload.ui
preferencesOpenInExistingWindow.ui
preferencesReopenPreviouslyOpenedFiles.ui
main.cpp 
kgraphviewer.cpp
kgraphviewerConfigDialog.cpp
kgraphviewersettings.kcfgc
dcopkgraphvieweriface.skel
"""

# The sources for the part
part_sources="""
kgraphviewer_part.cpp
graphsubgraph.cpp
graphnode.cpp
graphedge.cpp
graphexporter.cpp
pannerview.cpp
canvassubgraph.cpp
canvasnode.cpp
canvasedge.cpp
dotgraph.cpp
dotgraphview.cpp
dot2qtconsts.cpp
dotgrammar.cpp
FontsCache.cpp
kgraphviewer_partsettings.kcfgc
"""


# Our main program
# KDEprogram add the file to the install targets automatically,
# so you do not need to write KDEinstall('KDEBIN', '', test1, myenv)
myenv.KDEprogram( 'kgraphviewer', kgraphviewer_sources )

myenv2=env.Copy()
myenv2.KDEshlib( 'libkgraphviewerpart', part_sources )

############################
## Customization

## Additional include paths for compiling the source files
## Always add '../' (top-level directory) because moc makes code that needs it
myenv.KDEaddpaths_includes('#/src/  #/')

## Necessary libraries to link against
myenv.KDEaddlibs( 'qt-mt kio kdecore kdeprint kparts' )

## Part parameters
myenv2.KDEaddpaths_includes('#/src/printing/ #/src/  #/')
myenv2.KDEaddpaths_libs('#/src/printing/ #/src/  #/')
myenv2.KDEaddlibs( 'qt-mt kio kparts khtml kgraphviewerprinting' )
myenv2.KDEaddflags_link(['-module'])

myenv2.KDEaddflags_cxx("-fno-exceptions -fno-check-new -fno-common")

## If you are using QThread, add this line
#myenv.KDEaddflags_cxx(['-DQT_THREAD_SUPPORT'])

#############################
## Data to install

## The ui.rc file and the tips go into datadir/appname/
myenv.KDEinstall( 'KDEDATA', 'kgraphviewer', 'kgraphviewer_shell.rc' )
#myenv.KDEinstall( 'KDEDATA', 'test1', 'tips' )

## The kcfg file is installed in a global kcfg directory
myenv.KDEinstall( 'KDEKCFG', '', 'kgraphviewersettings.kcfg' )

## Warning : there is a difference between the normal destop file used for the menu
##     and the servicetype desktop file, so they go in different directories
##     you will find more information in 'test3'
myenv.KDEinstall( 'KDEMENU', 'Utilities', 'kgraphviewer.desktop')

## Part data
myenv.KDEinstall( 'KDEDATA', 'kgraphviewerpart', 'kgraphviewer_part.desktop' )
myenv.KDEinstall( 'KDEDATA', 'kgraphviewerpart', 'kgraphviewer_part.rc' )
myenv.KDEinstall( 'KDEDATA', 'kgraphviewer/pics', 'kgraphviewer-bev.png' )

myenv.KDEinstall( 'KDEXDG', '', 'kgraphviewer_part.desktop' )

## Use this when you need to install a mimetype file
myenv.KDEinstall( 'KDEMIME', 'application', 'x-kgraphviewer.desktop' )

## Let bksys handle icons automatically
myenv.KDEicon()
