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)
7 Install external libraries:
8 $ sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev libboost-thread-dev
10 Build release binaries:
12 (Note: C++ sdk requires cereal. Please follow the instruction in the build
13 message to install cereal)
25 $ export LD_LIBRARY_PATH=<iotivity>/out/linux/x86_64/release
26 Run the c++ samples in <iotivity>/out/linux/x86_64/release/resource/examples
27 Run the c samples in <iotivity>/out/linux/x86_64/release/resource/csdk/stack/samples/linux/SimpleClientServer
28 ('<iotivity>' is the path to 'iotivity' project. If your device is x86, arm,
29 or arm64, please change 'x86_64' to the proper arch)
31 == How to build IoTivity projects ==
33 IoTivity includes a series of projects. You can find all these projects here:
34 https://gerrit.iotivity.org/gerrit/#/admin/projects/
36 You can build IoTivity project on Linux / Windows / MAC OSX for various OS(
37 Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...).
38 The output of the build is in:
39 <top directory of the project>/out/<target_os>/<target_arch>/<build_type>/
41 iotivity/out/android/armeabi-v7a/release/.
43 This document takes 'iotivity' project as example, the way to build other
44 projects is almost the same.
46 === IoTivity project build tool scons ===
48 Scons is a cross-platform build tool, its usage is quite similar to GNU make.
49 To build a project, you just require to run following command at the directory
50 where a SConstruct file exists(SConstruct is the entrance of scons build, it's
51 equivalent to Makefile of 'make') :
52 $ scons [options] [target]
54 In additional, usually the scons build script of a project provides useful help
55 information(include build options). To see the help information:
58 Note: If no value is specified for an option, the default value will be used.
59 The change of options value may impact the help information and the behavior
62 Generally, it's required to specify the target OS and target ARCH, that's to say
63 tell Scons which OS and which ARCH you'd like build this project for. By default,
64 the target OS and ARCH is the same as the host.
66 Some more options may be required, please care the 'error' notification when build.
67 For help about how to set an option, please run:
68 $ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h
75 Please refer to the following page to install scons:
76 http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
77 (Note: on Windows, install Python 2.x before installing scons)
79 * 2. IDE/SDK Prerequites
80 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
81 please go to the relative page to download and install the required IDE/SDK.
84 To build for Android, Andorid NDK and SDK are required.
85 Android NDK: http://developer.android.com/tools/sdk/ndk/index.html
86 Android SDK: http://developer.android.com/sdk/index.html
87 (Note: as in some IoTivity projects, C++11 features are used, recommend Android
91 To build for Arduino, Arduino IDE is required.
92 Arduino IDE: http://arduino.cc/en/Main/Software
93 (Note: recommend install Arduino IDE >=1.5.7)
95 Arduino builds are dependent on latest Time library. Download it from here:
96 http://www.pjrc.com/teensy/td_libs_Time.html
97 and extract to <arduino_ide_root>/libraries/
99 (Note: If you are using Arduino IDE 1.5.8 BETA on Windows, it may pop up some
100 dll isn't found. please copy relative dll from the IDE directory to
101 C:\Windows\SysWOW64. IDE 1.5.7 doesn't have this issue. Other version IDE isn't
105 To build for Mac OSX or IOS, Xcode is required.
106 Xcode: https://developer.apple.com/xcode/downloads/
109 To build the Java code, JDK is required.
110 JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
111 (If the project doesn't include Java code or you wouldn't like build the
112 Java codes, this isn't required)
114 (Note: for convenience, suggest add the IDE/SDK path in environment variable,
115 so you don't need to add it in command line each time. The build script will
116 guide you to do that.)
118 * 3. External libraries
119 IoTivity project depends on some external libraries, such as boost, expat ...
120 During building, the existence of external library will be checked, if it doesn't
121 exist, the build script will try to download, unpack and build the library or
122 notify user to install it.
124 Downloading and unpacking may fail due to network problem or required unpacking
125 tool isn't installed. An message will be displayed, please follow the message
129 === Build IoTivity project on Linux(Ubuntu) ===
131 1. Build IoTivity project for Linux
132 $ cd <top directory of the project>
133 $ sudo apt-get install libboost-dev libexpat1-dev libboost-thread-dev
136 2. Build IoTivity project for Android
137 $ cd <top directory of the project>
138 $ scons TARGET_OS=android TARGET_ARCH=xxx
139 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard. To see all of its
140 allowed value, please execute command 'scons TARGET_OS=android -Q -h')
142 3. Build IoTivity project for Arduino
143 $ cd <top directory of the project>
144 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy
145 (xxx can be avr, arm; yyy is the name of the board, to get its allowed value
146 run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option 'CPU' in
147 the output of above command line, that's due to some boards have different
148 processors, to specify the processor, add 'CPU=zzz' in the command line. If no
149 'CPU' option exists, that means the board only support one kind of processor,
150 it's unnecessary to specify it)
152 4. Build Iotivity project for Tizen
153 $ cd <top directory of the project>
154 $ gbs build -A xxx --packaging-dir tools/tizen/
155 (xxx can be i586 or armv7l, we provide the spec file required by gbs tool at
156 toools/tizen directory. gbs is default build tool for Tizen platfrom, we can
157 refer the following wiki to setup Tizen development environment:
158 https://source.tizen.org/documentation/developer-guide/getting-started-guide)
160 === Build IoTivity project on Android ===
162 1. Build IoTivity project for Android(It's the same as on Ubuntu)
163 $ cd <top directory of the project>
164 $ scons TARGET_OS=android TARGET_ARCH=xxx
165 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard ...)
167 2. Build IoTivity project for Arduino(It's the same as on Ubuntu)
168 $ cd <top directory of the project>
169 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy
170 (xxx can be avr, arm; yyy is the name of the board, to get its allowed value
171 run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option 'CPU' in
172 the output of above command line, that's due to some boards have different
173 processor, to specify the processor, add 'CPU=zzz' in the command line. If no
174 'CPU' option exists, that means the board only support one kind of processor,
175 it's unnecessary to specify it)
178 Note: Currently most IoTivity project doesn't support Windows, so you can't set
179 TARGET_OS to 'windows' except the project support Windows.
181 That's to say if the project doesn't support Windows, run:
182 $ scons TARGET_OS=windows ....
188 === Build IoTivity project on Mac OSX ===
190 1. Build IoTivity project for Mac OSX
191 $ cd <top directory of the project>
192 $ scons SYS_VERSION=yyy
193 (yyy is the OSX version, e.g. 10.9)
195 2. Build IoTivity project for Android(It's the same as on Ubuntu)
196 $ cd <top directory of the project>
197 $ scons TARGET_OS=android TARGET_ARCH=xxx
198 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard)
200 3. Build IoTivity project for IOS
201 $ cd <top directory of the project>
202 $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy
203 (xxx can be i386, x86_64, armv7, armv7s, arm64, yyy is IOS version, e.g. 7.0)
206 1) for convenience, a script (auto_build.sh) is provided to run possible build
207 at once. Following is the usage:
210 $ auto_build.sh <path-to-android-ndk>
214 2) For Arduino build, the Time library should >=1.3. The old can only be built
215 with Arduino IDE 1.0.x