build: Reformat the examples SConscript to be more pythonic. 71/20571/2
authorMats Wichmann <mats@linux.com>
Fri, 2 Jun 2017 15:22:56 +0000 (09:22 -0600)
committerPhil Coval <philippe.coval@osg.samsung.com>
Fri, 16 Jun 2017 13:48:08 +0000 (13:48 +0000)
There are no functional changes.  A comment was updated.

Change-Id: I9200be3cc66559de0c40c0d3c99c09f15a039291
Signed-off-by: Mats Wichmann <mats@linux.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20571
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
examples/OICMiddle/SConscript

index 9592e9f..5a3ea8f 100644 (file)
@@ -22,6 +22,7 @@
 # Examples build script
 ##
 Import('env')
+
 # Add third party libraries
 lib_env = env.Clone()
 SConscript('#resource/third_party_libs.scons', 'lib_env')
@@ -30,52 +31,64 @@ examples_env = lib_env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
-examples_env.AppendUnique(CPPPATH = [
-               '../../resource/include/',
-               '../../resource/csdk/include',
-               '../../resource/csdk/stack/include',
-               '../../resource/c_common/ocrandom/include',
-               '../../resource/csdk/logger/include',
-               '../../resource/oc_logger/include'
-               ])
+examples_env.AppendUnique(CPPPATH=[
+    '../../resource/include/',
+    '../../resource/csdk/include',
+    '../../resource/csdk/stack/include',
+    '../../resource/c_common/ocrandom/include',
+    '../../resource/csdk/logger/include',
+    '../../resource/oc_logger/include'
+])
 
 target_os = env.get('TARGET_OS')
 if target_os not in ['windows']:
-       examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+    examples_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
 
-       # Note: 'pthread' is in libc for android. On other platform, if use
-       # new gcc(>4.9?) it isn't required, otherwise, it's required
-       if target_os != 'android':
-               examples_env.AppendUnique(LIBS = ['pthread'])
+    # Note: pthread support is in libc for Android.
+    # On other platforms using pthreads, you need to say something to include.
+    # On gcc platforms, -lpthread should not be needed if you use -pthread
+    # (see CXXFLAGS above) which sets both build options and linking options.
+    # Left in for now.
+    if target_os != 'android':
+        examples_env.AppendUnique(LIBS=['pthread'])
 
-examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-examples_env.PrependUnique(LIBS = ['coap'])
-examples_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-examples_env.AppendUnique(LIBS = ['oc_logger'])
-examples_env.AppendUnique(LIBS = ['octbstack'])
-examples_env.AppendUnique(LIBS = ['oc'])
-examples_env.AppendUnique(LIBS = ['rt'])
+examples_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+examples_env.PrependUnique(LIBS=['coap'])
+examples_env.AppendUnique(LIBS=[
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'rt'
+])
 
 if env.get('SECURED') == '1':
-       examples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    examples_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if target_os == 'android':
-       examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-       examples_env.AppendUnique(LIBS = ['gnustl_static'])
+    examples_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    examples_env.AppendUnique(LIBS=['gnustl_static'])
 
-       if not env.get('RELEASE'):
-               examples_env.AppendUnique(LIBS = ['log'])
+    if not env.get('RELEASE'):
+        examples_env.AppendUnique(LIBS=['log'])
 
 if target_os in ['darwin', 'ios']:
-       examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+    examples_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
 
 if env.get('WITH_CLOUD'):
-       examples_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    examples_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-OICMiddle = examples_env.Program('OICMiddle', ['OICMiddle.cpp', 'Client.cpp', 'LineInput.cpp', 'RestInput.cpp', 'Server.cpp', 'WrapResource.cpp'])
+OICMiddle = examples_env.Program('OICMiddle', [
+    'OICMiddle.cpp',
+    'Client.cpp',
+    'LineInput.cpp',
+    'RestInput.cpp',
+    'Server.cpp',
+    'WrapResource.cpp'
+])
 
 Alias("examples", [OICMiddle])
 env.AppendTarget('examples')