Merge branch 'master' into easysetup and fixed OCStack issue
[platform/upstream/iotivity.git] / extlibs / cereal / SConscript
1 ######################################################################
2 # Cereal library build script
3 #
4 # Only 'hpp' is used by Iotivity, it's unnecessary to build it
5 ######################################################################
6 import os
7
8 Import('env')
9
10 src_dir = env.get('SRC_DIR')
11
12 # In the pass, cereal library is in extlibs/cereal, according to external
13 # library management rule, cereal should be put in extlibs/cereal/cereal.
14 # jenkins of gerrit server, still follow the old, to avoid jenkins fail
15 # both places are handled.
16 old = os.path.join(src_dir, 'extlibs', 'cereal', 'include')
17 cur = os.path.join(src_dir, 'extlibs', 'cereal', 'cereal', 'include')
18
19 # check 'cereal' library, if it doesn't exits, ask user to download it
20 if not os.path.exists(old) and not os.path.exists(cur):
21         cereal_env = Environment(ENV = os.environ)
22         c = cereal_env.Action(['git clone https://github.com/USCiLab/cereal.git cereal',
23                 'cd cereal && git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245 && git apply ../../../resource/patches/cereal_gcc46.patch',
24                 ])
25
26         print 'Downloading cereal library ...'
27         if cereal_env.Execute(c):
28                 print '''
29 *********************************** Error: ************************************
30 * Please download cereal and apply the patch as following:                    *
31 *     $ git clone https://github.com/USCiLab/cereal.git extlibs/cereal/cereal *
32 *     $ cd  extlibs/cereal/cereal                                             *
33 *     $ git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245             *
34 *     $ git apply ../../../resource/patches/cereal_gcc46.patch                *
35 *******************************************************************************
36 '''
37                 Exit(1)
38         else:
39                 print 'Download cereal library complete'
40
41 env.AppendUnique(CPPPATH = [old, cur])