bridging: Cleaning up SConscript files.
authorPawel Winogrodzki <pawelwi@microsoft.com>
Thu, 15 Jun 2017 19:52:09 +0000 (12:52 -0700)
committerPhil Coval <philippe.coval@osg.samsung.com>
Thu, 29 Jun 2017 11:12:54 +0000 (11:12 +0000)
Removing settings already present in the global "env" variable
along with any modifications to that global environment to get rid
of cross dependencies between scripts and forcing them to be executed
in a specific order.

Bug: https://jira.iotivity.org/browse/IOT-1583
Change-Id: I383e01dcfaf23a323d51199e5d091e57751659bc
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20943
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
bridging/common/SConscript
bridging/mini_plugin_manager/SConscript
bridging/mpm_client/SConscript
bridging/plugins/hue_plugin/SConscript
bridging/plugins/lifx_plugin/SConscript
bridging/plugins/lyric_plugin/SConscript
bridging/plugins/nest_plugin/SConscript

index 19ad9f2..51fc27a 100644 (file)
@@ -45,26 +45,20 @@ def maskFlags(flags):
 ######################################################################
 
 mpmcommon_env.PrependUnique(CPPPATH=[
-    os.path.join(src_dir, 'resource', 'include'),
-])
-mpmcommon_env.AppendUnique(CPPPATH=[
-    os.path.join(bridging_path, 'include'),
+                            os.path.join(src_dir, 'resource', 'include'),
+                            os.path.join(bridging_path, 'include'),
+                            os.path.join(src_dir, 'resource', 'c_common'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'ocrandom', 'include'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'oic_malloc', 'include'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include')
 ])
 
 if target_os not in ['arduino', 'windows']:
-    mpmcommon_env.AppendUnique(CPPDEFINES=['WITH_POSIX'])
     mpmcommon_env.AppendUnique(
         CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror', '-fpic'])
 
-if target_os in ['darwin', 'ios']:
-    mpmcommon_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
-
 mpmcommon_env.AppendUnique(RPATH=[mpmcommon_env.get('BUILD_DIR')])
-mpmcommon_env.AppendUnique(LIBPATH=[mpmcommon_env.get('BUILD_DIR')])
-mpmcommon_env['LINKFLAGS'] = maskFlags(env['LINKFLAGS'])
-
-if mpmcommon_env.get('LOGGING'):
-    mpmcommon_env.AppendUnique(CPPDEFINES=['TB_LOG'])
+mpmcommon_env['LINKFLAGS'] = maskFlags(mpmcommon_env['LINKFLAGS'])
 
 mpmcommon_env.PrependUnique(LIBS=[
     'm',
index 9b61de9..58a1f49 100644 (file)
@@ -29,31 +29,27 @@ target_os = env.get('TARGET_OS')
 src_dir = env.get('SRC_DIR')
 bridging_path = os.path.join(src_dir, 'bridging')
 
+manager_env = env.Clone()
+
 print "Reading MPM script"
 
 ######################################################################
 # Build flags
 ######################################################################
-env.PrependUnique(CPPPATH=[
-    os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include'),
-    os.path.join(src_dir, 'extlibs', 'rapidjson', 'include', 'rapidjson')
+manager_env.PrependUnique(CPPPATH=[
+                            os.path.join(src_dir, 'resource', 'c_common'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'ocrandom', 'include'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'oic_malloc', 'include'),
+                            os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include'),
+                            os.path.join(src_dir, 'extlibs', 'rapidjson', 'include', 'rapidjson'),
+                            os.path.join(bridging_path, 'include')
 ])
-env.AppendUnique(CPPPATH=[os.path.join(bridging_path, 'include')])
 
 if target_os not in ['arduino', 'windows']:
-    env.AppendUnique(CPPDEFINES=['WITH_POSIX'])
-    env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
-
-if target_os in ['darwin', 'ios']:
-    env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
-
-env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
-env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
+        manager_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
 
-env.PrependUnique(LIBS=['mpmcommon'])
+manager_env.AppendUnique(RPATH=[manager_env.get('BUILD_DIR')])
+manager_env.PrependUnique(LIBS=['mpmcommon'])
 
 #####################################################################
 # Source files and Target(s)
@@ -63,14 +59,14 @@ minipluginmanager_src = [
                  'miniPluginManager.cpp'),
 ]
 
-env.AppendUnique(MINIPLUGINMANAGER_SRC=minipluginmanager_src)
+manager_env.AppendUnique(MINIPLUGINMANAGER_SRC=minipluginmanager_src)
 
 if target_os in ['android', 'tizen']:
-    mpmlib = env.SharedLibrary('minipluginmanager',
-                               env.get('MINIPLUGINMANAGER_SRC'))
+        mpmlib = manager_env.SharedLibrary('minipluginmanager',
+                                           manager_env.get('MINIPLUGINMANAGER_SRC'))
 else:
-    mpmlib = env.StaticLibrary('minipluginmanager',
-                               env.get('MINIPLUGINMANAGER_SRC'))
-env.InstallTarget(mpmlib, 'minipluginmanager')
-env.UserInstallTargetLib(mpmlib, 'minipluginmanager')
+        mpmlib = manager_env.StaticLibrary('minipluginmanager',
+                                           manager_env.get('MINIPLUGINMANAGER_SRC'))
+manager_env.InstallTarget(mpmlib, 'minipluginmanager')
+manager_env.UserInstallTargetLib(mpmlib, 'minipluginmanager')
 
index 446e37b..ebc3420 100644 (file)
@@ -45,14 +45,15 @@ mpmclient_env.PrependUnique(CPPPATH=[
 # Otherwise you will need to prepend LD_LIBRARY_PATH to your execution command.
 mpmclient_env.PrependUnique(LIBS=['minipluginmanager'])
 mpmclient_env.AppendUnique(LIBS=['pthread'])
-mpmclient_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 mpmclient_env.AppendUnique(LIBS=[
-    'm', 'octbstack', 'ocsrm', 'connectivity_abstraction', 'coap', 'curl'
+    'm', 'octbstack', 'ocsrm', 'mpmcommon', 'connectivity_abstraction', 'coap', 'curl'
 ])
-
 mpmclient_env.AppendUnique(
     RPATH=[os.path.join(env.get('BUILD_DIR'), 'bridging', 'plugins')])
 
+if target_os in ['linux', 'tizen', 'yocto']:
+    mpmclient_env.AppendUnique(LIBS = ['rt'])
+
 if target_os in ['linux', 'tizen']:
     mpmclient_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 else:
index ec22a98..6cd4557 100644 (file)
@@ -70,7 +70,6 @@ if target_os in ['darwin', 'ios']:
 
 hue_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
 hue_env.AppendUnique(RPATH=[hue_env.get('BUILD_DIR')])
-hue_env.AppendUnique(LIBPATH=[hue_env.get('BUILD_DIR')])
 
 if hue_env.get('LOGGING'):
     hue_env.AppendUnique(CPPDEFINES=['TB_LOG'])
index 261ad20..d012dbc 100644 (file)
@@ -61,21 +61,11 @@ lifx_env.AppendUnique(CPPPATH=[
     os.path.join(bridging_path, 'plugins', 'lifx_plugin', 'lifx_objects')
 ])
 
-if target_os not in ['arduino', 'windows']:
-    lifx_env.AppendUnique(CPPDEFINES=['WITH_POSIX'])
-
-if target_os in ['darwin', 'ios']:
-    lifx_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
-
 if 'g++' in lifx_env.get('CXX'):
     lifx_env.AppendUnique(
         CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
 
 lifx_env.AppendUnique(RPATH=[lifx_env.get('BUILD_DIR')])
-lifx_env.AppendUnique(LIBPATH=[lifx_env.get('BUILD_DIR')])
-
-if lifx_env.get('LOGGING'):
-    lifx_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lifx_env['LINKFLAGS'] = maskFlags(env['LINKFLAGS'])
 lifx_env.AppendUnique(LINKFLAGS=['-Wl,--allow-shlib-undefined'])
index 25d63ab..b1bff08 100644 (file)
@@ -63,21 +63,11 @@ lyric_env.AppendUnique(CPPPATH=[
     os.path.join(bridging_path, 'plugins', 'lyric_plugin', 'honeywell_objects')
 ])
 
-if target_os not in ['arduino', 'windows']:
-    lyric_env.AppendUnique(CPPDEFINES=['WITH_POSIX'])
-
-if target_os in ['darwin', 'ios']:
-    lyric_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
-
 if 'g++' in lyric_env.get('CXX'):
     lyric_env.AppendUnique(
         CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
 
 lyric_env.AppendUnique(RPATH=[lyric_env.get('BUILD_DIR')])
-lyric_env.AppendUnique(LIBPATH=[lyric_env.get('BUILD_DIR')])
-
-if lyric_env.get('LOGGING'):
-    lyric_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lyric_env['LINKFLAGS'] = maskFlags(env['LINKFLAGS'])
 lyric_env.AppendUnique(LINKFLAGS=['-Wl,--allow-shlib-undefined'])
index 3e020dd..d977583 100644 (file)
@@ -73,7 +73,6 @@ if 'g++' in nest_env.get('CXX'):
         CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
 
 nest_env.AppendUnique(RPATH=[nest_env.get('BUILD_DIR')])
-nest_env.AppendUnique(LIBPATH=[nest_env.get('BUILD_DIR')])
 
 if nest_env.get('LOGGING'):
     nest_env.AppendUnique(CPPDEFINES=['TB_LOG'])