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') |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 9 | opt.load('boost sparkle xcode default-compiler-flags', 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": |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 16 | 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 Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 20 | |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 21 | def configure(conf): |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 22 | conf.load('compiler_c compiler_cxx default-compiler-flags boost') |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 23 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 24 | 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 Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 28 | else: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 29 | conf.end_msg('ok') |
Alexander Afanasyev | 6cacb97 | 2013-10-03 23:39:06 -0700 | [diff] [blame] | 30 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 31 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 32 | uselib_store='NDN_CXX', mandatory=True) |
Alexander Afanasyev | 86240d0 | 2013-11-08 23:32:53 -0800 | [diff] [blame] | 33 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 34 | 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 | |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 39 | 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 Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 42 | conf.env.BUILD_OSX_NATIVE = 1 |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 43 | conf.recurse('osx') |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 44 | else: |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 45 | 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 Afanasyev | eb11157 | 2013-11-08 22:59:43 -0800 | [diff] [blame] | 51 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 52 | conf.write_config_header('config.hpp') |
Alexander Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 53 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 54 | def build(bld): |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 55 | if bld.env.BUILD_OSX_NATIVE: |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 56 | bld.recurse('osx') |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 57 | else: |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 58 | if bld.env.BUILD_QT5: |
| 59 | bld.recurse('qt5') |
| 60 | else: |
| 61 | bld.recurse('qt4') |