env.ImportLib('Time/Time')
# we have variety of macros for arduino!!
env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO', '__ARDUINO__'])
+# Set device name to __OIC_DEVICE_NAME__
+env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + env.get('DEVICE_NAME') + "\"\'"])
if env.get('LOGGING'):
env.AppendUnique(CPPDEFINES = ['TB_LOG'])
# set to 'no', 'false' or 0 for only compilation
require_upload = ARGUMENTS.get('UPLOAD', False)
+# Get the device name. This name can be used as network display name wherever possible
+device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE")
+
if ARGUMENTS.get('TEST'):
logging_default = False
else:
help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default))
help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
+help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Arduino)', device_name, None, None),)
+
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
######################################################################
matches = []
for root, dirnames, filenames in os.walk(path):
- matches.extend(Glob(root + '/' + pattern, ondisk, source, strings))
-
+ # This is a helper function to build Arduino libraries. Scripts are using this function
+ # to add all the files in a folder as compilation targets rather than specifying each
+ # file to compile from a Arduino library folder.
+
+ # Since the function is recursive, it adds even "/library/<library-name>/examples" to the
+ # compilation list. This is an extra overhead as stack is never going to use ".o" generated
+ # for these examples.
+ if 'examples' not in root:
+ matches.extend(Glob(root + '/' + pattern, ondisk, source, strings))
return matches
# To make sure the src is built in 'BUILD_DIR' (by default it will be built at
CADestroyRemoteEndpoint(endpoint);
}
- CADestroyToken(token);
Serial.println("============");
}