=== Prerequisites ===

* 1. Scons

Please refer to the following page to install scons:
   http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
(Note: on Windows, install Python 2.x before installing scons)

* 2. IDE/SDK Pre-requites
To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
please go to the relative page to download and install the required IDE/SDK.

Note: Connectivity module building has been changed. We have to build connectivity
      from the iotivity root folder.

Linux Build:

1) Go to "iotivity/" folder.

2) Execute following command(s) to start build based on transport selection required :

    -> Building for all transports :
    $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=ALL

    -> Building for a specific transport :
    $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP

    -> Building for multiple transports :
    $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP,BT

    -> Clean Build (all transports) :
    scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=ALL -c (for clean)


3) The above command will build sample also.

    For Enabling Secured server,
    * Note: tinydtls library has to copied to "connectivity/lib/tinydtls" for secured build.

    Secured Server will be only used for IP transports.

    Give command "scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP SECURED=1

Android Build:

1) Go to "iotivity/" folder.

2) Execute following command(s) to start build based on transport selection required :

    -> Building for all transports :
    $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=ALL TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path

    -> Building for a specific transport :
    $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=IP TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path

    -> Building for multiple transports :
    $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=IP,BT TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path

Note :- Upon successful execution of above command(s) CA library will be generated at path
        "iotivity/out/android/TARGET_ARCH/release or debug".

Tizen Build:

1) If you are building first time, then delete GBS-ROOT folder from home directory.
   Note: Default build server URL for Tizen is set in gbs configuration file @ iotivity/tools/tizen/.gbs.conf.
         If need be, same can be modified as per appropriate target.

2) Go to "iotivity/" folder.

3) Execute following command(s) to start build based on transport selection required :

    -> Building for all transports :
    $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=ALL

    -> Building for a specific transport :
    $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP

    -> Building for multiple transports :
    $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP,BT,BLE

4) By default, above command will build sample also.
   To disable building sample, add BUILD_SAMPLE=OFF to the build command.
   Ex: scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=ALL BUILD_SAMPLE=OFF
   Making this flag ON builds the sample.

Note :- Upon successful execution of above command(s) CA library and sample applications will be
        generated at path "~/GBS-ROOT/local/repos/redwood/armv7l/RPMS".

Arduino Build:

Note :- Currently Mega & Due build is supported.

1) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.

2) Go to "iotivity/" folder.

3) Execute following command to start build :

For Arduino Mega
    $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
For Arduino Due
    $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=arm BOARD=arduino_due_x_dbg ARDUINO_HOME=<path_to_arduino_installation>
    NOTE: BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.

    Possible values for <transport> are:
    -> IP :
    $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=IP TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
    -> BLE :
    $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=BLE TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>

    Note :- Only single transport can be built at a time for Arduino.

4) The above command will build sample also. The "CASample.hex" can be found at "/samples/arduino/"

5) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
   To skip installation, set command line argument 'UPLOAD=false'.
   "scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> UPLOAD=false"

6) To set BLE Shield Name, include the option DEVICE_NAME during scons build.

   -> $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> DEVICE_NAME=OIC

   Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
   By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified

   To change the port number, please modify  "port" variable in __upload() function in: "/build/arduino/SConscript".

