blob: 66b998a7a5999464379a308f62901f8316d88a05 [file] [log] [blame]
Alexander Afanasyev749f0652013-09-22 13:03:21 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07002VERSION='0.1'
3APPNAME='nfd-control-center'
Alexander Afanasyev749f0652013-09-22 13:03:21 -07004
5from waflib import Logs, Utils, Task, TaskGen
6
7def options(opt):
Alexander Afanasyeveb111572013-11-08 22:59:43 -08008 opt.load('compiler_c compiler_cxx qt4 gnu_dirs')
Alexander Afanasyevd1a75b82013-09-25 16:50:04 -07009 opt.load('sparkle xcode', tooldir='waf-tools')
Alexander Afanasyev749f0652013-09-22 13:03:21 -070010
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070011 grp = opt.add_option_group('NFD Control Center options')
12 grp.add_option('--with-nfd', dest='with_nfd', type=str, default='/usr/local',
13 help='''Root path to NFD installation (default: /usr/local)''')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070014
Alexander Afanasyeva822b572013-11-04 12:36:34 -080015 if Utils.unversioned_sys_platform () == "darwin":
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070016 grp.add_option('--with-qt', help='''Build QT4 app, instead of native one''',
17 action='store_true', dest='with_qt', default=False)
Alexander Afanasyeva822b572013-11-04 12:36:34 -080018
Alexander Afanasyev749f0652013-09-22 13:03:21 -070019def configure(conf):
20 conf.load('compiler_c compiler_cxx')
21
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070022 conf.start_msg('Checking for NFD tools in %s' % conf.options.with_nfd)
23 if not conf.find_file(['nfd-start', 'nfd-stop'],
24 path_list='%s/bin' % conf.options.with_nfd, mandatory=False):
25 conf.fatal('not found', 'RED')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070026 else:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070027 conf.end_msg('ok')
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070028
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070029 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
30 uselib_store='NDN_CXX', mandatory=True)
Alexander Afanasyev86240d02013-11-08 23:32:53 -080031
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070032 conf.define('NFD_ROOT', conf.options.with_nfd)
33 conf.define('NFD_START_COMMAND', '%s/bin/nfd-start' % conf.options.with_nfd)
34 conf.define('NFD_STOP_COMMAND', '%s/bin/nfd-stop' % conf.options.with_nfd)
35 conf.define('NFD_AUTOCONFIG_COMMAND', '%s/bin/ndn-autoconfig' % conf.options.with_nfd)
36
37 if not conf.options.with_qt and Utils.unversioned_sys_platform() == "darwin":
38 # conf.fatal("Native implementation of NFD Control Center is not yet available")
Alexander Afanasyeva822b572013-11-04 12:36:34 -080039 conf.env.BUILD_OSX_NATIVE = 1
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070040 conf.recurse('osx')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080041 else:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070042 conf.recurse('qt')
Alexander Afanasyeveb111572013-11-08 22:59:43 -080043
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070044 conf.write_config_header('config.hpp')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070045
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070046def build(bld):
Alexander Afanasyeva822b572013-11-04 12:36:34 -080047 if bld.env.BUILD_OSX_NATIVE:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070048 bld.recurse('osx')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080049 else:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070050 bld.recurse('qt')