notification: Removing redundant configuration
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 4c369dcc6152bca4b0a76820498881b2d9e80018..4ebc70e2302a91609ceaaaeb8ac3077554394917 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 134eb17ffe5e71e740ae9ba51f2e969ba085eb4b..2073a264574785bec3d8810b26981f1170011597 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 ea2129fea98decdd94eb6a1a3b79eb1724a519dd..2b74d2405881c26d2d3bc136e3530f64a4e661bd 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 c42e4b010036ae7bb54872e0d473f50e88fcb56c..089a00a0ecd74c980093520d2bc2b8deba12b848 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 c48d27c2508ccd48ed27f6ab37553969fa101e0d..dfe32bb61562f86a08a6933c07b9d05fd321487b 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