From 0cdda45574ab00fa99060693eeed0cfd7a11667b Mon Sep 17 00:00:00 2001 From: Pawel Winogrodzki Date: Thu, 15 Jun 2017 12:52:09 -0700 Subject: [PATCH] bridging: Cleaning up SConscript files. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/20943 Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai Reviewed-by: Phil Coval --- bridging/common/SConscript | 20 ++++++--------- bridging/mini_plugin_manager/SConscript | 42 +++++++++++++++----------------- bridging/mpm_client/SConscript | 7 +++--- bridging/plugins/hue_plugin/SConscript | 1 - bridging/plugins/lifx_plugin/SConscript | 10 -------- bridging/plugins/lyric_plugin/SConscript | 10 -------- bridging/plugins/nest_plugin/SConscript | 1 - 7 files changed, 30 insertions(+), 61 deletions(-) diff --git a/bridging/common/SConscript b/bridging/common/SConscript index 19ad9f2..51fc27a 100644 --- a/bridging/common/SConscript +++ b/bridging/common/SConscript @@ -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', diff --git a/bridging/mini_plugin_manager/SConscript b/bridging/mini_plugin_manager/SConscript index 9b61de9..58a1f49 100644 --- a/bridging/mini_plugin_manager/SConscript +++ b/bridging/mini_plugin_manager/SConscript @@ -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') diff --git a/bridging/mpm_client/SConscript b/bridging/mpm_client/SConscript index 446e37b..ebc3420 100644 --- a/bridging/mpm_client/SConscript +++ b/bridging/mpm_client/SConscript @@ -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: diff --git a/bridging/plugins/hue_plugin/SConscript b/bridging/plugins/hue_plugin/SConscript index ec22a98..6cd4557 100644 --- a/bridging/plugins/hue_plugin/SConscript +++ b/bridging/plugins/hue_plugin/SConscript @@ -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']) diff --git a/bridging/plugins/lifx_plugin/SConscript b/bridging/plugins/lifx_plugin/SConscript index 261ad20..d012dbc 100644 --- a/bridging/plugins/lifx_plugin/SConscript +++ b/bridging/plugins/lifx_plugin/SConscript @@ -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']) diff --git a/bridging/plugins/lyric_plugin/SConscript b/bridging/plugins/lyric_plugin/SConscript index 25d63ab..b1bff08 100644 --- a/bridging/plugins/lyric_plugin/SConscript +++ b/bridging/plugins/lyric_plugin/SConscript @@ -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']) diff --git a/bridging/plugins/nest_plugin/SConscript b/bridging/plugins/nest_plugin/SConscript index 3e020dd..d977583 100644 --- a/bridging/plugins/nest_plugin/SConscript +++ b/bridging/plugins/nest_plugin/SConscript @@ -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']) -- 2.7.4