Update Snapshot(2018-12-12)
[platform/upstream/iotivity.git] / arduino.scons
index 4ab2aff..4329775 100644 (file)
@@ -1,11 +1,52 @@
+#******************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
 ##
 # This script includes arduino specific config for oic-resource
 ##
 Import('env')
 
-env.ImportLib('Time')
-if env.get('NET') == 'Ethernet':
+# Add 'SHIELD' build option, let user select board network connection type
+vars = Variables()
+if 'IP' in env.get('TARGET_TRANSPORT'):
+       vars.Add(EnumVariable('SHIELD', 'Network connection type', 'WIFI', ['ETH', 'WIFI']))
+elif 'BLE' in env.get('TARGET_TRANSPORT'):
+       vars.Add(EnumVariable('SHIELD', 'Network connection type', 'RBL_NRF8001', ['RBL_NRF8001']))
+vars.Update(env)
+Help(vars.GenerateHelpText(env))
+
+env.ImportLib('SPI')
+if 'ETH' in env.get('SHIELD'):
        env.ImportLib('Ethernet')
-else:
+       env.AppendUnique(CPPDEFINES = ['ARDUINOETH'])
+if 'WIFI' in env.get('SHIELD'):
        env.ImportLib('WiFi')
-env.ImportLib('SPI')
\ No newline at end of file
+       env.AppendUnique(CPPDEFINES = ['ARDUINOWIFI'])
+if 'RBL_NRF8001' in env.get('SHIELD'):
+       env.ImportLib('BLE')
+       env.ImportLib('RBL_nRF8001')
+
+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'])