# -*- 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('lumieravessel',  srcSubtree('vessel'),addLibs=lLib,             install=True)
lVault = env.SharedLibrary('lumieravault',   srcSubtree('vault'), addLibs=lLib+lApp,        install=True)
lSteam = env.SharedLibrary('lumierasteam',   srcSubtree('steam'), addLibs=lLib+lApp+lVault, install=True)

            # in reverse dependency order
core        = lSteam+lVault+lApp+lLib    # used to build the core application
support_lib = lLib                       # use to link against the support lib only
vessel_lib  = lApp+support_lib           # use to link against the application-framework
vault_lib   = lVault+vessel_lib          # use to link against the low-level backend
core_lib    = lSteam+vault_lib           # use to link against the core application

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','sigc++-2.0','gthread-2.0','cairomm-1.0','gdl','xv','x11','xext','sm'])

guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('stage') + core, install=True)
resources = ( [env.GuiResource(f) for f in scanSubtree('stage', ['*.css'])]         # note: collected into one target dir
            )
gui       = ( guimodule
            + resources
            + icons
            )


Export('lumiera core core_lib vessel_lib vault_lib support_lib plugins envGtk guimodule gui')
