Add auto download cereal library support
authorCaiwen Zhang <caiwen.zhang@intel.com>
Thu, 12 Feb 2015 05:30:43 +0000 (13:30 +0800)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Thu, 12 Feb 2015 18:53:39 +0000 (18:53 +0000)
Change-Id: Iab0fe5ca9c64849d215dfcf1ec99a4f834cb26f8
Signed-off-by: Caiwen Zhang<caiwen.zhang@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/328
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sashi Penta <sashi.kumar.penta@intel.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
extlibs/cereal/SConscript

index 7f3e1f8..6945131 100644 (file)
@@ -18,16 +18,24 @@ cur = src_dir + '/extlibs/cereal/cereal/include'
 
 # check 'cereal' library, if it doesn't exits, ask user to download it
 if not os.path.exists(old) and not os.path.exists(cur):
-       print '''
+       cereal_env = Environment(ENV = os.environ)
+       c = cereal_env.Action(['git clone https://github.com/USCiLab/cereal.git cereal',
+               'cd cereal && git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245 && git apply ../../../resource/patches/cereal_gcc46.patch',
+               ])
+
+       print 'Downloading cereal library ...'
+       if cereal_env.Execute(c):
+               print '''
 *********************************** Error: ************************************
-*  'Cereal' library doesn't exist. please download cereal to extlibs directory*
-* add apply the patch as following:                                           *
+* Please download cereal and apply the patch as following:                    *
 *     $ git clone https://github.com/USCiLab/cereal.git extlibs/cereal/cereal *
 *     $ cd  extlibs/cereal/cereal                                             *
 *     $ git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245             *
 *     $ git apply ../../../resource/patches/cereal_gcc46.patch                *
 *******************************************************************************
 '''
-       Exit(1)
-else:
-       env.AppendUnique(CPPPATH = [old, cur])
+               Exit(1)
+       else:
+               print 'Download cereal library complete'
+
+env.AppendUnique(CPPPATH = [old, cur])