Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 2 | VERSION='0.1' |
| 3 | APPNAME='nfd-control-center' |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 4 | |
| 5 | from waflib import Logs, Utils, Task, TaskGen |
| 6 | |
| 7 | def options(opt): |
Alexander Afanasyev | eb11157 | 2013-11-08 22:59:43 -0800 | [diff] [blame] | 8 | opt.load('compiler_c compiler_cxx qt4 gnu_dirs') |
Alexander Afanasyev | d1a75b8 | 2013-09-25 16:50:04 -0700 | [diff] [blame] | 9 | opt.load('sparkle xcode', tooldir='waf-tools') |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 10 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 11 | 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 Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 14 | |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 15 | if Utils.unversioned_sys_platform () == "darwin": |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 16 | grp.add_option('--with-qt', help='''Build QT4 app, instead of native one''', |
| 17 | action='store_true', dest='with_qt', default=False) |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 18 | |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 19 | def configure(conf): |
| 20 | conf.load('compiler_c compiler_cxx') |
| 21 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 22 | 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 Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 26 | else: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 27 | conf.end_msg('ok') |
Alexander Afanasyev | 6cacb97 | 2013-10-03 23:39:06 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 29 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 30 | uselib_store='NDN_CXX', mandatory=True) |
Alexander Afanasyev | 86240d0 | 2013-11-08 23:32:53 -0800 | [diff] [blame] | 31 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 32 | 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 Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 39 | conf.env.BUILD_OSX_NATIVE = 1 |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 40 | conf.recurse('osx') |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 41 | else: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 42 | conf.recurse('qt') |
Alexander Afanasyev | eb11157 | 2013-11-08 22:59:43 -0800 | [diff] [blame] | 43 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 44 | conf.write_config_header('config.hpp') |
Alexander Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 45 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 46 | def build(bld): |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 47 | if bld.env.BUILD_OSX_NATIVE: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 48 | bld.recurse('osx') |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 49 | else: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame^] | 50 | bld.recurse('qt') |