scons changes for connectivity-abstraction branch
authorSashi Penta <sashi.kumar.penta@intel.com>
Tue, 23 Dec 2014 23:41:18 +0000 (15:41 -0800)
committerSashi Penta <sashi.kumar.penta@intel.com>
Wed, 24 Dec 2014 23:56:59 +0000 (15:56 -0800)
Change-Id: Ib433a03454ac543cfcf189e596778414377ffe2a
Signed-off-by: Sashi Penta <sashi.kumar.penta@intel.com>
auto_build.sh
resource/SConscript
resource/csdk/SConscript
resource/csdk/connectivity/SConscript [new file with mode: 0644]
resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript [new file with mode: 0644]
resource/csdk/libcoap-4.1.1/SConscript
resource/csdk/stack/samples/linux/SimpleClientServer/SConscript [new file with mode: 0644]
resource/examples/SConscript
resource/examples/ocicuc/SConscript

index efe7530..c2af2e1 100755 (executable)
@@ -39,11 +39,13 @@ function build()
                scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
        fi
 
+: '
        echo "*********** Build for arduino avr *************"
        scons TARGET_OS=arduino TARGET_ARCH=avr ARDUINO_HOME=$2 RELEASE=$3
 
        echo "*********** Build for arduino arm *************"
        scons TARGET_OS=arduino TARGET_ARCH=arm ARDUINO_HOME=$2 RELEASE=$3
+'
 
        if [ $(uname -s) = "Darwin" ]
        then
index fc82826..6c969c2 100644 (file)
@@ -8,8 +8,12 @@ Import('env')
 target_os = env.get('TARGET_OS')
 
 # Build libcoap
+SConscript('csdk/connectivity/lib/libcoap-4.1.1/SConscript')
 SConscript('csdk/libcoap/SConscript')
 
+# Build connectivity
+SConscript('csdk/connectivity/SConscript')
+
 # Build liboctbstack
 SConscript('csdk/SConscript')
 
@@ -22,5 +26,7 @@ if target_os != 'arduino':
 
        # Build examples
        SConscript('examples/SConscript')
+
+       SConscript('csdk/stack/samples/linux/SimpleClientServer/SConscript')
 else:
-       SConscript('csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript')
\ No newline at end of file
+       SConscript('csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript')
index 5df1507..e0d4801 100644 (file)
@@ -29,7 +29,9 @@ liboctbstack_env.PrependUnique(CPPPATH = [
                'occoap/include',
                'stack/include',
                'stack/include/internal',
-               '../oc_logger/include'
+               '../oc_logger/include',
+               'connectivity/inc',
+               'connectivity/api',
                ])
 
 if target_os not in ['arduino', 'windows', 'winrt']:
@@ -56,6 +58,8 @@ if target_os in ['darwin', 'ios']:
 if not env.get('RELEASE'):
        liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
+liboctbstack_env.AppendUnique(CPPDEFINES = ['CA_INT'])
+
 ######################################################################
 # Source files and Targets
 ######################################################################
