Commit 9fa87391 authored by Pawel Winogrodzki's avatar Pawel Winogrodzki Committed by Mats Wichmann

easy-setup: Removing redundant env configuration

Moving global environment configuration common for all
platforms into build_common/SConscript and removing repeated
lines from service/easy-setup/*.

Bug: https://jira.iotivity.org/browse/IOT-1583
Change-Id: I76cf82bacb36d95574f5d716c01cd1d7fb7e4f5f
Signed-off-by: default avatarPawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21325Reviewed-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarMats Wichmann <mats@linux.com>
Reviewed-by: default avatarPhil Coval <philippe.coval@osg.samsung.com>
parent bd6a4aee
......@@ -28,18 +28,16 @@ target_os = enrollee_env.get('TARGET_OS')
if enrollee_env.get('RELEASE'):
enrollee_env.AppendUnique(CCFLAGS=['-Os'])
enrollee_env.AppendUnique(CPPDEFINES=['NDEBUG'])
else:
enrollee_env.AppendUnique(CCFLAGS=['-g'])
if enrollee_env.get('LOGGING'):
enrollee_env.AppendUnique(CPPDEFINES=['TB_LOG'])
######################################################################
# Build flags
######################################################################
enrollee_env.PrependUnique(CPPPATH=[
'#/resource/c_common',
'#/resource/c_common/oic_malloc/include',
'#/resource/c_common/oic_string/include',
'#/resource/include',
'#/resource/csdk/logger/include',
'#/resource/oc_logger/include',
......@@ -76,10 +74,9 @@ if not env.get('RELEASE'):
# Linux Enrollee
######################################################################
if target_os in ['linux']:
enrollee_env.AppendUnique(LIBS=['pthread', 'dl'])
enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.AddPthreadIfNeeded()
enrollee_env.AppendUnique(LIBS=['dl'])
enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS=['-pthread'])
enrollee_env.PrependUnique(LIBS=[
'oc',
'octbstack',
......@@ -94,7 +91,6 @@ if target_os in ['linux']:
# Tizen Enrollee
######################################################################
if target_os == 'tizen':
enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS=['-pthread'])
enrollee_env.PrependUnique(LIBS=[
......@@ -109,7 +105,6 @@ if target_os == 'tizen':
# Arduino Enrollee
######################################################################
if target_os == 'arduino':
enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
enrollee_env.PrependUnique(LIBS=[
'oc',
......
......@@ -64,8 +64,7 @@ if target_os not in ['windows', 'winrt']:
easysetup_test_env.AppendUnique(
CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
easysetup_test_env.AppendUnique(CXXFLAGS=['-pthread'])
easysetup_test_env.AppendUnique(LIBS=['pthread'])
easysetup_test_env.AddPthreadIfNeeded()
easysetup_test_env.PrependUnique(CPPPATH=[
'#/extlibs/hippomocks/hippomocks',
......
......@@ -26,14 +26,16 @@ Import('env')
easysetup_path = os.curdir
if env.get('RELEASE'):
env.AppendUnique(CCFLAGS=['-Os'])
env.AppendUnique(CPPDEFINES=['NDEBUG'])
else:
env.AppendUnique(CCFLAGS=['-g'])
# Add third party libraries
lib_env = env.Clone()
SConscript('#service/third_party_libs.scons', 'lib_env')
if env.get('LOGGING'):
env.AppendUnique(CPPDEFINES=['TB_LOG'])
easy_setup_env = lib_env.Clone()
if easy_setup_env.get('RELEASE'):
easy_setup_env.AppendUnique(CCFLAGS=['-Os'])
else:
easy_setup_env.AppendUnique(CCFLAGS=['-g'])
# Easysetup provides reference implemenation of Arduino Enrollee.
# Mediator applications developed on different platforms will be default defining the
......@@ -45,13 +47,7 @@ target_enrollee = env.get('ES_TARGET_ENROLLEE')
if target_enrollee == 'arduino':
print "REMOTE_ARDUINO_ENROLEE flag is defined."
print "The Mediator application will be working only with Arduino Enrollee."
env.AppendUnique(CPPDEFINES=['REMOTE_ARDUINO_ENROLEE'])
# Add third party libraries
lib_env = env.Clone()
SConscript('#service/third_party_libs.scons', 'lib_env')
easy_setup_env = lib_env.Clone()
easy_setup_env.AppendUnique(CPPDEFINES=['REMOTE_ARDUINO_ENROLEE'])
target_os = env.get('TARGET_OS')
######################################################################
......@@ -61,6 +57,9 @@ easy_setup_env.AppendUnique(CPPPATH=[
'inc',
'src',
'../../inc',
'#/resource/c_common',
'#/resource/c_common/oic_malloc/include',
'#/resource/c_common/oic_string/include',
'#/resource/include',
'#/resource/csdk/include',
'#/resource/csdk/stack/include',
......@@ -71,10 +70,11 @@ if target_os not in ['windows']:
easy_setup_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
if target_os in ['linux', 'tizen']:
easy_setup_env.AppendUnique(LIBS=['pthread', 'dl', 'coap'])
easy_setup_env.AppendUnique(LIBS=['dl', 'coap'])
easy_setup_env.AddPthreadIfNeeded()
if target_os in ['android']:
easy_setup_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
if env.get('SECURED') == '1':
easy_setup_env.AppendUnique(LIBPATH=[
env.get('SRC_DIR') +
......@@ -95,7 +95,6 @@ if target_os in ['android']:
easy_setup_env.AppendUnique(LIBS=['log'])
if target_os in ['linux', 'tizen']:
easy_setup_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
easy_setup_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
easy_setup_env.AppendUnique(CXXFLAGS=['-pthread'])
easy_setup_env.PrependUnique(LIBS=[
......@@ -155,7 +154,7 @@ es_src = None
if target_os in ['android', 'ios', 'linux', 'tizen']:
if env.get('SECURED') == '1':
env.AppendUnique(
easy_setup_env.AppendUnique(
es_src=[os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
es_common_src = [
......@@ -166,14 +165,14 @@ if target_os in ['android', 'ios', 'linux', 'tizen']:
'src/ESException.cpp',
]
env.AppendUnique(es_src=es_common_src)
easy_setup_env.AppendUnique(es_src=es_common_src)
es_sdk_static = easy_setup_env.StaticLibrary('ESMediatorRich',
env.get('es_src'))
easy_setup_env.get('es_src'))
easy_setup_env.InstallTarget(es_sdk_static, 'libESMediatorRich')
if target_os not in ['ios']:
es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich',
env.get('es_src'))
easy_setup_env.get('es_src'))
easy_setup_env.UserInstallTargetLib(es_sdk_shared, 'libESMediatorRich')
easy_setup_env.AppendUnique(
LINKFLAGS=['-Wl,-soname,libESMediatorRich.so'])
......
......@@ -63,8 +63,7 @@ if target_os not in ['windows', 'winrt']:
easysetup_test_env.AppendUnique(
CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
easysetup_test_env.AppendUnique(CXXFLAGS=['-pthread'])
easysetup_test_env.AppendUnique(LIBS=['pthread'])
easysetup_test_env.AddPthreadIfNeeded()
easysetup_test_env.PrependUnique(CPPPATH=[
'#/extlibs/hippomocks/hippomocks',
......
......@@ -44,9 +44,7 @@ enrollee_env.PrependUnique(CPPPATH=[
env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'
])
enrollee_env.AppendUnique(CPPDEFINES=['TB_LOG', 'ESWIFI'])
enrollee_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CPPDEFINES=['ESWIFI'])
enrollee_env.PrependUnique(LIBS=[
'octbstack',
......
......@@ -21,10 +21,9 @@
# Build script for Linux Enrollee Sample App
######################################################################
Import('env')
import os
print Dir('#').abspath
print Dir('.').abspath
Import('env')
enrollee_env = env.Clone()
transport = enrollee_env.get('TARGET_TRANSPORT')
......@@ -32,30 +31,28 @@ transport = enrollee_env.get('TARGET_TRANSPORT')
######################################################################
# Build flags
######################################################################
enrollee_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
if env.get('RELEASE'):
enrollee_env.AppendUnique(CCFLAGS=['-Os'])
enrollee_env.AppendUnique(CPPDEFINES=['NDEBUG'])
else:
enrollee_env.AppendUnique(CCFLAGS=['-g'])
if env.get('LOGGING'):
env.AppendUnique(CPPDEFINES=['TB_LOG'])
enrollee_env.PrependUnique(CPPPATH=[
env.get('SRC_DIR') + '/resource/include',
env.get('SRC_DIR') + '/resource/oc_logger/include',
env.get('SRC_DIR') + '/resource/csdk/logger/include',
env.get('SRC_DIR') + '/resource/csdk/include',
env.get('SRC_DIR') + '/resource/csdk/security/include',
env.get('SRC_DIR') + '/resource/csdk/stack/include',
env.get('SRC_DIR') + '/extlibs/cjson',
env.get('SRC_DIR') + '/service/easy-setup/inc',
env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'
'#/resource/include',
'#/resource/c_common',
'#/resource/c_common/oic_malloc/include',
'#/resource/c_common/oic_string/include',
'#/resource/oc_logger/include',
'#/resource/csdk/logger/include',
'#/resource/csdk/include',
'#/resource/csdk/security/include',
'#/resource/csdk/stack/include',
'#/extlibs/cjson',
'#/service/easy-setup/inc',
'#/service/easy-setup/enrollee/linux/wifi',
'#/service/easy-setup/enrollee/inc',
'#/service/easy-setup/enrollee/src',
])
enrollee_env.PrependUnique(LIBS=[
......
......@@ -34,8 +34,8 @@ env.ParseConfig(
)
env.AppendUnique(CPPFLAGS=[
'-fPIC', '-D__TIZEN__', '-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g',
'-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE', '-DTB_LOG', '`pkg-config',
'--cflags', '--libs', 'iotivity', 'dlog', 'capi-network-wifi',
'-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE',
'`pkg-config', '--cflags', '--libs', 'iotivity', 'dlog', 'capi-network-wifi',
'gobject-2.0', 'gio-2.0', 'gthread-2.0', 'glib-2.0`'
])
......
......@@ -18,6 +18,8 @@
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
import os
Import('env')
mediator_env = env.Clone()
......@@ -27,38 +29,35 @@ target_os = env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
mediator_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
if env.get('RELEASE'):
mediator_env.AppendUnique(CCFLAGS=['-Os'])
mediator_env.AppendUnique(CPPDEFINES=['NDEBUG'])
else:
mediator_env.AppendUnique(CCFLAGS=['-g'])
if env.get('LOGGING'):
env.AppendUnique(CPPDEFINES=['TB_LOG'])
env.AppendUnique(CPPDEFINES=['CPP_MEDIATOR'])
mediator_env.AppendUnique(CPPDEFINES=['CPP_MEDIATOR'])
if target_os not in ['windows']:
mediator_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
mediator_env.PrependUnique(CPPPATH=[
env.get('SRC_DIR') + '/resource/include',
env.get('SRC_DIR') + '/resource/oc_logger/include',
env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
env.get('SRC_DIR') + '/resource/csdk/include',
env.get('SRC_DIR') + '/resource/csdk/stack/include',
env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
env.get('SRC_DIR') +
'/resource/csdk/security/provisioning/include/internal',
env.get('SRC_DIR') + '/resource/csdk/logger/include',
env.get('SRC_DIR') + '/resource/csdk/security/include',
env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
env.get('SRC_DIR') + '/extlibs/cjson',
env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/inc',
env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/src',
env.get('SRC_DIR') + '/service/easy-setup/inc'
'#/resource/include',
'#/resource/oc_logger/include',
'#/resource/c_common',
'#/resource/c_common/ocrandom/include',
'#/resource/c_common/oic_malloc/include',
'#/resource/c_common/oic_string/include',
'#/resource/csdk/include',
'#/resource/csdk/stack/include',
'#/resource/csdk/security/provisioning/include',
'#/resource/csdk/security/provisioning/include/internal',
'#/resource/csdk/logger/include',
'#/resource/csdk/security/include',
'#/resource/csdk/connectivity/api',
'#/extlibs/cjson',
'#/service/easy-setup/mediator/richsdk/inc',
'#/service/easy-setup/mediator/richsdk/src',
'#/service/easy-setup/inc',
])
if env.get('SECURED') == '1':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment