notification: Removing redundant configuration 27/21327/12
authorPawel Winogrodzki <pawelwi@microsoft.com>
Fri, 28 Apr 2017 04:21:50 +0000 (21:21 -0700)
committerMats Wichmann <mats@linux.com>
Wed, 27 Sep 2017 14:39:13 +0000 (14:39 +0000)
Moving global environment configuration common for all
platforms into build_common/SConscript and removing repeated
lines from service/notification/*.

Bug: https://jira.iotivity.org/browse/IOT-1583
Change-Id: I696f93a0fde5fcbe7ed8f3509b4de1747825d5fd
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
service/notification/SConscript
service/notification/cpp-wrapper/consumer/SConscript
service/notification/cpp-wrapper/examples/linux/SConscript
service/notification/cpp-wrapper/provider/SConscript
service/notification/examples/linux/SConscript

index 4c369dc..4ebc70e 100644 (file)
 import platform
 Import('env')
 
-if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
-else:
-    env.AppendUnique(CCFLAGS=['-g'])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
-
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
 notification_env = lib_env.Clone()
 
+if notification_env.get('RELEASE'):
+    notification_env.AppendUnique(CCFLAGS=['-Os'])
+else:
+    notification_env.AppendUnique(CCFLAGS=['-g'])
+
 target_os = env.get('TARGET_OS')
 
 ######################################################################
 # Build flags
 ######################################################################
-
 notification_env.AppendUnique(CPPPATH=[
     'include',
     'src/common',
     'src/provider',
     'src/consumer',
+    '#/resource/c_common',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/c_common/oic_string/include',
+    '#/resource/c_common/oic_time/include',
     '#/resource/csdk/include',
     '#/resource/csdk/security/include',
     '#/resource/csdk/stack/include',
@@ -61,7 +60,7 @@ notification_env.PrependUnique(LIBS=[
     'oc_logger',
     'connectivity_abstraction',
     'libcoap',
-    'resource_directory'
+    'resource_directory',
 ])
 
 if target_os not in ['windows', 'winrt']:
@@ -71,11 +70,11 @@ if target_os not in ['windows', 'winrt']:
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
     notification_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
-if target_os == 'linux':
-    notification_env.AppendUnique(LIBS=['pthread'])
-    if not env.get('RELEASE'):
-        notification_env.PrependUnique(LIBS=['gcov'])
-        notification_env.AppendUnique(CCFLAGS=['--coverage'])
+notification_env.AddPthreadIfNeeded()
+
+if (target_os == 'linux') and (not env.get('RELEASE')):
+    notification_env.PrependUnique(LIBS=['gcov'])
+    notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
 if target_os == 'android':
     notification_env.AppendUnique(CCFLAGS=['-frtti', '-fexceptions'])
@@ -84,29 +83,6 @@ if target_os == 'android':
     if not env.get('RELEASE'):
         notification_env.AppendUnique(LIBS=['log'])
 
-if target_os == 'tizen':
-    notification_env.AppendUnique(CPPDEFINES=['__TIZEN__'])
-    # notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
-
-if env.get('WITH_CLOUD') == True:
-    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
-
-if env.get('SECURED') == '1':
-    notification_env.AppendUnique(CPPDEFINES=['SECURED'])
-
-with_mq = env.get('WITH_MQ')
-if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
-    print "MQ SUB support"
-
-if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
-    print "MQ PUB support"
-
-if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
-    print "MQ Broker support"
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index 134eb17..2073a26 100644 (file)
 import platform
 Import('env')
 
-if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
-else:
-    env.AppendUnique(CCFLAGS=['-g'])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
-
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
 notification_env = lib_env.Clone()
 
 target_os = env.get('TARGET_OS')
 
+if notification_env.get('RELEASE'):
+    notification_env.AppendUnique(CCFLAGS=['-Os'])
+else:
+    notification_env.AppendUnique(CCFLAGS=['-g'])
+
 ######################################################################
 # Build flags
 ######################################################################
@@ -49,17 +45,21 @@ notification_env.AppendUnique(CPPPATH=[
     '../common',
     '../provider/inc',
     '../../src/common',
+    '#/resource/c_common',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/c_common/oic_string/include',
     '#/resource/csdk/security/include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/include',
-    '#/resource/oc_logger/include'
+    '#/resource/oc_logger/include',
 ])
 
 notification_env.PrependUnique(LIBS=[
     'oc_logger',
     'oc',
     'notification_consumer',
+    'logger',
 ])
 
 notification_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-frtti'])
@@ -84,21 +84,9 @@ if not env.get('RELEASE') and target_os not in ['ios']:
     notification_env.PrependUnique(LIBS=['gcov'])
     notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
-if env.get('WITH_CLOUD') == True:
-    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
-
-with_mq = env.get('WITH_MQ')
-if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
-    print "MQ SUB support"
-
-if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
-    print "MQ PUB support"
+if target_os in ['linux', 'tizen']:
+    notification_env.AppendUnique(LIBS=['rt'])
 
-if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
-    print "MQ Broker support"
 ######################################################################
 # Source files and Targets for Consumer
 ######################################################################
@@ -147,7 +135,7 @@ if target_os == 'android':
         '../../../../extlibs/boost/boost_1_58_0',
         '../../../../java/jni',
         '../../android/notification-service/src/main/jni/common',
-        '../../android/notification-service/src/main/jni/consumer'
+        '../../android/notification-service/src/main/jni/consumer',
     ])
 
     notification_jni_consumer_env.PrependUnique(
index ea2129f..2b74d24 100644 (file)
@@ -37,6 +37,9 @@ notification_sample_env.AppendUnique(CPPPATH=[
     '../../provider/inc',
     '../../consumer/inc',
     '../../common',
+    '#/resource/c_common',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/c_common/oic_string/include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/csdk/connectivity/api',
@@ -73,29 +76,13 @@ if not env.get('RELEASE'):
     notification_sample_env.PrependUnique(LIBS=['gcov'])
     notification_sample_env.AppendUnique(CCFLAGS=['--coverage'])
 
-if env.get('WITH_CLOUD') == True:
-    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
-with_mq = env.get('WITH_MQ')
-if 'SUB' in with_mq:
-    notification_sample_env.AppendUnique(
-        CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
-    print "MQ SUB support"
-
-if 'PUB' in with_mq:
-    notification_sample_env.AppendUnique(
-        CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
-    print "MQ PUB support"
-
-if 'BROKER' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
-    print "MQ Broker support"
 
-if env.get('WITH_TCP') == True:
-    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
     notification_sample_env.AppendUnique(
         LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
+if target_os in ['linux', 'tizen']:
+    notification_sample_env.AppendUnique(LIBS=['rt'])
 
 ####################################################################
 # Source files and Targets
index c42e4b0..089a00a 100644 (file)
 import platform
 Import('env')
 
-if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
-else:
-    env.AppendUnique(CCFLAGS=['-g'])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
-
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
 notification_env = lib_env.Clone()
 
 target_os = env.get('TARGET_OS')
 
+if notification_env.get('RELEASE'):
+    notification_env.AppendUnique(CCFLAGS=['-Os'])
+else:
+    notification_env.AppendUnique(CCFLAGS=['-g'])
+
+
 ######################################################################
 # Build flags
 ######################################################################
@@ -49,6 +46,9 @@ notification_env.AppendUnique(CPPPATH=[
     '../common',
     '../consumer/inc',
     '../../src/common',
+    '#/resource/c_common',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/c_common/oic_string/include',
     '#/resource/csdk/security/include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
@@ -61,7 +61,8 @@ notification_env.PrependUnique(LIBS=[
     'oc',
     'octbstack',
     'notification_provider',
-    'resource_directory'
+    'resource_directory',
+    'logger'
 ])
 notification_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-frtti'])
 
@@ -85,21 +86,9 @@ if not env.get('RELEASE') and target_os not in ['ios']:
     notification_env.PrependUnique(LIBS=['gcov'])
     notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
-if env.get('WITH_CLOUD') == True:
-    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
-
-with_mq = env.get('WITH_MQ')
-if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
-    print "MQ SUB support"
-
-if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
-    print "MQ PUB support"
+if target_os in ['linux', 'tizen']:
+    notification_env.AppendUnique(LIBS=['rt'])
 
-if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
-    print "MQ Broker support"
 ######################################################################
 # Source files and Targets for Provider
 ######################################################################
index c48d27c..dfe32bb 100644 (file)
@@ -16,6 +16,9 @@ notification_sample_env.AppendUnique(CPPPATH=[
     '../../include',
     '../../src/common',
     '../../src/provider',
+    '#/resource/c_common',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/c_common/oic_string/include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/csdk/security/include',
@@ -54,7 +57,6 @@ notification_sample_provider_src = 'notificationprovider.c'
 if env.get('WITH_CLOUD') == True:
     notification_sample_env.AppendUnique(CPPPATH=['../../src/consumer'])
     notification_sample_env.AppendUnique(CPPPATH=['../../src/provider'])
-    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
     providerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
     consumerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
@@ -72,26 +74,11 @@ if env.get('WITH_CLOUD') == True:
         consumerCloudConnectorObj,
     ]
 
-if env.get('WITH_TCP') == True:
-    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
     notification_sample_env.AppendUnique(
         LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
-with_mq = env.get('WITH_MQ')
-if 'SUB' in with_mq:
-    notification_sample_env.AppendUnique(
-        CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
-    print "MQ SUB support"
-
-if 'PUB' in with_mq:
-    notification_sample_env.AppendUnique(
-        CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
-    print "MQ PUB support"
 
-if 'BROKER' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
-    print "MQ Broker support"
 
 ####################################################################
 # Source files and Targets