diff --git a/resource/csdk/connectivity/SConscript b/resource/csdk/connectivity/SConscript
new file mode 100644 (file)
index 0000000..7cb81e2
--- /dev/null
@@ -0,0 +1,77 @@
+##
+# CA library (share library) build script
+##
+Import('env')
+
+# Add third party libraries
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
+
+calib_env = lib_env.Clone()
+######################################################################
+# Build flags
+######################################################################
+calib_env.AppendUnique(CPPPATH = [
+               './common/inc',
+               './api',
+               './inc',
+               './src/ethernet_adapter/linux',
+               './src/wifi_adapter/linux',
+               './src/bt_edr_adapter/linux',
+               './src/bt_le_adapter/linux',
+               './lib/libcoap-4.1.1'
+               ])
+
+target_os = env.get('TARGET_OS')
+
+if target_os not in ['windows', 'winrt']:
+       calib_env.AppendUnique(CFLAGS = ['-Wall', '-fPIC', '-fstack-protector-all']);
+       calib_env.AppendUnique(CPPDEFINES = [
+                       '__LINUX__', 'WITH_POSIX',
+                       'NO_EDR_ADAPTER', 'NO_LE_ADAPTER',
+                       'WIFI_ADAPTER', 'ETHERNET_ADAPTER',
+                       #'TB_LOG'
+                       ])
+
+calib_env.ParseConfig('pkg-config --cflags glib-2.0')
+
+#TODO add SConscript for libcoap
+#`/home/tester/iotivity/resource/csdk/connectivity/lib/libcoap-4.1.1'
+
+######################################################################
+# Source files and Targets
+######################################################################
+calib_src = [
+               './common/src/logger.c',
+               './common/src/oic_logger.c',
+               './common/src/oic_console_logger.c',
+               './common/src/oic_malloc.c',
+               './common/src/oic_string.c',
+               './common/src/uqueue.c',
+               './common/src/uarraylist.c',
+               './common/src/umutex.c',
+               './common/src/uthreadpool.c',
+               './src/caretransmission.c',
+               './src/caconnectivitymanager.c',
+               './src/caremotehandler.c',
+               './src/cainterfacecontroller.c',
+               './src/camessagehandler.c',
+               './src/caqueueingthread.c',
+               './src/canetworkconfigurator.c',
+               './src/caprotocolmessage.c',
+               './src/adapter_util/caadapterutils.c',
+               './src/ethernet_adapter/caethernetadapter.c',
+               './src/wifi_adapter/cawifiadapter.c',
+               './src/bt_edr_adapter/linux/caedradapter.c',
+               './src/bt_le_adapter/linux/caleadapter.c',
+               './src/wifi_adapter/linux/cawifiserver.c',
+               './src/wifi_adapter/linux/cawificlient.c',
+               './src/wifi_adapter/linux/cawifinwmonitor.c',
+               './src/ethernet_adapter/linux/caethernetserver.c',
+               './src/ethernet_adapter/linux/caethernetclient.c',
+               './src/ethernet_adapter/linux/caethernetnwmonitor.c'
+       ]
+
+calib = calib_env.SharedLibrary('connectivity_abstraction', calib_src)
+calib_env.InstallTarget(calib, 'libconnectivity_abstraction')
+
diff --git a/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript b/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript
new file mode 100644 (file)
index 0000000..91ef9a5
--- /dev/null
@@ -0,0 +1,77 @@
+##
+# libcoap (share library) build script
+##
+
+Import('env')
+
+libcoap_env = env.Clone()
+
+target_os = env.get('TARGET_OS')
+# As in the source code(C) includes arduino Time library head file(C++)
+# It requires compile the .c with g++
+if target_os == 'arduino':
+       libcoap_env.Replace(CC = env.get('CXX'))
+       libcoap_env.Replace(CFLAGS = env.get('CXXFLAGS'))
+
+######################################################################
+# Build flags
+######################################################################
+libcoap_env.PrependUnique(CPPPATH = [
+               '../ocsocket/include',
+               '../ocmalloc/include',
+               '../logger/include',
+               '../ocrandom/include',
+               '../stack',
+               '../../oc_logger/include'
+               ])
+
+if target_os not in ['arduino', 'windows', 'winrt']:
+       libcoap_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
+       libcoap_env.AppendUnique(CFLAGS = ['-std=gnu99', '-fPIC'])
+
+if target_os not in ['windows', 'winrt']:
+       libcoap_env.AppendUnique(CFLAGS = ['-Wall', '-ffunction-sections',
+                       '-fdata-sections', '-fno-exceptions'])
+
+if target_os == 'android':
+       libcoap_env.AppendUnique(LIBS = ['log'])
+
+if target_os == 'arduino':
+       libcoap_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
+
+if target_os in ['darwin', 'ios']:
+       libcoap_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+
+if not env.get('RELEASE'):
+       libcoap_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+######################################################################
+# Source files and Target(s)
+######################################################################
+libcoap_src = [
+       'pdu.c',
+       'net.c',
+       'debug.c',
+       'encode.c',
+       'uri.c',
+       'coap_list.c',
+       'resource.c',
+       'hashkey.c',
+    'str.c',
+       'option.c',
+       'async.c',
+       'subscribe.c',
+       'block.c',
+#      '../logger/src/logger.c',
+#      '../ocrandom/src/ocrandom.c',
+#      '../ocmalloc/src/ocmalloc.c',
+#      '../../oc_logger/c/oc_logger.c',
+#      '../../oc_logger/c/oc_console_logger.c'
+       ]
+
+if target_os == 'arduino':
+       libcoap = libcoap_env.StaticLibrary('libcoap', libcoap_src, OBJPREFIX='libcoap_')
+else:
+       libcoap = libcoap_env.SharedLibrary('libcoap', libcoap_src, OBJPREFIX='libcoap_')
+
+libcoap_env.InstallTarget(libcoap, 'libcoap')
index 7e1bdf1..778e191 100644 (file)
@@ -78,8 +78,8 @@ else:
        libcoap_src.append(['../ocsocket/src/ocsocket.c'])
 
 if target_os == 'arduino':
-       libcoap = libcoap_env.StaticLibrary('libcoap', libcoap_src, OBJPREFIX='libcoap_')
+       libcoap = libcoap_env.StaticLibrary('libcoap_csdk', libcoap_src, OBJPREFIX='libcoap_')
 else:
-       libcoap = libcoap_env.SharedLibrary('libcoap', libcoap_src, OBJPREFIX='libcoap_')
+       libcoap = libcoap_env.SharedLibrary('libcoap_csdk', libcoap_src, OBJPREFIX='libcoap_')
 
