blob: bee976f2416b100f2392b0eef50d0a4d21b3e771 [file] [log] [blame]
Alexander Afanasyev749f0652013-09-22 13:03:21 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Qi Zhao3615a102017-02-02 20:38:34 -08002VERSION='0.2'
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07003APPNAME='nfd-control-center'
Qi Zhao3615a102017-02-02 20:38:34 -08004APPCAST='https://irl.cs.ucla.edu/~cawka/ndn-control-center.xml'
Alexander Afanasyev749f0652013-09-22 13:03:21 -07005
6from waflib import Logs, Utils, Task, TaskGen
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +09007import os
Alexander Afanasyev749f0652013-09-22 13:03:21 -07008
9def options(opt):
Alexander Afanasyeve3342152016-03-20 11:23:57 -070010 opt.load('compiler_c compiler_cxx qt5 gnu_dirs')
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080011 opt.load('boost osx-frameworks default-compiler-flags', tooldir='.waf-tools')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080012
Alexander Afanasyev749f0652013-09-22 13:03:21 -070013def configure(conf):
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080014 conf.load('compiler_c compiler_cxx default-compiler-flags boost osx-frameworks')
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +090015
16 if 'PKG_CONFIG_PATH' not in os.environ:
Alexander Afanasyev37667752017-02-02 13:52:12 -080017 conf.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +090018
19 # add homebrew path, as qt5 is no longer linked
Alexander Afanasyev37667752017-02-02 13:52:12 -080020 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 Afanasyev38d74ec2016-11-14 10:22:48 +090022
23 conf.load('qt5')
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070024
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070025 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
26 uselib_store='NDN_CXX', mandatory=True)
Alexander Afanasyev86240d02013-11-08 23:32:53 -080027
taylorchuc27dd482014-05-17 20:06:49 -070028 conf.check_boost(lib="system thread")
29
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070030 conf.define('RESOURCES_DIR', Utils.subst_vars("${DATAROOTDIR}/nfd-control-center", conf.env))
Alexander Afanasyeve3342152016-03-20 11:23:57 -070031
32 if Utils.unversioned_sys_platform() == "darwin":
33 conf.define('OSX_BUILD', 1)
Alexander Afanasyeveb111572013-11-08 22:59:43 -080034
Qi Zhao3615a102017-02-02 20:38:34 -080035 conf.define('NCC_VERSION', VERSION)
36 conf.define('NCC_APPCAST', APPCAST)
37
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070038 conf.write_config_header('config.hpp')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070039
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070040def build(bld):
Alexander Afanasyeve3342152016-03-20 11:23:57 -070041 app = bld(
42 features=['qt5', 'cxxprogram', 'cxx'],
43 includes = ". src",
Alexander Afanasyeve3342152016-03-20 11:23:57 -070044 use = "NDN_CXX BOOST QT5CORE QT5DBUS QT5QML QT5WIDGETS",
Alexander Afanasyev37667752017-02-02 13:52:12 -080045 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 Afanasyeve3342152016-03-20 11:23:57 -070047 )
48
49 if Utils.unversioned_sys_platform() != "darwin":
susmit90b71822016-03-20 13:31:23 -060050 app.target = "nfd-control-center"
Alexander Afanasyeve3342152016-03-20 11:23:57 -070051
52 bld(features = "subst",
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070053 source = 'nfd-control-center.desktop.in',
54 target = 'nfd-control-center.desktop',
Alexander Afanasyeve3342152016-03-20 11:23:57 -070055 BINARY = "nfd-control-center",
56 install_path = "${DATAROOTDIR}/nfd-control-center"
57 )
58
59 bld.install_files("${DATAROOTDIR}/nfd-control-center",
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070060 bld.path.ant_glob(['res/*']))
Alexander Afanasyeva822b572013-11-04 12:36:34 -080061 else:
Qi Zhao3615a102017-02-02 20:38:34 -080062 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 Afanasyevfda42a82017-02-01 18:03:39 -080070 app.source += bld.path.ant_glob(['src/osx-*.mm', 'src/osx-*.cpp'])
Qi Zhao3615a102017-02-02 20:38:34 -080071 app.use += " OSX_FOUNDATION OSX_APPKIT OSX_SPARKLE OSX_COREWLAN NDN_TOOLS"
Alexander Afanasyeve3342152016-03-20 11:23:57 -070072 app.target = "NFD Control Center"
73 app.mac_app = True
Alexander Afanasyev4c37bfb2016-03-20 12:06:30 -070074 app.mac_plist = 'src/Info.plist'
Alexander Afanasyev37667752017-02-02 13:52:12 -080075 app.mac_files = [i.path_from(bld.path) for i in bld.path.ant_glob('res/**/*', excl='**/*.ai')]
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080076
77from waflib import TaskGen
78@TaskGen.extension('.mm')
79def 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)