# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

VERSION='0.0.1'
APPNAME='sync'

def options(opt):
    opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
    opt.add_option('--log4cxx', action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx/native NS3 logging support''')
    opt.add_option('--ns3',     action='store_true',default=False,dest='ns3_enable',help='''Compile as NS-3 module''')
    opt.add_option('--ns3-debug', action='store_true',default=False,dest='ns3_debug',help='''Link against debug NS3 libraries. Optimized version will be used otherwise''')
    opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
    opt.load('compiler_c')
    opt.load('compiler_cxx')
    opt.load('boost')
    opt.load('doxygen')
    opt.load('ccnx tinyxml ns3', tooldir=["waf-tools"])

def configure(conf):
    conf.load("compiler_cxx")

    if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
      libcrypto = conf.check_cc(lib='crypto',
                                header_name='openssl/crypto.h',
                                define_name='HAVE_SSL',
                                uselib_store='SSL')
    if not conf.get_define ("HAVE_SSL"):
        conf.fatal ("Cannot find SSL libraries")

    conf.load('boost')

    if conf.options.ns3_enable:
        conf.load('ns3')
        conf.define('NS3_MODULE', 1)
        conf.check_modules(['core', 'network', 'internet'], mandatory = True)
        conf.check_modules(['NDNabstraction'], mandatory = True)
        conf.check_modules(['point-to-point'], mandatory = False)
        conf.check_modules(['point-to-point-layout'], mandatory = False)

        conf.check_boost(lib='system iostreams thread')
        conf.define ('NS3_LOG_ENABLE', 1)
    else:
        conf.check_boost(lib='system iostreams test thread')

        conf.load ('ccnx')
        conf.check_ccnx (path=conf.options.ccnx_dir)

        if conf.options.log4cxx:
            conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)

    if conf.options.debug:
        conf.define ('_DEBUG', 1)
        conf.env.append_value('CXXFLAGS', ['-O0', '-g3'])
    else:
        conf.env.append_value('CXXFLAGS', ['-O3', '-g'])

    if conf.options._test:
      conf.define('_TEST', 1)

    try:
        conf.load('doxygen')
    except:
        pass

    conf.load('tinyxml')
    conf.check_tinyxml ()
                   
def build (bld):
    if bld.get_define ("NS3_MODULE"):
        sync_ns3 = bld.shlib (
            target = "sync-ns3",
            features=['cxx', 'cxxshlib'],
            source =  [
                'ns3/sync-ccnx-wrapper.cc',
                'ns3/sync-ns3-name-info.cc',
                'ns3/sync-scheduler.cc',
                'ns3/sync-logic-helper.cc',
                
                # 'model/sync-app-data-fetch.cc',
                # 'model/sync-app-data-publish.cc',
                # 'ns3/sync-app.cc',

                'model/sync-diff-leaf.cc',
                'model/sync-diff-state.cc',
                'model/sync-digest.cc',
                'model/sync-full-leaf.cc',
                'model/sync-full-state.cc',
                'model/sync-interest-table.cc',
                'model/sync-leaf.cc',
                'model/sync-logic.cc',
                'model/sync-name-info.cc',
                'model/sync-seq-no.cc',
                'model/sync-state.cc',
                'model/sync-std-name-info.cc',
                ],
            use = 'BOOST BOOST_IOSTREAMS SSL TINYXML ' + ' '.join (['ns3_'+dep for dep in ['core', 'network', 'internet', 'NDNabstraction']]).upper (),
            includes = ['include', 'include/ns3', 'helper'],
            )

        example = bld.program (
            target = "sync-example",
            features=['cxx', 'cxxprogram'],
            source = ['examples/sync-example.cc'],
            use = 'sync-ns3',
            includes = ['include', 'include/ns3', 'helper'],
            )

        sync_eval = bld.program (
            target = "sync-eval",
            features=['cxx', 'cxxprogram'],
            source = ['evaluation/sync-eval.cc',
                      'evaluation/standard-muc.cc',
                      'evaluation/sync-muc.cc',
                      ],
            use = 'sync-ns3',
            includes = ['include', 'include/ns3', 'helper'],
            )
        # from waflib import Utils,Logs,Errors
        # Logs.pprint ('CYAN', program.use)
        
    else:
        libsync = bld.shlib (
            target=APPNAME, 
            features=['cxx', 'cxxshlib'],
            source =  [
                'ccnx/sync-ccnx-wrapper.cc',
                'ccnx/sync-scheduler.cc',
                'ccnx/sync-log.cc',
                'ccnx/sync-app-socket-c.cc',
                'ccnx/sync-app-socket.cc',
                'model/sync-diff-leaf.cc',
                'model/sync-diff-state.cc',
                'model/sync-digest.cc',
                'model/sync-full-leaf.cc',
                'model/sync-full-state.cc',
                'model/sync-interest-table.cc',
                'model/sync-leaf.cc',
                'model/sync-logic.cc',
                'model/sync-name-info.cc',
                'model/sync-seq-no.cc',
                'model/sync-state.cc',
                'model/sync-std-name-info.cc',
                ],
            use = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL TINYXML CCNX',
            includes = ['include', 'helper'],
            )
        
        # Unit tests
        if bld.get_define("_TEST"):
          unittests = bld.program (
              target="unit-tests",
              source = bld.path.ant_glob(['test/**/*.cc']),
              features=['cxx', 'cxxprogram'],
              use = 'BOOST_TEST sync',
              includes = ['include', 'helper'],
              )

        if bld.get_define ("HAVE_LOG4CXX"):
            libsync.use += ' LOG4CXX'
            unittests.use += ' LOG4CXX'

# doxygen docs
from waflib.Build import BuildContext
class doxy (BuildContext):
    cmd = "doxygen"
    fun = "doxygen"

def doxygen (bld):
    if not bld.env.DOXYGEN:
        bld.fatal ("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
    bld (features="doxygen",
         doxyfile='doc/doxygen.conf',
         output_dir = 'doc')
