# -*- python -*-
##
## SConscript  -  SCons buildscript for the Lumiera Application.
##                Definitions how to build the main tree
##

from Buildhelper import srcSubtree
from Buildhelper import scanSubtree

Import('env icons config')

# define the source file/dirs comprising each artifact to be built.

lLib  = env.SharedLibrary('lumierasupport', srcSubtree('lib'),                             install=True)
lApp  = env.SharedLibrary('lumieracommon',  srcSubtree('common'), addLibs=lLib,            install=True)
lBack = env.SharedLibrary('lumierabackend', srcSubtree('backend'),addLibs=lLib+lApp,       install=True)
lProc = env.SharedLibrary('lumieraproc',    srcSubtree('proc'),   addLibs=lLib+lApp+lBack, install=True)

core        = lProc+lBack+lApp+lLib    # in reverse dependency order
support_lib = lLib
app_lib     = lApp+support_lib
backend_lib = lBack+app_lib
core_lib    = core

lumiera = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True)
          + config
          )

# Install the lumiera application:
# symlink the executable into the bin dir
env.SymLink('#$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera')


# building Lumiera Plugins
plugins = [] # currently none 


# the Lumiera GTK GUI
envGtk = env.Clone()
envGtk.mergeConf(['gtkmm-3.0','gthread-2.0','cairomm-1.0','gdl','xv','x11','xext','sm'])
envGtk.Append(LIBS=core)

guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('gui'), install=True)
gui       = ( guimodule
            + icons
            + [env.GuiResource(f) for f in env.Glob('gui/*.css')]
            )


Export('lumiera core core_lib app_lib backend_lib support_lib plugins guimodule gui')
