1 == How to build IoTivity projects ==
3 IoTivity includes a series of projects. You can find all these projects here:
4 https://gerrit.iotivity.org/gerrit/#/admin/projects/
6 You can build IoTivity project on Linux / Windows / MAC OSX for various OS(
7 Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...).
8 The output of the build is in:
9 <top directory of the project>/out/<target_os>/<target_arch>/<build_type>/
11 oic-resource/out/android/armeabi-v7a/release/.
13 This document takes 'iotivity' project as example, the way to build other
14 projects is almost the same.
16 === IoTivity project build tool scons ===
18 Scons is a cross-platform build tool, its usage is quite similar to GNU make.
19 To build a project, you just require to run following command at the directory
20 where a SConstruct file exists(SConstruct is the entrance of scons build, it's
21 equivalent to Makefile of 'make') :
22 $ scons [options] [target]
24 In additional, usually the scons build script of a project provides useful help
25 information(include build options). To see the help information:
28 Note: If no value is specified for an option, the default value will be used.
29 The change of options value may impact the output.
36 Please refer to the following page to install scons:
37 http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
38 (Note: on Windows, install Python 2.x before installing scons)
40 * 2. IDE/SDK Prerequites
41 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
42 please go to the relative page to download and install the required IDE/SDK.
45 To build for Android, Andorid NDK and SDK are required.
46 Android NDK: http://developer.android.com/tools/sdk/ndk/index.html
47 Android SDK: http://developer.android.com/sdk/index.html
48 (Note: as in some IoTivity projects, C++11 features are used, recommend Android
49 NDK >= r10, according to our test result r10c is the best one currently)
52 To build for Arduino, Arduino IDE is required.
53 Arduino IDE: http://arduino.cc/en/Main/Software
54 (Note: recommend install Arduino IDE >=1.5.7)
56 Arduino builds are dependent on latest Time library. Download it from here:
57 http://www.pjrc.com/teensy/td_libs_Time.html
58 and extract to <arduino_ide_root>/libraries/
60 (Note: If you are using Arduino IDE 1.5.8 BETA on Windows, it may pop up some
61 dll isn't found. please copy relative dll from the IDE directory to
62 C:\Windows\SysWOW64. IDE 1.5.7 doesn't have this issue. Other version IDE isn't
66 To build for Mac OSX or IOS, Xcode is required.
67 Xcode: https://developer.apple.com/xcode/downloads/
70 To build the Java code, JDK is required.
71 JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
72 (If the project doesn't include Java code or you wouldn't like build the
73 Java codes, this isn't required)
75 (Note: for convenience, suggest add the IDE/SDK path in environment variable,
76 so you don't need to add it in command line each time. The build script will
77 guide you to do that.)
79 * 3. External libraries
80 For Android and IOS build, most of the external libraries are provided as
81 binary in oic-utilities project (https://oic-review.01.org/gerrit/oic-utilities).
82 Please download it in the same directory as other IoTivity projects. If it's
83 in different directory, an additional option (OIC_UITLS) will be required. The
84 build command should be:
85 $ scons OIC_UITLS=<path to oic-utilities> [other options] [target]
87 (Note: for convenience, you can also add it in environment variable. So you
88 don't need to add this option in command line each time.)
90 $ export OIC_UITLS=<path to oic-utilities project>
93 === Build IoTivity project on Linux(Ubuntu) ===
95 Generally, it's required to specify the target OS and target ARCH, that's to say
96 tell Scons which OS and which ARCH you'd like build this project for. By default,
97 the target OS and ARCH is the same as the host.
99 Some more options may be required, please care the 'error' notification when build.
100 For help about how to set an option, please run:
101 $ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h
103 1. Build IoTivity project for Linux
104 $ cd <top directory of the project>
105 $ sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev
108 2. Build IoTivity project for Android
109 $ cd <top directory of the project>
110 $ scons TARGET_OS=android TARGET_ARCH=xxx
111 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard. To see all of its
112 allowed value, please execute command 'scons TARGET_OS=android -Q -h')
114 Note: Currently as x86_64/arm64_v8a external library binaries aren't provided,
115 you may meet link problem if build executable binary which depends on external
116 library for x86_64/arm64_v8a.
118 3. Build IoTivity project for Arduino
119 $ cd <top directory of the project>
120 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy
121 (xxx can be avr, arm; yyy is the name of the board, to get its allowed value
122 run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option 'CPU' in
123 the output of above command line, that's due to some boards have different
124 processors, to specify the processor, add 'CPU=zzz' in the command line. If no
125 'CPU' option exists, that means the board only support one kind of processor,
126 it's unnecessary to specify it)
129 === Build IoTivity project on Windows ===
131 1. Build IoTivity project for Android(It's the same as on Ubuntu)
132 $ cd <top directory of the project>
133 $ scons TARGET_OS=android TARGET_ARCH=xxx
134 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard ...)
136 2. Build IoTivity project for Arduino(It's the same as on Ubuntu)
137 $ cd <top directory of the project>
138 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy
139 (xxx can be avr, arm; yyy is the name of the board, to get its allowed value
140 run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option 'CPU' in
141 the output of above command line, that's due to some boards have different
142 processor, to specify the processor, add 'CPU=zzz' in the command line. If no
143 'CPU' option exists, that means the board only support one kind of processor,
144 it's unnecessary to specify it)
147 Note: Currently most IoTivity project doesn't support Windows, so you can't set
148 TARGET_OS to 'windows' except the project support Windows.
150 That's to say if the project doesn't support Windows, run:
151 $ scons TARGET_OS=windows ....
157 === Build IoTivity project on Mac OSX ===
159 1. Build IoTivity project for Mac OSX
160 $ cd <top directory of the project>
161 $ scons SYS_VERSION=yyy
162 (yyy is the OSX version, e.g. 10.9)
164 2. Build IoTivity project for Android(It's the same as on Ubuntu)
165 $ cd <top directory of the project>
166 $ scons TARGET_OS=android TARGET_ARCH=xxx
167 (xxx can be x86, armeabi, armeabi-v7a, armeabi-v7a-hard)
169 3. Build IoTivity project for IOS
170 $ cd <top directory of the project>
171 $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy
172 (xxx can be i386, x86_64, armv7, armv7s, arm64, yyy is IOS version, e.g. 7.0)
175 1) for convenience, a script (auto_build.sh) is provided to run possible build
176 at once. Following is the usage:
179 $ auto_build.sh <path-to-android-ndk> <path-to-arduino-home>
183 2) For Arduino build, the Time library should >=1.3. The old can only be built
184 with Arduino IDE 1.0.x