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