1 == Quick guide: build and run IoTivity projects on Ubuntu ==
4 Go to the top directory of 'iotivity' project(Note: should always run 'scons'
5 command in this directory)
8 $ sudo apt-get install git-core scons ssh build-essential g++ doxygen valgrind
10 Install external libraries:
11 $ sudo apt-get install libboost-dev libboost-program-options-dev libboost-thread-dev uuid-dev libssl-dev libtool libglib2.0-dev
13 Build release binaries:
15 (Note: C sdk requires tinycbor. Please follow the instruction in the build
16 message to install tinycbor)
28 $ export LD_LIBRARY_PATH=<iotivity>/out/linux/x86_64/release
29 Run the c++ samples in <iotivity>/out/linux/x86_64/release/resource/examples
30 Run the c samples in <iotivity>/out/linux/x86_64/release/resource/csdk/stack/samples/linux/SimpleClientServer
31 ('<iotivity>' is the path to 'iotivity' project. If your device is x86, arm,
32 or arm64, please change 'x86_64' to the proper arch)
34 == How to build IoTivity projects ==
36 IoTivity includes a series of projects. You can find all these projects here:
37 https://gerrit.iotivity.org/gerrit/#/admin/projects/
39 You can build IoTivity project on Linux / Windows / MAC OSX for various OS(
40 Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...).
41 The output of the build is in:
42 <top directory of the project>/out/<target_os>/<target_arch>/<build_type>/
44 iotivity/out/android/armeabi-v7a/release/.
46 This document takes 'iotivity' project as example, the way to build other
47 projects is almost the same.
49 === IoTivity project build tool scons ===
51 Scons is a cross-platform build tool, its usage is quite similar to GNU make.
52 To build a project, you just require to run following command at the directory
53 where a SConstruct file exists(SConstruct is the entrance of scons build, it's
54 equivalent to Makefile of 'make') :
55 $ scons [options] [target]
57 In additional, usually the scons build script of a project provides useful help
58 information(include build options). To see the help information:
61 Note: If no value is specified for an option, the default value will be used.
62 The change of options value may impact the help information and the behavior
65 Generally, it's required to specify the target OS and target ARCH, that's to say
66 tell Scons which OS and which ARCH you'd like build this project for. By default,
67 the target OS and ARCH is the same as the host.
69 Some more options may be required, please care the 'error' notification when build.
70 For help about how to set an option, please run:
71 $ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h
78 Please refer to the following page to install scons:
79 http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
80 (Note: on Windows, install Python 2.x before installing scons)
82 * 2. IDE/SDK Prerequites
83 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
84 please go to the relative page to download and install the required IDE/SDK.
87 To build for Android, Andorid NDK and SDK are required.
88 Android NDK: http://developer.android.com/tools/sdk/ndk/index.html
89 Android SDK: http://developer.android.com/sdk/index.html
90 (Note: as in some IoTivity projects, C++11 features are used, recommend Android
94 To build for Arduino, Arduino IDE is required.
95 Arduino IDE: http://arduino.cc/en/Main/Software
96 (Note: recommend install Arduino IDE >=1.5.8)
98 Arduino builds are dependent on latest Time library. Download it from here:
99 http://www.pjrc.com/teensy/td_libs_Time.html
100 and extract to <arduino_ide_root>/libraries/
102 (Note: If you are using Arduino IDE 1.5.8 BETA on Windows, it may pop up some
103 dll isn't found. please copy relative dll from the IDE directory to
104 C:\Windows\SysWOW64. IDE 1.5.7 doesn't have this issue. Other version IDE isn't
108 To build for Mac OSX or IOS, Xcode is required.
109 Xcode: https://developer.apple.com/xcode/downloads/
112 To build the Java code, JDK is required.
113 JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
114 (If the project doesn't include Java code or you wouldn't like build the
115 Java codes, this isn't required)
117 (Note: for convenience, suggest add the IDE/SDK path in environment variable,
118 so you don't need to add it in command line each time. The build script will
119 guide you to do that.)
122 To build for tizen platform tinycbor library is needed.
123 Please download tinycbor if it is not present in extlibs/tinycbor folder
124 by doing the following:
125 $ git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor
128 * 3. External libraries
129 IoTivity project depends on some external libraries, such as boost ...
130 During building, the existence of external library will be checked, if it doesn't
131 exist, the build script will try to download, unpack and build the library or
132 notify user to install it.
134 Downloading and unpacking may fail due to network problem or required unpacking
135 tool isn't installed. An message will be displayed, please follow the message
139 === Build IoTivity project ===
142 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BLE
144 1. Go to root directory
145 $ cd <top directory of the project>
146 $ sudo apt-get install libboost-dev libboost-thread-dev libssl-dev libtool
148 2. Execute following command(s) to start build based on transport selection required
150 -> Building for all transports :
151 $ scons TARGET_OS=linux TARGET_TRANSPORT=ALL
153 -> Building for a specific transport :
154 $ scons TARGET_OS=linux TARGET_TRANSPORT=IP
156 -> Building for multiple transports :
157 $ scons TARGET_OS=linux TARGET_TRANSPORT=IP,BLE TARGET_ARCH=xxx
159 -> Clean Build (all transports) :
160 $ scons TARGET_OS=linux TARGET_TRANSPORT=ALL -c (for clean)
163 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BT, BLE
164 * Possible values for <TARGET_ARCH> are: x86, armeabi, armeabi-v7a, armeabi-v7a-hard
165 (To see all of its allowed value, please execute command 'scons TARGET_OS=android -Q -h')
167 1. Go to root directory
168 $ cd <top directory of the project>
170 2. Execute following command(s) to start build based on transport selection required
172 -> Building for all transports :
173 $ scons TARGET_OS=android TARGET_TRANSPORT=ALL TARGET_ARCH=xxx
175 -> Building for a specific transport :
176 $ scons TARGET_OS=android TARGET_TRANSPORT=IP TARGET_ARCH=xxx
178 -> Building for multiple transports :
179 $ scons TARGET_OS=android TARGET_TRANSPORT=IP,BT,BLE TARGET_ARCH=xxx
181 -> Clean Build (all transports) :
182 $ scons TARGET_OS=android TARGET_TRANSPORT=ALL -c (for clean)
185 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BT, BLE
187 1. Go to root directory
188 $ cd <top directory of the project>
190 2. Execute following command(s) to start build based on transport selection required
192 -> Building for all transports :
193 $ scons TARGET_OS=tizen TARGET_TRANSPORT=ALL
195 -> Building for a specific transport :
196 $ scons TARGET_OS=tizen TARGET_TRANSPORT=IP
198 -> Building for multiple transports :
199 $ scons TARGET_OS=tizen TARGET_TRANSPORT=IP,BT,BLE TARGET_ARCH=xxx
201 -> Clean Build (all transports) :
202 $ scons TARGET_OS=tizen TARGET_TRANSPORT=ALL -c (for clean)
204 (we provide the spec file required by gbs tool at toools/tizen directory.
205 gbs is default build tool for Tizen platform, we can refer the following
206 wiki to setup Tizen development environment:
207 https://source.tizen.org/documentation/developer-guide/getting-started-guide)
210 * Possible values for <TARGET_TRANSPORT> are: IP, BLE
211 * Possible values for <TARGET_ARCH> are: arv, arm
212 (arv: arduino due, arm: arduino mega)
213 * Possible values for <BOARD> are: arduino_due_x_dbg, arduino_due_x, mega
214 * Possible values for <SHIELD> are: ETH, WIFI
215 (It is required in the case of the arduino due.)
217 1. Go to root directory
218 $ cd <top directory of the project>
219 $ sudo apt-get install dos2unix
221 2. Execute following command(s) to start build based on transport selection required
223 -> Building for a specific transport :
224 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy SHIELD=zzz
226 (To get allowed values run: scons TARGET_OS=arduino TARGET_ARCH=xxx SHIELD=zzz -h.
227 You may see a option 'CPU' in the output of above command line, that's due to
228 some boards have different processors, to specify the processor, add 'CPU=zzz'
229 in the command line. If no 'CPU' option exists, that means the board only
230 support one kind of processor, it's unnecessary to specify it)
233 * Possible values for <SYS_VERSION> are: OSX version, e.g. 10.9
235 1. Go to root directory
236 $ cd <top directory of the project>
238 2. Execute following command(s) to start build based on transport selection required
240 -> Building for a specific transport :
241 $ scons SYS_VERSION=yyy
244 * Possible values for <TARGET_ARCH> are: i386, x86_64, armv7, armv7s, arm64
245 * Possible values for <SYS_VERSION> are: IOS version, e.g. 7.0
247 1. Go to root directory
248 $ cd <top directory of the project>
250 2. Execute following command(s) to start build based on transport selection required
252 -> Building for a specific transport :
253 $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy
256 * VERBOSE=true or false (Show compilation)
257 * RELEASE=true or false (Build for release?)
258 * LOGGING=true or false (Enable stack logging)
259 * SECURED=1 or 0 (Build with DTLS)
260 * TEST=1 or 0 (Run unit tests)
261 * SECURED=1 or 0 (Build with DTLS)
262 * BUILD_SAMPLE=ON or OFF (Build with sample)
263 * ROUTING=GW or EP (Enable routing)
264 * WITH_TCP=true or false (Enable CoAP over TCP Transport, arduino is not supported)
265 * WITH_RA=true or false (Build with Remote Access module)
266 * WITH_RD=1 or 0 (Build including Resource Directory)
267 * SIMULATOR=true or false (Build with simulator module)
269 Note1: Currently most IoTivity project doesn't support Windows, so you can't set
270 TARGET_OS to 'windows' except the project support Windows.
272 That's to say if the project doesn't support Windows, run:
273 $ scons TARGET_OS=windows ....
279 1) for convenience, a script (auto_build.sh) is provided to run possible build
280 at once. Following is the usage:
283 $ auto_build.sh <path-to-android-ndk>