Download boost automatically on Windows 21/8821/5
authorDavid Antler <david.a.antler@intel.com>
Tue, 21 Jun 2016 18:52:52 +0000 (11:52 -0700)
committerDavid Antler <david.a.antler@intel.com>
Thu, 30 Jun 2016 19:55:04 +0000 (19:55 +0000)
Change-Id: I5782b99f3a84898e5da71de94f19f9b9c7eabb0a
Signed-off-by: David Antler <david.a.antler@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8821
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
extlibs/boost/SConscript
resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
resource/third_party_libs.scons
service/third_party_libs.scons

index d32b8b5..76fb4ec 100644 (file)
@@ -21,7 +21,7 @@ boost_arch_name  = boost_base_name+'.zip'
 boost_b2_name    = boost_base_name+os.sep+'b2'
 boost_url       = 'http://downloads.sourceforge.net/project/boost/boost/'+boost_version+'/'+boost_arch_name+'?r=&ts=1421801329&use_mirror=iweb'
 
-boost_dir = os.path.join(src_dir, 'extlibs','boost')
+boost_dir = os.path.join(src_dir,'extlibs','boost','boost')
 boost_bootstrap = os.path.join(boost_dir,'bootstrap.bat')
 
 if 'linux' == target_os :
@@ -30,19 +30,37 @@ if 'linux' == target_os :
     raise SCons.Errors.EnvironmentError('Unsupported platform')
 
 elif target_os in ['windows']:
-    if not os.path.exists(boost_bootstrap) and target_os == 'windows':
-        # TODO: Enable installation of Boost via SConscript
+    boost_zip_file   = os.path.join(src_dir,'extlibs','boost',boost_arch_name)
+
+    if not os.path.exists(boost_bootstrap):
+
+        # Download if necessary
+        if os.path.exists(boost_zip_file):
+            boost_zip = boost_zip_file
+        else:
+            print '*** Downloading Boost zip file (> 100MB). Please wait... ***'
+            boost_zip = env.Download(boost_zip_file, boost_url)
+
+        # Unzip boost
+        print '*** Unpacking boost %s zip file ... ***' % boost_version
+        env.UnpackAll(boost_dir, boost_zip)
+
+        # Rename from boost_1_60_0 -> boost
+        os.rename(boost_base_name, 'boost')
+
+    # Sanity check, in case the above method didn't work
+    if not os.path.exists(boost_bootstrap):
         print '''
 *********************************** Error: ****************************************
 * Please download boost from the following website:
 *
 *   ''' + boost_url + '''
 *
-* and extract the contents directly into:
+* and extract the contents directly into
 *
 *    ''' + boost_dir + '''
 *
-* such that you can find:
+* such that this build system can find:
 *
 * ''' + boost_bootstrap + '''
 *
index 5a3305b..5984b17 100644 (file)
@@ -29,7 +29,7 @@ samples_env.PrependUnique(CPPPATH = [
                '../../../../logger/include',
                '../../../../stack/include',
                '../../../../../../extlibs/cjson',
-               '../../../../../../extlibs/boost',
+               '../../../../../../extlibs/boost/boost',
                '../../../../../oc_logger/include',
                '../../../../../connectivity/lib/libcoap-4.1.1'
                ])
index 9d2cb21..b78a5ed 100644 (file)
@@ -70,7 +70,7 @@ if target_os == 'android':
 
 elif target_os in ['windows']:
        SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'boost', 'SConscript'))
-       boost_path = os.path.join(src_dir,'extlibs','boost')
+       boost_path = os.path.join(src_dir,'extlibs','boost','boost')
        lib_env.AppendUnique(CPPPATH = [boost_path])
 elif target_os == 'ios':
        lib_env.AppendUnique(FRAMEWORKS = ['boost'])
index 163c58b..b6ca64b 100644 (file)
@@ -95,7 +95,7 @@ elif target_os == 'darwin':
        lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
        lib_env.AppendUnique(LIBPATH = ['/usr/local/lib'])
 elif target_os == 'windows':
-       boost_path = os.path.join(src_dir,'extlibs','boost')
+       boost_path = os.path.join(src_dir,'extlibs','boost','boost')
        lib_env.AppendUnique(CPPPATH = [boost_path])
 
 Import('env')