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
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')
# 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')
'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']:
if not env.get('RELEASE'):
liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+liboctbstack_env.AppendUnique(CPPDEFINES = ['CA_INT'])
+
######################################################################
# Source files and Targets
######################################################################
--- /dev/null
+##
+# 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')
+
--- /dev/null
+##
+# 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')
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')
--- /dev/null
+
+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')
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'])
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')
])
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']:
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')