Adding configuration option (--ndnx=PATH) to specify which ndnx should be used during runtime
Change-Id: I353655cff033e849cf299159794e62d2613569d7
diff --git a/osx/menu-delegate.mm b/osx/menu-delegate.mm
index cdb02e7..8660108 100644
--- a/osx/menu-delegate.mm
+++ b/osx/menu-delegate.mm
@@ -6,11 +6,12 @@
* @author Ilya Moiseenko <iliamo@ucla.edu>
*/
+#include "config.h"
#import "menu-delegate.h"
-#define NDND_START_COMMAND @"/opt/local/bin/ndndstart"
-#define NDND_STOP_COMMAND @"/opt/local/bin/ndndstop"
-#define NDND_STATUS_COMMAND @"/opt/local/bin/ndndstatus"
+#define NDND_START_COMMAND @ NDNX_ROOT "/bin/ndndstart"
+#define NDND_STOP_COMMAND @ NDNX_ROOT "/bin/ndndstop"
+#define NDND_STATUS_COMMAND @ NDNX_ROOT "/bin/ndndstatus"
@implementation MenuDelegate
diff --git a/wscript b/wscript
index 6bbd913..b1c3f8d 100644
--- a/wscript
+++ b/wscript
@@ -8,6 +8,10 @@
opt.load('compiler_c compiler_cxx')
opt.load('sparkle xcode', tooldir='waf-tools')
+ grp = opt.add_option_group ('NDNx Control Center options')
+ grp.add_option ('--ndnx', help='''Root path to NDNx installation (default: /usr)''',
+ dest='ndnx_root', type=str, default='/usr')
+
def configure(conf):
conf.load('compiler_c compiler_cxx')
@@ -15,6 +19,13 @@
Logs.error ("Only OSX is supported so far")
return -1
+ conf.start_msg('Checking for NDNx in %s' % conf.options.ndnx_root)
+ if not conf.find_file('ndnd ndndstatus ndndstart ndndstop', path_list='%s/bin' % conf.options.ndnx_root, mandatory=False):
+ conf.end_msg ('not found, but will proceed anyways', 'YELLOW')
+ else:
+ conf.end_msg ('ok')
+ conf.define('NDNX_ROOT', conf.options.ndnx_root)
+
if Utils.unversioned_sys_platform () == "darwin":
conf.find_program('ibtool', var='IBTOOL', mandatory=False)
@@ -30,6 +41,8 @@
conf.load('sparkle')
+ conf.write_config_header('config.h')
+
def build (bld):
if Utils.unversioned_sys_platform () != "darwin":
Logs.error ("Only OSX is supported so far")
@@ -39,7 +52,7 @@
bld (
target = "NDNx Control Center",
features=['cxxprogram', 'cxx'],
- includes = "osx",
+ includes = ". osx",
source = bld.path.ant_glob (['osx/**/*.mm', 'osx/MainMenu.xib']),
mac_app = True,