blob: 97f13a2bf03da616a9dbb5698a441ec417de5e0e [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')
taylorchuc27dd482014-05-17 20:06:49 -07009 opt.load('boost sparkle xcode default-compiler-flags', 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":
taylorchuc27dd482014-05-17 20:06:49 -070016 grp.add_option('--with-qt4', help='''Build QT4 app, instead of native one''',
17 action='store_true', dest='with_qt4', default=False)
18 grp.add_option('--with-qt5', help='''Build QT5 app, instead of native one''',
19 action='store_true', dest='with_qt5', default=False)
Alexander Afanasyeva822b572013-11-04 12:36:34 -080020
Alexander Afanasyev749f0652013-09-22 13:03:21 -070021def configure(conf):
taylorchuc27dd482014-05-17 20:06:49 -070022 conf.load('compiler_c compiler_cxx default-compiler-flags boost')
Alexander Afanasyev749f0652013-09-22 13:03:21 -070023
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070024 conf.start_msg('Checking for NFD tools in %s' % conf.options.with_nfd)
25 if not conf.find_file(['nfd-start', 'nfd-stop'],
26 path_list='%s/bin' % conf.options.with_nfd, mandatory=False):
27 conf.fatal('not found', 'RED')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070028 else:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070029 conf.end_msg('ok')
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070030
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070031 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
32 uselib_store='NDN_CXX', mandatory=True)
Alexander Afanasyev86240d02013-11-08 23:32:53 -080033
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070034 conf.define('NFD_ROOT', conf.options.with_nfd)
35 conf.define('NFD_START_COMMAND', '%s/bin/nfd-start' % conf.options.with_nfd)
36 conf.define('NFD_STOP_COMMAND', '%s/bin/nfd-stop' % conf.options.with_nfd)
37 conf.define('NFD_AUTOCONFIG_COMMAND', '%s/bin/ndn-autoconfig' % conf.options.with_nfd)
38
taylorchuc27dd482014-05-17 20:06:49 -070039 conf.check_boost(lib="system thread")
40
41 if not conf.options.with_qt4 and not not conf.options.with_qt4 and Utils.unversioned_sys_platform() == "darwin":
Alexander Afanasyeva822b572013-11-04 12:36:34 -080042 conf.env.BUILD_OSX_NATIVE = 1
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070043 conf.recurse('osx')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080044 else:
taylorchuc27dd482014-05-17 20:06:49 -070045 if conf.options.with_qt5:
46 conf.env.BUILD_QT5 = 1
47 conf.recurse('qt5')
48 else:
49 conf.env.BUILD_QT4 = 1
50 conf.recurse('qt4')
Alexander Afanasyeveb111572013-11-08 22:59:43 -080051
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070052 conf.write_config_header('config.hpp')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070053
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070054def build(bld):
Alexander Afanasyeva822b572013-11-04 12:36:34 -080055 if bld.env.BUILD_OSX_NATIVE:
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070056 bld.recurse('osx')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080057 else:
taylorchuc27dd482014-05-17 20:06:49 -070058 if bld.env.BUILD_QT5:
59 bld.recurse('qt5')
60 else:
61 bld.recurse('qt4')