Fix environment

Change-Id: Ic053e2717a222f4db36e03ef1bba8a72c6bcaafa
diff --git a/wscript b/wscript
index ce27968..4920f07 100644
--- a/wscript
+++ b/wscript
@@ -5,57 +5,52 @@
 from waflib import Logs, Utils, Task, TaskGen
 
 def options(opt):
-    opt.load('compiler_c compiler_cxx qt4 gnu_dirs')
-    opt.load('boost sparkle xcode default-compiler-flags', tooldir='waf-tools')
+    opt.load('compiler_c compiler_cxx qt5 gnu_dirs')
+    opt.load('msvs boost sparkle xcode default-compiler-flags', tooldir='.waf-tools')
 
-    grp = opt.add_option_group('NFD Control Center options')
-    grp.add_option('--with-nfd', dest='with_nfd', type=str, default='/usr/local',
-                   help='''Root path to NFD installation (default: /usr/local)''')
-
-    if Utils.unversioned_sys_platform () == "darwin":
-        grp.add_option('--with-qt4', help='''Build QT4 app, instead of native one''',
-                       action='store_true', dest='with_qt4', default=False)
-        grp.add_option('--with-qt5', help='''Build QT5 app, instead of native one''',
-                       action='store_true', dest='with_qt5', default=False)
+    # grp = opt.add_option_group('NFD Control Center options')
 
 def configure(conf):
-    conf.load('compiler_c compiler_cxx default-compiler-flags boost')
-
-    conf.start_msg('Checking for NFD tools in %s' % conf.options.with_nfd)
-    if not conf.find_file(['nfd-start', 'nfd-stop'],
-                          path_list='%s/bin' % conf.options.with_nfd, mandatory=False):
-        conf.fatal('not found', 'RED')
-    else:
-        conf.end_msg('ok')
+    conf.load('compiler_c compiler_cxx qt5 default-compiler-flags boost')
 
     conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
                    uselib_store='NDN_CXX', mandatory=True)
 
-    conf.define('NFD_ROOT', conf.options.with_nfd)
-    conf.define('NFD_START_COMMAND', '%s/bin/nfd-start' % conf.options.with_nfd)
-    conf.define('NFD_STOP_COMMAND', '%s/bin/nfd-stop' % conf.options.with_nfd)
-    conf.define('NFD_AUTOCONFIG_COMMAND', '%s/bin/ndn-autoconfig' % conf.options.with_nfd)
-
     conf.check_boost(lib="system thread")
 
-    if not conf.options.with_qt4 and not conf.options.with_qt5 and Utils.unversioned_sys_platform() == "darwin":
-        conf.env.BUILD_OSX_NATIVE = 1
-        conf.recurse('osx')
-    else:
-        if conf.options.with_qt5:
-            conf.env.BUILD_QT5 = 1
-            conf.recurse('qt5')
-        else:
-            conf.env.BUILD_QT4 = 1
-            conf.recurse('qt4')
+    # conf.define('RESOURCES_DIR', Utils.subst_vars("${DATAROOTDIR}/nfd-control-center", conf.env))
+
+    if Utils.unversioned_sys_platform() == "darwin":
+        conf.define('OSX_BUILD', 1)
 
     conf.write_config_header('config.hpp')
 
 def build(bld):
-    if bld.env.BUILD_OSX_NATIVE:
-        bld.recurse('osx')
+    app = bld(
+        features=['qt5', 'cxxprogram', 'cxx'],
+        includes = ". src",
+
+        use = "NDN_CXX BOOST QT5CORE QT5DBUS QT5QML QT5WIDGETS",
+
+        defines = "WAF",
+        source = bld.path.ant_glob(['src/*.cpp', 'src/**/*.qrc', 'src/**/*.ui', 'src/**/*.qrc']),
+        )
+
+    if Utils.unversioned_sys_platform() != "darwin":
+        app.target = "nfd-control-center",
+
+        bld(features = "subst",
+             source = 'src/nfd-control-center.desktop.in',
+             target = 'src/nfd-control-center.desktop',
+             BINARY = "nfd-control-center",
+             install_path = "${DATAROOTDIR}/nfd-control-center"
+            )
+
+        bld.install_files("${DATAROOTDIR}/nfd-control-center",
+                      bld.path.ant_glob(['Resources/*']))
     else:
-        if bld.env.BUILD_QT5:
-            bld.recurse('qt5')
-        else:
-            bld.recurse('qt4')
+        app.target = "NFD Control Center"
+        app.mac_app = True
+        # app.mac_plist = 'src/Info.plist'
+        # app.mac_resources = [i.path_from(bld.path)
+        #                      for i in bld.path.parent.ant_glob('src/Resources/*')]