# Copyright 2011-2015 Roberto Daniel Gimenez Gamarra (chilabot@gmail.com)
# (C.I.: 1.439.390 - Paraguay)

#! /usr/bin/env python
# encoding: utf-8

import wafmod.generators
import wafmod.util

def options(opt):
    pass

def configure(ctx):
    pass

def build(ctx):
    glob = ctx.GLOBAL

    project = glob.archiveLib()
    project.compilationArg("{target.comp_args}")

    project.includePath("{boost.include}")

    project.compilationArg("{qt5.include}")

    project.pkgConfigVars("Qt5Qml")

    qtDefines = ['-DQT_QML_DEBUG',
                 '-DQT_DECLARATIVE_DEBUG',
                 '-DQT_QUICK_LIB',
                 '-DQT_WIDGETS_LIB',
                 '-DQT_GUI_LIB',
                 '-DQT_QML_LIB',
                 '-DQT_NETWORK_LIB',
                 '-DQT_CORE_LIB']

    for deff in qtDefines:
        project.compilationArg(deff)

    project.pkgConfigVars("Qt5Widgets")

    project.addGenerator(wafmod.generators.QMLMocGenerator(
        mocPath=glob.env["qt5.home"] + "/gcc_64/bin/moc",
        srcFile="SigConn.fgen.hpp",
        destFile="SigConn.ii",
        flags=["-i "] + project.pkgConfigVarsFlags("Qt5Widgets") + qtDefines))

    project.generate()


