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 | 712dedc | 2017-02-09 16:31:41 -0800 | [diff] [blame] | 2 | VERSION='0.2.1' |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 3 | APPNAME='nfd-control-center' |
Alexander Afanasyev | e095ed1 | 2017-02-04 23:09:55 -0800 | [diff] [blame] | 4 | APPCAST='https://named-data.net/binaries/NFD-Control-Center/ndn-control-center.xml' |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 5 | |
| 6 | from waflib import Logs, Utils, Task, TaskGen |
Alexander Afanasyev | 38d74ec | 2016-11-14 10:22:48 +0900 | [diff] [blame] | 7 | import os |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 8 | |
| 9 | def options(opt): |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 10 | opt.load('compiler_c compiler_cxx qt5 gnu_dirs') |
Alexander Afanasyev | fda42a8 | 2017-02-01 18:03:39 -0800 | [diff] [blame] | 11 | opt.load('boost osx-frameworks default-compiler-flags', tooldir='.waf-tools') |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 12 | |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 13 | def configure(conf): |
Alexander Afanasyev | fda42a8 | 2017-02-01 18:03:39 -0800 | [diff] [blame] | 14 | conf.load('compiler_c compiler_cxx default-compiler-flags boost osx-frameworks') |
Alexander Afanasyev | 38d74ec | 2016-11-14 10:22:48 +0900 | [diff] [blame] | 15 | |
| 16 | if 'PKG_CONFIG_PATH' not in os.environ: |
Alexander Afanasyev | 3766775 | 2017-02-02 13:52:12 -0800 | [diff] [blame] | 17 | conf.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env) |
Alexander Afanasyev | 38d74ec | 2016-11-14 10:22:48 +0900 | [diff] [blame] | 18 | |
| 19 | # add homebrew path, as qt5 is no longer linked |
Alexander Afanasyev | 3766775 | 2017-02-02 13:52:12 -0800 | [diff] [blame] | 20 | conf.environ['PKG_CONFIG_PATH'] += ":/usr/local/opt/qt5/lib/pkgconfig:/opt/qt5/5.8/clang_64/lib/pkgconfig" |
| 21 | conf.environ['PATH'] += ":/usr/local/opt/qt5/bin:/opt/qt5/5.8/clang_64/bin" |
Alexander Afanasyev | 38d74ec | 2016-11-14 10:22:48 +0900 | [diff] [blame] | 22 | |
| 23 | conf.load('qt5') |
Alexander Afanasyev | 6cacb97 | 2013-10-03 23:39:06 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 25 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 26 | uselib_store='NDN_CXX', mandatory=True) |
Alexander Afanasyev | 86240d0 | 2013-11-08 23:32:53 -0800 | [diff] [blame] | 27 | |
taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame] | 28 | conf.check_boost(lib="system thread") |
| 29 | |
Alexander Afanasyev | 0621cec | 2016-03-20 23:18:27 -0700 | [diff] [blame] | 30 | conf.define('RESOURCES_DIR', Utils.subst_vars("${DATAROOTDIR}/nfd-control-center", conf.env)) |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 31 | |
| 32 | if Utils.unversioned_sys_platform() == "darwin": |
| 33 | conf.define('OSX_BUILD', 1) |
Alexander Afanasyev | eb11157 | 2013-11-08 22:59:43 -0800 | [diff] [blame] | 34 | |
Qi Zhao | 3615a10 | 2017-02-02 20:38:34 -0800 | [diff] [blame] | 35 | conf.define('NCC_VERSION', VERSION) |
| 36 | conf.define('NCC_APPCAST', APPCAST) |
| 37 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 38 | conf.write_config_header('config.hpp') |
Alexander Afanasyev | 2beff7f | 2013-09-27 17:50:36 -0700 | [diff] [blame] | 39 | |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 40 | def build(bld): |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 41 | app = bld( |
| 42 | features=['qt5', 'cxxprogram', 'cxx'], |
| 43 | includes = ". src", |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 44 | use = "NDN_CXX BOOST QT5CORE QT5DBUS QT5QML QT5WIDGETS", |
Alexander Afanasyev | 3766775 | 2017-02-02 13:52:12 -0800 | [diff] [blame] | 45 | moc = "src/tray-menu.hpp src/key-tree-model.hpp src/key-viewer-dialog.hpp src/cert-tree-model.hpp src/fib-status.hpp src/forwarder-status.hpp", |
| 46 | source = bld.path.ant_glob(['src/*.cpp', 'src/**/*.qrc', 'src/**/*.ui', 'src/**/*.qrc'], excl=['src/osx-*']), |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 47 | ) |
| 48 | |
| 49 | if Utils.unversioned_sys_platform() != "darwin": |
susmit | 90b7182 | 2016-03-20 13:31:23 -0600 | [diff] [blame] | 50 | app.target = "nfd-control-center" |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 51 | |
| 52 | bld(features = "subst", |
Alexander Afanasyev | 0621cec | 2016-03-20 23:18:27 -0700 | [diff] [blame] | 53 | source = 'nfd-control-center.desktop.in', |
| 54 | target = 'nfd-control-center.desktop', |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 55 | BINARY = "nfd-control-center", |
| 56 | install_path = "${DATAROOTDIR}/nfd-control-center" |
| 57 | ) |
| 58 | |
| 59 | bld.install_files("${DATAROOTDIR}/nfd-control-center", |
Alexander Afanasyev | 0621cec | 2016-03-20 23:18:27 -0700 | [diff] [blame] | 60 | bld.path.ant_glob(['res/*'])) |
Alexander Afanasyev | a822b57 | 2013-11-04 12:36:34 -0800 | [diff] [blame] | 61 | else: |
Qi Zhao | 3615a10 | 2017-02-02 20:38:34 -0800 | [diff] [blame] | 62 | bld(features="subst", |
| 63 | source='src/Info.plist.in', |
| 64 | target='src/Info.plist', |
| 65 | install_path=None, |
| 66 | VERSION=VERSION, |
| 67 | APPCAST=APPCAST) |
| 68 | bld.env['INCLUDES_NDN_TOOLS'] = 'build/ndn-tools' |
| 69 | |
Alexander Afanasyev | fda42a8 | 2017-02-01 18:03:39 -0800 | [diff] [blame] | 70 | app.source += bld.path.ant_glob(['src/osx-*.mm', 'src/osx-*.cpp']) |
Qi Zhao | 3615a10 | 2017-02-02 20:38:34 -0800 | [diff] [blame] | 71 | app.use += " OSX_FOUNDATION OSX_APPKIT OSX_SPARKLE OSX_COREWLAN NDN_TOOLS" |
Alexander Afanasyev | e334215 | 2016-03-20 11:23:57 -0700 | [diff] [blame] | 72 | app.target = "NFD Control Center" |
| 73 | app.mac_app = True |
Alexander Afanasyev | 4c37bfb | 2016-03-20 12:06:30 -0700 | [diff] [blame] | 74 | app.mac_plist = 'src/Info.plist' |
Alexander Afanasyev | 3766775 | 2017-02-02 13:52:12 -0800 | [diff] [blame] | 75 | app.mac_files = [i.path_from(bld.path) for i in bld.path.ant_glob('res/**/*', excl='**/*.ai')] |
Alexander Afanasyev | fda42a8 | 2017-02-01 18:03:39 -0800 | [diff] [blame] | 76 | |
| 77 | from waflib import TaskGen |
| 78 | @TaskGen.extension('.mm') |
| 79 | def m_hook(self, node): |
| 80 | """Alias .mm files to be compiled the same as .cpp files, gcc/clang will do the right thing.""" |
| 81 | return self.create_compiled_task('cxx', node) |