blob: a25a5ad6f60667d23d2fe36c1f8e93c38b6650c3 [file] [log] [blame]
Alexander Afanasyev749f0652013-09-22 13:03:21 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Alexander Afanasyev2f1787c2016-03-22 17:44:04 -07002VERSION='0.1.1'
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07003APPNAME='nfd-control-center'
Alexander Afanasyev749f0652013-09-22 13:03:21 -07004
5from waflib import Logs, Utils, Task, TaskGen
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +09006import os
Alexander Afanasyev749f0652013-09-22 13:03:21 -07007
8def options(opt):
Alexander Afanasyeve3342152016-03-20 11:23:57 -07009 opt.load('compiler_c compiler_cxx qt5 gnu_dirs')
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080010 opt.load('boost osx-frameworks default-compiler-flags', tooldir='.waf-tools')
Alexander Afanasyeva822b572013-11-04 12:36:34 -080011
Alexander Afanasyev749f0652013-09-22 13:03:21 -070012def configure(conf):
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080013 conf.load('compiler_c compiler_cxx default-compiler-flags boost osx-frameworks')
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +090014
15 if 'PKG_CONFIG_PATH' not in os.environ:
Alexander Afanasyev37667752017-02-02 13:52:12 -080016 conf.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
Alexander Afanasyev38d74ec2016-11-14 10:22:48 +090017
18 # add homebrew path, as qt5 is no longer linked
Alexander Afanasyev37667752017-02-02 13:52:12 -080019 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 Afanasyev38d74ec2016-11-14 10:22:48 +090021
22 conf.load('qt5')
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070023
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070024 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
25 uselib_store='NDN_CXX', mandatory=True)
Alexander Afanasyev86240d02013-11-08 23:32:53 -080026
taylorchuc27dd482014-05-17 20:06:49 -070027 conf.check_boost(lib="system thread")
28
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070029 conf.define('RESOURCES_DIR', Utils.subst_vars("${DATAROOTDIR}/nfd-control-center", conf.env))
Alexander Afanasyeve3342152016-03-20 11:23:57 -070030
31 if Utils.unversioned_sys_platform() == "darwin":
32 conf.define('OSX_BUILD', 1)
Alexander Afanasyeveb111572013-11-08 22:59:43 -080033
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070034 conf.write_config_header('config.hpp')
Alexander Afanasyev2beff7f2013-09-27 17:50:36 -070035
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070036def build(bld):
Alexander Afanasyeve3342152016-03-20 11:23:57 -070037 app = bld(
38 features=['qt5', 'cxxprogram', 'cxx'],
39 includes = ". src",
Alexander Afanasyeve3342152016-03-20 11:23:57 -070040 use = "NDN_CXX BOOST QT5CORE QT5DBUS QT5QML QT5WIDGETS",
Alexander Afanasyev37667752017-02-02 13:52:12 -080041 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 Afanasyeve3342152016-03-20 11:23:57 -070043 )
44
45 if Utils.unversioned_sys_platform() != "darwin":
susmit90b71822016-03-20 13:31:23 -060046 app.target = "nfd-control-center"
Alexander Afanasyeve3342152016-03-20 11:23:57 -070047
48 bld(features = "subst",
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070049 source = 'nfd-control-center.desktop.in',
50 target = 'nfd-control-center.desktop',
Alexander Afanasyeve3342152016-03-20 11:23:57 -070051 BINARY = "nfd-control-center",
52 install_path = "${DATAROOTDIR}/nfd-control-center"
53 )
54
55 bld.install_files("${DATAROOTDIR}/nfd-control-center",
Alexander Afanasyev0621cec2016-03-20 23:18:27 -070056 bld.path.ant_glob(['res/*']))
Alexander Afanasyeva822b572013-11-04 12:36:34 -080057 else:
Alexander Afanasyevfda42a82017-02-01 18:03:39 -080058 app.source += bld.path.ant_glob(['src/osx-*.mm', 'src/osx-*.cpp'])
59 app.use += " OSX_FOUNDATION OSX_APPKIT OSX_SPARKLE OSX_COREWLAN"
Alexander Afanasyeve3342152016-03-20 11:23:57 -070060 app.target = "NFD Control Center"
61 app.mac_app = True
Alexander Afanasyev4c37bfb2016-03-20 12:06:30 -070062 app.mac_plist = 'src/Info.plist'
Alexander Afanasyev37667752017-02-02 13:52:12 -080063 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 -080064
65from waflib import TaskGen
66@TaskGen.extension('.mm')
67def 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)