-libcoap_env.InstallTarget(libcoap, 'libcoap')
+libcoap_env.InstallTarget(libcoap, 'libcoap_csdk')
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript b/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
new file mode 100644 (file)
index 0000000..2429690
--- /dev/null
@@ -0,0 +1,65 @@
+
+Import('env')
+
+samples_env = env.Clone()
+######################################################################
+# Build flags
+######################################################################
+samples_env.PrependUnique(CPPPATH = [
+               '../../../../ocsocket/include',
+               '../../../../logger/include',
+               '../../../../stack/include',
+               '../../../../../../extlibs/cjson',
+               '../../../../../oc_logger/include'
+               ])
+
+target_os = env.get('TARGET_OS')
+if target_os not in ['windows', 'winrt']:
+       samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+
+       # Note: 'pthread' is in libc for android. On other platform, if use
+       # new gcc(>4.9?) it isn't required, otherwise, it's required
+       if target_os != 'android':
+               samples_env.AppendUnique(LIBS = ['-lpthread'])
+
+samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+samples_env.PrependUnique(LIBS = ['oc', 'm', 'octbstack', 'coap', 'coap_csdk', 'oc_logger', 'connectivity_abstraction'])
+
+samples_env.ParseConfig('pkg-config --libs glib-2.0');
+
+if target_os == 'android':
+       samples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+       samples_env.AppendUnique(LIBS = ['gnustl_static'])
+       samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
+
+       if not env.get('RELEASE'):
+               samples_env.AppendUnique(LIBS = ['log'])
+
+if target_os in ['darwin', 'ios']:
+       samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+
+samples_env.AppendUnique(CPPDEFINES = ['CA_INT'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+ocserver         = samples_env.Program('ocserver', 'ocserver.cpp')
+occlient         = samples_env.Program('occlient', 'occlient.cpp')
+#ocserverslow     = samples_env.Program('ocserverslow', 'ocserverslow.cpp')
+#occlientslow     = samples_env.Program('occlientslow', 'occlientslow.cpp')
+#ocservercoll     = samples_env.Program('ocservercoll', 'ocservercoll.cpp')
+#occlientcoll     = samples_env.Program('occlientcoll', 'occlientcoll.cpp')
+#ocserverbasicops = samples_env.Program('ocserverbasicops', 'ocserverbasicops.cpp')
+#occlientbasicops = samples_env.Program('occlientbasicops', 'occlientbasicops.cpp')
+
+Alias("samples", [ocserver, occlient,
+                               #ocservercoll, occlientcoll,
+                               #ocserverbasicops, occlientbasicops,
+                               #ocserverslow, occlientslow
+                ])
+
+env.AppendTarget('samples')
+
+#ios doesn't allow run application from terminal, so won't build these samples
+#if target_os != 'ios':
+#      SConscript('ocicuc/SConscript')
index 12a7dcc..91efac6 100644 (file)
@@ -31,7 +31,9 @@ if target_os not in ['windows', 'winrt']:
                examples_env.AppendUnique(LIBS = ['-lpthread'])
 
 examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-examples_env.PrependUnique(LIBS = ['oc', 'octbstack', 'coap', 'oc_logger'])
+examples_env.PrependUnique(LIBS = ['oc', 'octbstack', 'coap', 'coap_csdk', 'oc_logger', 'connectivity_abstraction'])
+
+examples_env.ParseConfig('pkg-config --libs glib-2.0');
 
 if target_os == 'android':
        examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
@@ -68,5 +70,5 @@ Alias("examples", [simpleserver, simpleserverHQ, simpleclient, simpleclientHQ,
 env.AppendTarget('examples')
 
 #ios doesn't allow run application from terminal, so won't build these examples
-if target_os != 'ios':
-       SConscript('ocicuc/SConscript')
+#if target_os != 'ios':
+#      SConscript('ocicuc/SConscript')
index 0b52b29..a4d8050 100644 (file)
@@ -20,7 +20,9 @@ ocicuc_env.AppendUnique(CPPPATH = [
                ])
 
 ocicuc_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-ocicuc_env.PrependUnique(LIBS = ['oc', 'octbstack', 'coap', 'oc_logger'])
+ocicuc_env.PrependUnique(LIBS = ['oc', 'octbstack', 'coap_csdk', 'coap', 'oc_logger', 'connectivity_abstraction'])
+
+ocicuc_env.ParseConfig('pkg-config --libs glib-2.0');
 
 target_os = env.get('TARGET_OS')
 if target_os not in ['windows', 'winrt']:
@@ -46,4 +48,4 @@ monoprocess = ocicuc_env.Program('monoprocess', ['monoprocess.cpp', 'driver.cpp'
 small_example = ocicuc_env.Program('small_example', ['small_example.cpp', 'driver.cpp', 'utility.cpp'])
 
 Alias("examples_ocicuc", [client, server, monoprocess, small_example])
-env.AppendTarget('examples_ocicuc')
\ No newline at end of file
+env.AppendTarget('examples_ocicuc')