build_common: Removing redundant env configuration
authorPawel Winogrodzki <pawelwi@microsoft.com>
Thu, 15 Jun 2017 19:38:53 +0000 (12:38 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 11 Jul 2017 17:06:23 +0000 (17:06 +0000)
Moving global environment configuration common for all
platforms into build_common/SConscript and removing repeated
lines from build_common/[platform]/SConscript.

Bug: https://jira.iotivity.org/browse/IOT-1583
Change-Id: Ic127e2c432ee50b0ba4aa91a460259d83d0b6b7d
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21287
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
build_common/SConscript
build_common/android/SConscript
build_common/arduino/SConscript
build_common/darwin/SConscript
build_common/linux/SConscript
build_common/msys_nt/SConscript
build_common/tizen/SConscript
build_common/windows/SConscript
service/notification/unittest/SConscript

index 68b0a76..58c9f82 100755 (executable)
@@ -624,6 +624,7 @@ if (target_os in ['darwin', 'ios']):
     env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
 
 if (env.get('SECURED') == '1'):
+    env.AppendUnique(CPPDEFINES=['SECURED'])
     env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
 
 if ((env.get('SECURED') == '1') and with_tcp):
@@ -735,8 +736,10 @@ if 'SERVER' in rd_mode:
 if with_ra_ibb:
     env.AppendUnique(CPPDEFINES=['RA_ADAPTER_IBB'])
 
-env.SConscript('external_builders.scons')
+if env.get('RELEASE'):
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 
+env.SConscript('external_builders.scons')
 ######################################################################
 # Link scons to Yocto cross-toolchain ONLY when target_os is yocto
 ######################################################################
@@ -790,13 +793,10 @@ if target_os == "yocto":
     '''
     Additional flags to pass to the Yocto toolchain.
     '''
-    if env.get('RELEASE'):
-        env.AppendUnique(CPPDEFINES=['NDEBUG'])
     env.AppendUnique(CPPDEFINES=['__linux__', '_GNU_SOURCE'])
     env.AppendUnique(CFLAGS=['-std=gnu99'])
     env.AppendUnique(CCFLAGS=['-Wall', '-Wextra', '-fPIC'])
     env.AppendUnique(LIBS=['dl', 'pthread', 'uuid'])
-    Export('env')
 else:
     '''
     If target_os is not Yocto, continue with the regular build process
@@ -837,4 +837,5 @@ env = conf.Finish()
 # in for windows till after the windows target has run.
 env.SConscript('external_builders.scons')
 env.SConscript('external_libs.scons')
+
 Return('env')
index 5604fb2..144eb12 100644 (file)
@@ -220,18 +220,13 @@ env.AppendUnique(LIBPATH=[dep_lib_dir])
 ######################################################################
 if env.get('RELEASE'):
     env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
     env.AppendUnique(LINKFLAGS=['-s'])
 else:
     env.AppendUnique(CCFLAGS=['-g'])
 
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
-
 env.AppendUnique(CPPDEFINES=['WITH_POSIX', '__ANDROID__'])
 env.AppendUnique(CCFLAGS=['-Wall', '-Wextra', '-fPIC'])
 
-env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
 env.AppendUnique(LIBPATH=[src_dir + '/resource/csdk/connectivity/lib/android'])
 env.AppendUnique(LIBS=['log', 'coap'])
 
index 491cac1..65a2901 100644 (file)
@@ -283,7 +283,6 @@ elif platform.system().lower() == 'darwin':
 # Debug/release relative flags
 if env.get('RELEASE'):
     env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
     env.AppendUnique(CCFLAGS=['-g'])
 
index cc44839..383a208 100644 (file)
@@ -56,14 +56,10 @@ env['SYS_VERSION'] = sys_version
 # Set release/debug flags
 if env.get('RELEASE'):
     env.AppendUnique(CCFLAGS=['-Os'])
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
     env.AppendUnique(CCFLAGS=['-g'])
     env.AppendUnique(LINKFLAGS=['-g'])
 
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['TB_LOG'])
-
 if env.get('SECURED') == '1':
     env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
index 8718eda..331482a 100644 (file)
@@ -44,13 +44,9 @@ env.AppendENVPath('LD_LIBRARY_PATH', [build_dir])
 # Set release/debug flags
 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'])
-
 env.AppendUnique(CPPDEFINES=['WITH_POSIX', '__linux__'])
 env.AppendUnique(CFLAGS=['-std=gnu99'])
 env.AppendUnique(CCFLAGS=['-Wall', '-Wextra', '-fPIC'])
index bd5c8c0..6646992 100644 (file)
@@ -9,8 +9,6 @@ Import('env')
 if env['TARGET_OS'] == 'msys_nt':
     env['SHLIBPREFIX'] = 'lib'
 
-env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
-
 # Add MinGW-specific libraries
 env.AppendUnique(
     LIBS=['bcrypt', 'ws2_32', 'advapi32', 'iphlpapi', 'crypt32', 'kernel32'])
@@ -20,7 +18,6 @@ target_arch = env.get('TARGET_ARCH')
 if env['CC'] == 'gcc':
     if env.get('RELEASE'):
         env.AppendUnique(CCFLAGS=['-Os'])
-        env.AppendUnique(CPPDEFINES=['NDEBUG'])
     else:
         env.AppendUnique(CCFLAGS=['-g'])
     env.AppendUnique(CFLAGS=['-std=c99'])
index c9f112a..bb12e1f 100755 (executable)
@@ -9,13 +9,6 @@ Import('env')
 
 print "Reading linux configuration script"
 
-# Set release/debug flags
-if env.get('RELEASE'):
-    env.AppendUnique(CPPDEFINES=['NDEBUG'])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES=['-DTB_LOG'])
-
 env['CCFLAGS'] = SCons.Util.CLVar(os.environ.get('CFLAGS', ""))
 env.AppendUnique(CPPDEFINES=['WITH_POSIX', '__linux__'])
 env.AppendUnique(CFLAGS=['-std=gnu99'])
@@ -27,4 +20,5 @@ env.AppendUnique(
 env.ParseConfig("pkg-config dlog --cflags --libs")
 if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True':
     env.ParseConfig("pkg-config ttrace --cflags --libs")
+    env.AppendUnique(CPPDEFINES=['OIC_SUPPORT_TIZEN_TRACE'])
 # Set arch flags : It will be handled by Tizen build system.
index 2b144da..68c124e 100644 (file)
@@ -72,12 +72,10 @@ if env['CC'] == 'cl':
     # Set release/debug flags
     if env.get('RELEASE'):
         env.AppendUnique(CCFLAGS=['/MD', '/O2', '/GF'])
-        env.AppendUnique(CPPDEFINES=['NDEBUG'])
     else:
         env.AppendUnique(CCFLAGS=['/MDd', '/Od', '/RTC1'])
         env.AppendUnique(LINKFLAGS=['/debug'])
 
-    env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
 
     # Work around [IOT-1986]
     # During some Windows multi-threaded builds, SCons/Python/Pywin32 appear to try
index 31f8df9..70729cf 100644 (file)
@@ -82,7 +82,6 @@ notification_test_env.PrependUnique(CPPPATH=[
 if env.get('WITH_TCP') == True:
     notification_test_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
-    notification_test_env.AppendUnique(CPPDEFINES=['SECURED'])
     notification_test_env.AppendUnique(
         LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
     notification_test_env.AppendUnique(