IOT-1583: Preparing SConscripts for /W3 and /WX changes.
authorPawel Winogrodzki <pawelwi@microsoft.com>
Wed, 1 Feb 2017 20:47:31 +0000 (12:47 -0800)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 10 Feb 2017 17:16:51 +0000 (17:16 +0000)
Initial commit making changes and small clean-up in SConscript
files to enable adding /W3 and /WX compiler options limited
to the resource/csdk/stack/ directory.

Changes made:
1. Building of stack's code moved to resource/csdk/stack/SConscript.
2. Turned extlibs/timer/ into a static lib, so that it doesn't compile
(and generate warnings) along with other modules' code.

Change-Id: I6c64916dbcfd23edb546d43db7b2470100528baa
Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16975
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
28 files changed:
build_common/windows/SConscript
extlibs/cjson/SConscript
extlibs/timer/SConscript
resource/SConscript
resource/csdk/SConscript
resource/csdk/connectivity/src/SConscript
resource/csdk/connectivity/test/SConscript
resource/csdk/logger/SConscript
resource/csdk/security/provisioning/unittest/SConscript
resource/csdk/security/tool/SConscript
resource/csdk/security/unittest/SConscript
resource/csdk/stack/SConscript [new file with mode: 0644]
resource/csdk/stack/octbstack_product.def [moved from resource/csdk/octbstack_product.def with 100% similarity]
resource/csdk/stack/octbstack_product_secured.def [moved from resource/csdk/octbstack_product_secured.def with 100% similarity]
resource/csdk/stack/octbstack_product_secured_mot.def [moved from resource/csdk/octbstack_product_secured_mot.def with 100% similarity]
resource/csdk/stack/octbstack_product_with_tcp.def [moved from resource/csdk/octbstack_product_with_tcp.def with 100% similarity]
resource/csdk/stack/samples/SConscript [new file with mode: 0644]
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
resource/csdk/stack/samples/linux/OCSample/SConscript [moved from resource/csdk/stack/test/linux/SConscript with 65% similarity]
resource/csdk/stack/samples/linux/OCSample/occlient.c [moved from resource/csdk/stack/test/linux/occlient.c with 100% similarity]
resource/csdk/stack/samples/linux/OCSample/ocserver.c [moved from resource/csdk/stack/test/linux/ocserver.c with 100% similarity]
resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
resource/csdk/stack/samples/linux/secure/SConscript
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
resource/csdk/stack/test/SConscript
resource/unittests/SConscript
service/coap-http-proxy/SConscript
service/simulator/ramlparser/SConscript

index d47680b..64053ea 100644 (file)
@@ -6,19 +6,6 @@ import os.path
 
 # Set common flags
 if env['CC'] == 'cl':
-
-    # TODO: re-enable warnings, especially: 4244, 4267, 4365
-    env.AppendUnique(CXXFLAGS=[
-        '/wd4244',   # C4244 conversion from one type to another type results in a possible loss of data.
-        '/wd4267',   # C4267 conversion from size_t to a smaller type.
-        '/wd4355',   # C4355 'this' used in base member initializer list.
-        '/wd4800',   # C4800 forcing value to bool 'true' or 'false'.
-        '/wd4996',   # C4996 deprecated declaration.
-        '/wd4820',   # C4820 added padding to the end of a struct.
-        '/wd4514',   # C4514 unreferenced inline function has been removed
-        '/wd4365',   # C4365 signed/unsigned mismatch
-        '/wd4503'])  # C4503 decorated name length exceeded, name was truncated
-
     # Enable warnings as errors.
     env.AppendUnique(CCFLAGS=[
         '/we4133'])  # C4133 incompatible type conversion
index 92126f3..7329925 100644 (file)
@@ -20,6 +20,6 @@
 
 Import('env')
 
-libcjson = env.StaticLibrary('cjsonLibrary', ['cJSON.c'])
-env.InstallTarget(libcjson, 'libCjson');
+libcjson = env.StaticLibrary('cjson', ['cJSON.c'], OBJPREFIX='libcjson_')
+env.InstallTarget(libcjson, 'cjson');
 
index 33d134a..21c406e 100644 (file)
 
 Import('env')
 
-timer_src = [ 'timer.c' ]
+timer_env = env.Clone()
 
-libtimer = env.StaticLibrary('timer', timer_src, OBJPREFIX='libtimer_')
-env.InstallTarget(libtimer, 'timer');
+# Required for arduino builds to have access to Timer.h.
+if timer_env.get('TARGET_OS') == 'arduino':
+    timer_env.Replace(CC = env.get('CXX'))
+    timer_env.Replace(CFLAGS = env.get('CXXFLAGS'))
 
+libtimer = timer_env.StaticLibrary('timer', ['timer.c'], OBJPREFIX='libtimer_')
+timer_env.InstallTarget(libtimer, 'timer');
index d501e8f..0e62a8d 100644 (file)
 Import('env')
 
 target_os = env.get('TARGET_OS')
-src_dir = env.get('SRC_DIR')
-rd_mode = env.get('RD_MODE')
 
 # Build C Common dependencies
 SConscript('c_common/SConscript')
 
-# Build liblogger
-SConscript('csdk/logger/SConscript')
-
 if target_os not in ['arduino', 'darwin', 'ios', 'android', 'msys_nt', 'windows']:
-       env.AppendUnique(LIBS=['rt'])
+    env.AppendUnique(LIBS=['rt'])
 
 # Download (if not already present) & build libcoap
 SConscript('#extlibs/libcoap/SConscript')
 
-# Build connectivity
-SConscript('csdk/connectivity/SConscript')
-
-if env.get('ROUTING') in ['GW', 'EP']:
-       # Build Routing
-       SConscript('csdk/routing/SConscript')
-
-if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
-    SConscript('csdk/resource-directory/SConscript')
+# Build timer library
+SConscript('#/extlibs/timer/SConscript')
 
-# Build liboctbstack
+# Build csdk
 SConscript('csdk/SConscript')
 
-if target_os not in ['arduino','darwin']:
-       # Build liboc_logger
-       SConscript('oc_logger/SConscript')
+if target_os not in ['arduino', 'darwin', 'ios']:
+    # Build liboc_logger
+    SConscript('oc_logger/SConscript')
 
-       # Build liboc
-       SConscript('src/SConscript')
+    # Build liboc
+    SConscript('src/SConscript')
 
 if target_os not in ['arduino','darwin','ios','android']:
-       # Build examples
-       SConscript('examples/SConscript')
-
-if target_os in ['linux', 'windows']:
-       # Build C Samples
-       SConscript('csdk/stack/test/linux/SConscript')
-       SConscript('csdk/stack/samples/linux/SimpleClientServer/SConscript')
-
-        if env.get('SECURED') == '1':
-               # Build secure samples
-               SConscript('csdk/stack/samples/linux/secure/SConscript')
-
-       # Build C/C++ unit tests
-       SConscript('unit_tests.scons')
-
-elif target_os == 'darwin':
-       env.Command('../../out/darwin/iotivity-csdk.framework',None,src_dir + '/tools/darwin/mkfwk_osx.sh')
-       # Build linux samples for now
-       SConscript('csdk/stack/samples/linux/SimpleClientServer/SConscript')
-
-       # Build C stack's unit tests.
-       SConscript('unit_tests.scons')
-
-elif target_os == 'arduino':
-       SConscript('csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript')
+    # Build examples
+    SConscript('examples/SConscript')
 
-elif target_os == 'msys_nt':
-       # Build secure samples. Using linux samples for now.
-       SConscript('csdk/stack/samples/linux/secure/SConscript')
+if target_os in ['linux', 'windows', 'darwin', 'msys_nt']:
+    if target_os == 'darwin':
+        env.Command('#/out/darwin/iotivity-csdk.framework', None, '#/tools/darwin/mkfwk_osx.sh')
 
-       # Build C/C++ unit tests
-       SConscript('unit_tests.scons')
+    # Build C/C++ unit tests
+    SConscript('unit_tests.scons')
index 8b6f2b1..5ed927d 100644 (file)
 ##
 Import('env')
 
-# Build libocsrm
-SConscript('security/SConscript')
-
-liboctbstack_env = env.Clone()
-
 target_os = env.get('TARGET_OS')
 rd_mode = env.get('RD_MODE')
-with_ra = env.get('WITH_RA')
-with_ra_ibb = env.get('WITH_RA_IBB')
-with_tcp = env.get('WITH_TCP')
-with_mq = env.get('WITH_MQ')
-# As in the source code, it includes arduino Time library (C++)
-# It requires compile the .c with g++
-if target_os == 'arduino':
-       liboctbstack_env.Replace(CC = env.get('CXX'))
-       liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
-
-######################################################################
-# Build flags
-######################################################################
-with_upstream_libcoap = liboctbstack_env.get('WITH_UPSTREAM_LIBCOAP')
-if with_upstream_libcoap == '1':
-       # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
-       liboctbstack_env.PrependUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
-else:
-       # For bring up purposes only, the forked version will live here.
-       liboctbstack_env.PrependUnique(CPPPATH = ['connectivity/lib/libcoap-4.1.1/include'])
-
-liboctbstack_env.PrependUnique(CPPPATH = [
-               '../../extlibs/timer/',
-               'logger/include',
-               'include',
-               'stack/include',
-               'stack/include/internal',
-               '../oc_logger/include',
-               'connectivity/common/inc',
-               'connectivity/inc',
-               'connectivity/inc/pkix',
-               'connectivity/api',
-               'connectivity/external/inc',
-               'security/include',
-               'security/include/internal',
-               'security/provisioning/include',
-               ])
-
-if 'SUB' in with_mq:
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
-if 'PUB' in with_mq:
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
-if 'BROKER' in with_mq:
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
-
-if target_os not in ['arduino', 'windows']:
-       liboctbstack_env.AppendUnique(CPPDEFINES  = ['WITH_POSIX', '_GNU_SOURCE'])
-       liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
-
-if liboctbstack_env.get('ROUTING') == 'GW':
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
-elif liboctbstack_env.get('ROUTING') == 'EP':
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
-
-if target_os not in ['windows']:
-       liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
-
-liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-
-liboctbstack_env.PrependUnique(LIBS = ['ocsrm', 'coap'])
-
-if target_os in ['linux'] and liboctbstack_env.get('SIMULATOR', False):
-       liboctbstack_env.Append( RPATH = liboctbstack_env.Literal('\\$$ORIGIN'))
-
-if env.get('SECURED') == '1':
-       liboctbstack_env.AppendUnique(LIBS = ['tinydtls'])
-       liboctbstack_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
-
-if target_os in ['android', 'linux', 'tizen', 'msys_nt', 'windows']:
-       liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction'])
 
-       if with_ra_ibb:
-               liboctbstack_env.AppendUnique(LIBS = liboctbstack_env['RALIBS'], LIBPATH = liboctbstack_env['RALIBPATH'], RPATH = liboctbstack_env['RARPATH'])
-       else :
-               if with_ra:
-                       liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
 
-if target_os not in ['windows', 'msys_nt']:
-       liboctbstack_env.AppendUnique(LIBS = ['m'])
-else:
-       # octbstack.def specifies the list of functions exported by octbstack.dll.
-       liboctbstack_env.Replace(WINDOWS_INSERT_DEF = ['1'])
 
-       if env.get('SECURED') != '1':
-               liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_product.def')])
-       else:
-               # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
-               liboctbstack_env.PrependUnique(LIBS = ['ocpmapi'])
+# Build liblogger
+SConscript('logger/SConscript')
 
-               if with_tcp == True:
-                       liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def'), File('octbstack_product_with_tcp.def')])
-               else:
-                       liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def')])
+# Build connectivity
+SConscript('connectivity/SConscript')
 
-               if env.get('MULTIPLE_OWNER') == '1':
-                       liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def'), File('octbstack_product_secured_mot.def')])
-               else:
-                       liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def')])
-
-if target_os in ['tizen', 'linux']:
-       liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid")
-       liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
-
-if target_os == 'arduino':
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
-elif target_os not in ['darwin','ios', 'msys_nt', 'windows']:
-       liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
-if target_os in ['darwin', 'ios']:
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
-       liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-if target_os not in ['arduino', 'windows']:
-       liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
-if target_os == 'android':
-       liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,liboctbstack.so'])
-
-if env.get('LOGGING'):
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
-
-liboctbstack_env.Append(LIBS = ['c_common'])
-
-if liboctbstack_env.get('ROUTING') in ['GW', 'EP']:
-       liboctbstack_env.Prepend(LIBS = ['routingmanager'])
+if env.get('ROUTING') in ['GW', 'EP']:
+    # Build Routing
+    SConscript('routing/SConscript')
 
 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
-       liboctbstack_env.PrependUnique(CPPPATH = ['resource-directory/include'])
-       if 'CLIENT' in rd_mode:
-               liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
-       if 'SERVER' in rd_mode:
-               liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
-               if target_os in ['tizen']:
-                       liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
-               else:
-                       liboctbstack_env.AppendUnique(CPPPATH = ['#extlibs/sqlite3'])
-
-######################################################################
-# Source files and Targets
-######################################################################
-OCTBSTACK_SRC = 'stack/src/'
-liboctbstack_src = [
-       '../../extlibs/timer/timer.c',
-       OCTBSTACK_SRC + 'ocstack.c',
-       OCTBSTACK_SRC + 'ocpayload.c',
-       OCTBSTACK_SRC + 'ocpayloadparse.c',
-       OCTBSTACK_SRC + 'ocpayloadconvert.c',
-       OCTBSTACK_SRC + 'occlientcb.c',
-       OCTBSTACK_SRC + 'ocresource.c',
-       OCTBSTACK_SRC + 'ocobserve.c',
-       OCTBSTACK_SRC + 'ocserverrequest.c',
-       OCTBSTACK_SRC + 'occollection.c',
-       OCTBSTACK_SRC + 'oicgroup.c',
-       OCTBSTACK_SRC + 'ocendpoint.c'
-       ]
-
-if with_tcp == True:
-       liboctbstack_src.append(OCTBSTACK_SRC + 'oickeepalive.c')
+    SConscript('resource-directory/SConscript')
 
-if 'SERVER' in rd_mode:
-    liboctbstack_src.append(OCTBSTACK_SRC + 'oicresourcedirectory.c')
-    if target_os not in ['linux', 'tizen']:
-        liboctbstack_src.append('#extlibs/sqlite3/sqlite3.c')
-
-if target_os in ['linux']:
-    # Linux uses a Shared library because SCons chooses the shared library on Linux
-    # when only 'octbstack' is added to the LIBS.
-    # TODO: Switch Linux to use a Static library for testing like every other OS.
-    test_liboctbstack = liboctbstack_env.SharedLibrary('octbstack_test', liboctbstack_src)
-else:
-    test_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_test', liboctbstack_src)
-
-octbstack_libs = Flatten(test_liboctbstack)
-
-if target_os in ['windows', 'msys_nt']:
-       # Avoid a name conflict with the octbstack.lib target of the SharedLibrary.
-       static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_static', liboctbstack_src)
-else:
-       static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
-
-octbstack_libs += Flatten(static_liboctbstack)
-
-if target_os not in ['arduino','darwin','ios'] :
-       shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
-       octbstack_libs += Flatten(shared_liboctbstack)
-       liboctbstack_env.UserInstallTargetHeader('stack/include/ocstack.h', 'resource', 'ocstack.h')
-       liboctbstack_env.UserInstallTargetHeader('stack/include/ocpresence.h', 'resource', 'ocpresence.h')
+# Build libocsrm
+SConscript('security/SConscript')
 
-liboctbstack_env.InstallTarget(octbstack_libs, 'octbstack')
-liboctbstack_env.UserInstallTargetLib(octbstack_libs, 'octbstack')
+# Build liboctbstack
+SConscript('stack/SConscript')
 
-liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h')
-liboctbstack_env.UserInstallTargetHeader('include/octypes.h', 'resource', 'octypes.h')
-liboctbstack_env.UserInstallTargetHeader('stack/include/ocpayload.h', 'resource', 'ocpayload.h')
+env.UserInstallTargetHeader('include/octypes.h', 'resource', 'octypes.h')
index b3274d1..1aa6ad7 100644 (file)
@@ -66,9 +66,8 @@ if (('BLE' in ca_transport) or ('ALL' in ca_transport)):
                                           'adapter_util/cafragmentation.c')])
 
 if env.get('SECURED') == '1':
-       env.SConscript(build_dir + 'extlibs/tinydtls/SConscript')
+       SConscript('#/extlibs/tinydtls/SConscript')
        env.AppendUnique(CPPPATH = ['#extlibs/tinydtls'])
-       env.SConscript(build_dir + 'extlibs/timer/SConscript')
        env.AppendUnique(CPPPATH = ['#extlibs/timer'])
        env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/security/include'])
        env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
@@ -198,24 +197,18 @@ if env.get('LOGGING'):
 if ca_os == 'android':
        lib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libconnectivity_abstraction.so'])
 
+if lib_env.get('SECURED') == '1':
+       lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto', 'timer'])
+
 if ca_os in ['android', 'tizen', 'linux', 'yocto']:
        lib_env.AppendUnique(LIBS = ['coap'])
-       if lib_env.get('SECURED') == '1':
-               lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
-               lib_env.AppendUnique(LIBS = ['timer'])
        if ca_os != 'android':
                lib_env.AppendUnique(LIBS = ['rt'])
-               if ((lib_env.get('SECURED') == '1') and ((lib_env.get('WITH_TCP')) or (lib_env.get('WITH_CLOUD')))):
-                       lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
-                       lib_env.AppendUnique(LIBS = ['timer'])
        static_calib = lib_env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
        shared_calib = lib_env.SharedLibrary('connectivity_abstraction', lib_env.get('CA_SRC'))
        calib = Flatten([static_calib, shared_calib])
 elif ca_os in ['msys_nt', 'windows']:
        lib_env.AppendUnique(LIBS = ['coap', 'mswsock', 'ws2_32', 'iphlpapi', 'logger'])
-       if lib_env.get('SECURED') == '1':
-               lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
-               lib_env.AppendUnique(LIBS = ['timer'])
        calib = lib_env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
 else:
        calib = lib_env.StaticLibrary('connectivity_abstraction', lib_env.get('CA_SRC'))
index 8afe26b..a266b5f 100644 (file)
@@ -42,8 +42,8 @@ catest_env.PrependUnique(CPPPATH = [
 
 catest_env.AppendUnique(LIBPATH = [catest_env.get('BUILD_DIR')])
 catest_env.PrependUnique(LIBS = ['octbstack_test',
-                                    'connectivity_abstraction',
-                                    'coap'])
+                                 'connectivity_abstraction',
+                                 'coap'])
 
 if target_os not in ['arduino', 'darwin', 'ios', 'msys_nt', 'windows']:
        catest_env.AppendUnique(LIBS=['rt'])
@@ -60,6 +60,8 @@ if catest_env.get('LOGGING'):
 if target_os not in ['msys_nt', 'windows']:
        catest_env.AppendUnique(LIBS = ['m'])
 
+catest_env.AppendUnique(LIBS = ['timer'])
+
 ######################################################################
 # Source files and Targets
 ######################################################################
index e3e4c12..5c04868 100644 (file)
@@ -1,16 +1,18 @@
 Import('env')
 import os
 
+build_dir = env.get('BUILD_DIR')
+
 env.AppendUnique(CPPPATH = [os.path.join(Dir('.').abspath, 'include'),
-                            '../../c_common'
+                            os.path.join('#', 'resource', 'c_common')
     ])
 
 if env.get('TARGET_OS') in ['arduino']:
-       env.AppendUnique(CPPPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common/oic_string/include')])
+       env.AppendUnique(CPPPATH = [os.path.join(build_dir, 'resource', 'c_common', 'oic_string', 'include')])
 if env.get('TARGET_OS') == 'tizen':
-       env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+       env.AppendUnique(LIBPATH = [build_dir])
 else:
-       env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk', 'logger')])
+       env.AppendUnique(LIBPATH = [os.path.join(build_dir, 'resource', 'csdk', 'logger')])
 
 env.PrependUnique(LIBS = ['logger'])
 
index 264ce6f..ac6aa2c 100644 (file)
@@ -89,6 +89,8 @@ else:
 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
        sptest_env.PrependUnique(LIBS = ['resource_directory'])
 
+sptest_env.AppendUnique(LIBS = ['timer'])
+
 ######################################################################
 # Source files and Targets
 ######################################################################
index baeedfe..501ab14 100644 (file)
@@ -35,7 +35,7 @@ else:
     # For bring up purposes only, the forked version will live here.
     tools_env.AppendUnique(CPPPATH = ['../../connectivity/lib/libcoap-4.1.1/include'])
 
-tools_env.PrependUnique(CPPPATH = ['../../../../extlibs/cjson',
+tools_env.PrependUnique(CPPPATH = ['#/extlibs/cjson',
                                   '../../include',
                                   '../../stack/include',
                                   '../../stack/include/internal',
@@ -50,7 +50,7 @@ tools_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'
 tools_env.AppendUnique(LIBPATH = [tools_env.get('BUILD_DIR')])
 tools_env.AppendUnique(RPATH = [tools_env.get('BUILD_DIR')])
 
-tools_env.PrepareLib('cjson')
+SConscript('#/extlibs/cjson/SConscript')
 
 if target_os in ['msys_nt', 'windows']:
     # octbstack.dll doesn't export all the functions called by this app, so use static LIBs instead.
@@ -62,7 +62,8 @@ elif target_os in ['darwin']:
 else:
     tools_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'm'])
 
-tools_env.PrependUnique(LIBS = ['cjsonLibrary'])
+tools_env.PrependUnique(LIBS = ['cjson'])
+tools_env.AppendUnique(LIBS = ['timer'])
 
 ######################################################################
 # Source files and Targets
index 8a79bc6..fa2cf4a 100644 (file)
@@ -85,6 +85,8 @@ else:
 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
        srmtest_env.PrependUnique(LIBS = ['resource_directory'])
 
+srmtest_env.AppendUnique(LIBS = ['timer'])
+
 ######################################################################
 # Source files and Targets
 ######################################################################
diff --git a/resource/csdk/stack/SConscript b/resource/csdk/stack/SConscript
new file mode 100644 (file)
index 0000000..04d99bd
--- /dev/null
@@ -0,0 +1,223 @@
+#******************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+##
+# liboctbstack (share library) build script
+##
+Import('env')
+
+liboctbstack_env = env.Clone()
+
+# Build C Samples
+SConscript('samples/SConscript', exports = { 'stacksamples_env' : liboctbstack_env })
+
+SConscript('#resource/third_party_libs.scons', exports = { 'lib_env' : liboctbstack_env })
+
+target_os = env.get('TARGET_OS')
+rd_mode = env.get('RD_MODE')
+with_ra = env.get('WITH_RA')
+with_ra_ibb = env.get('WITH_RA_IBB')
+with_tcp = env.get('WITH_TCP')
+with_mq = env.get('WITH_MQ')
+# As in the source code, it includes arduino Time library (C++)
+# It requires compile the .c with g++
+if target_os == 'arduino':
+    liboctbstack_env.Replace(CC = env.get('CXX'))
+    liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
+
+######################################################################
+# Build flags
+######################################################################
+with_upstream_libcoap = liboctbstack_env.get('WITH_UPSTREAM_LIBCOAP')
+if with_upstream_libcoap == '1':
+    # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
+    liboctbstack_env.PrependUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+else:
+    # For bring up purposes only, the forked version will live here.
+    liboctbstack_env.PrependUnique(CPPPATH = ['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+
+liboctbstack_env.PrependUnique(CPPPATH = [
+        '#/extlibs/timer/',
+        '#resource/csdk/logger/include',
+        '#resource/csdk/include',
+        'include',
+        'include/internal',
+        '#resource/oc_logger/include',
+        '#resource/csdk/connectivity/common/inc',
+        '#resource/csdk/connectivity/inc',
+        '#resource/csdk/connectivity/inc/pkix',
+        '#resource/csdk/connectivity/api',
+        '#resource/csdk/connectivity/external/inc',
+        '#resource/csdk/security/include',
+        '#resource/csdk/security/include/internal',
+        '#resource/csdk/security/provisioning/include',
+        ])
+
+if 'SUB' in with_mq:
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+if 'PUB' in with_mq:
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+if 'BROKER' in with_mq:
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+
+if target_os not in ['arduino', 'windows']:
+    liboctbstack_env.AppendUnique(CPPDEFINES  = ['WITH_POSIX', '_GNU_SOURCE'])
+    liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
+
+if liboctbstack_env.get('ROUTING') == 'GW':
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+elif liboctbstack_env.get('ROUTING') == 'EP':
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
+
+if target_os not in ['windows']:
+    liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
+
+liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+
+liboctbstack_env.PrependUnique(LIBS = ['ocsrm', 'coap', 'timer'])
+
+if target_os in ['linux'] and liboctbstack_env.get('SIMULATOR', False):
+    liboctbstack_env.Append( RPATH = liboctbstack_env.Literal('\\$$ORIGIN'))
+
+if env.get('SECURED') == '1':
+    liboctbstack_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto', 'tinydtls'])
+
+if target_os in ['android', 'linux', 'tizen', 'msys_nt', 'windows']:
+    liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction'])
+
+    if with_ra_ibb:
+        liboctbstack_env.AppendUnique(LIBS = liboctbstack_env['RALIBS'], LIBPATH = liboctbstack_env['RALIBPATH'], RPATH = liboctbstack_env['RARPATH'])
+    else :
+        if with_ra:
+            liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
+
+if target_os not in ['windows', 'msys_nt']:
+    liboctbstack_env.AppendUnique(LIBS = ['m'])
+else:
+    # octbstack.def specifies the list of functions exported by octbstack.dll.
+    liboctbstack_env.Replace(WINDOWS_INSERT_DEF = ['1'])
+
+    if env.get('SECURED') != '1':
+        liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_product.def')])
+    else:
+        # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
+        liboctbstack_env.PrependUnique(LIBS = ['ocpmapi'])
+
+        if with_tcp == True:
+            liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def'), File('octbstack_product_with_tcp.def')])
+        else:
+            liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def')])
+
+        if env.get('MULTIPLE_OWNER') == '1':
+            liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def'), File('octbstack_product_secured_mot.def')])
+        else:
+            liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def')])
+
+if target_os in ['tizen', 'linux']:
+    liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid")
+    liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
+
+if target_os == 'arduino':
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
+elif target_os not in ['darwin','ios', 'msys_nt', 'windows']:
+    liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
+if target_os in ['darwin', 'ios']:
+    env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+    liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+if target_os not in ['arduino', 'windows']:
+    liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+if target_os == 'android':
+    liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,liboctbstack.so'])
+
+if env.get('LOGGING'):
+    liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+liboctbstack_env.Append(LIBS = ['c_common'])
+
+if liboctbstack_env.get('ROUTING') in ['GW', 'EP']:
+    liboctbstack_env.Prepend(LIBS = ['routingmanager'])
+
+if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
+    liboctbstack_env.PrependUnique(CPPPATH = ['#resource/csdk/resource-directory/include'])
+    if 'CLIENT' in rd_mode:
+        liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+    if 'SERVER' in rd_mode:
+        liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
+        if target_os in ['tizen']:
+            liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
+        else:
+            liboctbstack_env.AppendUnique(CPPPATH = ['#extlibs/sqlite3'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+OCTBSTACK_SRC = 'src/'
+liboctbstack_src = [
+    OCTBSTACK_SRC + 'ocstack.c',
+    OCTBSTACK_SRC + 'ocpayload.c',
+    OCTBSTACK_SRC + 'ocpayloadparse.c',
+    OCTBSTACK_SRC + 'ocpayloadconvert.c',
+    OCTBSTACK_SRC + 'occlientcb.c',
+    OCTBSTACK_SRC + 'ocresource.c',
+    OCTBSTACK_SRC + 'ocobserve.c',
+    OCTBSTACK_SRC + 'ocserverrequest.c',
+    OCTBSTACK_SRC + 'occollection.c',
+    OCTBSTACK_SRC + 'oicgroup.c',
+    OCTBSTACK_SRC + 'ocendpoint.c'
+    ]
+
+if with_tcp == True:
+    liboctbstack_src.append(OCTBSTACK_SRC + 'oickeepalive.c')
+
+if 'SERVER' in rd_mode:
+    liboctbstack_src.append(OCTBSTACK_SRC + 'oicresourcedirectory.c')
+    if target_os not in ['linux', 'tizen']:
+        liboctbstack_src.append('#extlibs/sqlite3/sqlite3.c')
+
+if target_os in ['linux']:
+    # Linux uses a Shared library because SCons chooses the shared library on Linux
+    # when only 'octbstack' is added to the LIBS.
+    # TODO: Switch Linux to use a Static library for testing like every other OS.
+    test_liboctbstack = liboctbstack_env.SharedLibrary('octbstack_test', liboctbstack_src)
+else:
+    test_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_test', liboctbstack_src)
+
+octbstack_libs = Flatten(test_liboctbstack)
+
+if target_os in ['windows', 'msys_nt']:
+    # Avoid a name conflict with the octbstack.lib target of the SharedLibrary.
+    static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_static', liboctbstack_src)
+else:
+    static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
+
+octbstack_libs += Flatten(static_liboctbstack)
+
+if target_os not in ['arduino','darwin','ios'] :
+    shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
+    octbstack_libs += Flatten(shared_liboctbstack)
+    liboctbstack_env.UserInstallTargetHeader('include/ocstack.h', 'resource', 'ocstack.h')
+    liboctbstack_env.UserInstallTargetHeader('include/ocpresence.h', 'resource', 'ocpresence.h')
+
+liboctbstack_env.InstallTarget(octbstack_libs, 'octbstack')
+liboctbstack_env.UserInstallTargetLib(octbstack_libs, 'octbstack')
+
+liboctbstack_env.UserInstallTargetHeader('include/ocstackconfig.h', 'resource', 'ocstackconfig.h')
+liboctbstack_env.UserInstallTargetHeader('include/ocpayload.h', 'resource', 'ocpayload.h')
diff --git a/resource/csdk/stack/samples/SConscript b/resource/csdk/stack/samples/SConscript
new file mode 100644 (file)
index 0000000..b73f3a6
--- /dev/null
@@ -0,0 +1,40 @@
+#******************************************************************
+#
+# Copyright 2017 Microsoft
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('stacksamples_env')
+
+target_os = stacksamples_env.get('TARGET_OS')
+
+if target_os in ['linux', 'windows']:
+    # Build C Samples
+    SConscript('linux/OCSample/SConscript', 'stacksamples_env')
+    SConscript('linux/SimpleClientServer/SConscript', 'stacksamples_env')
+
+    if stacksamples_env.get('SECURED') == '1':
+        # Build secure samples
+        SConscript('linux/secure/SConscript', 'stacksamples_env')
+elif target_os == 'darwin':
+    # Build linux samples for now
+    SConscript('linux/SimpleClientServer/SConscript', 'stacksamples_env')
+elif target_os == 'arduino':
+    SConscript('arduino/SimpleClientServer/ocserver/SConscript', 'stacksamples_env')
+elif target_os == 'msys_nt':
+    # Build secure samples. Using linux samples for now.
+    SConscript('linux/secure/SConscript', 'stacksamples_env')
index 2c2a75b..a733b86 100644 (file)
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-Import('env')
+Import('stacksamples_env')
 
-transport = env.get('TARGET_TRANSPORT')
+arduino_simplecs_env = stacksamples_env.Clone()
+transport = arduino_simplecs_env.get('TARGET_TRANSPORT')
 
-arduino_simplecs_env = env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
@@ -33,25 +33,25 @@ arduino_simplecs_env.PrependUnique(CPPPATH = [
                '../../../../../../oc_logger/include'
                ])
 
-arduino_simplecs_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+arduino_simplecs_env.AppendUnique(LIBPATH = [arduino_simplecs_env.get('BUILD_DIR')])
 arduino_simplecs_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
-arduino_simplecs_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction','coap'])
+arduino_simplecs_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction','coap', 'timer'])
 
 arduino_simplecs = arduino_simplecs_env.Program('SimpleClientServer', 'ocserver.cpp')
-env.CreateBin('SimpleClientServer')
+arduino_simplecs_env.CreateBin('SimpleClientServer')
 
-i_arduino_simplecs = arduino_simplecs_env.Install(env.get('BUILD_DIR'), arduino_simplecs)
+i_arduino_simplecs = arduino_simplecs_env.Install(arduino_simplecs_env.get('BUILD_DIR'), arduino_simplecs)
 
 #The map file is intermediate file, make sure it's removed when clean build
 arduino_simplecs_env.Clean(arduino_simplecs, 'SimpleClientServer.map')
 
 Alias('arduino_simplecs', i_arduino_simplecs)
-env.AppendTarget('arduino_simplecs')
+arduino_simplecs_env.AppendTarget('arduino_simplecs')
 
 if(arduino_simplecs_env['UPLOAD'] == True):
        from sys import platform as _platform
        if _platform == "linux" or _platform == "linux2":
-               arduino_simplecs_env.Upload(env.get('BUILD_DIR') + '/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SimpleClientServer.hex')
+               arduino_simplecs_env.Upload(arduino_simplecs_env.get('BUILD_DIR') + '/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SimpleClientServer.hex')
        else:
                print 'Please use appropriate install method for your developing machine. Linux is the only supported platform right now.'
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-Import('env')
-csdktest_env = env.Clone()
+Import('stacksamples_env')
+ocsample_env = stacksamples_env.Clone()
 
 ######################################################################
 # Build flags
 ######################################################################
-csdktest_env.PrependUnique(CPPPATH = [
-    '../../../include',
-    '../../../stack/include',
+ocsample_env.PrependUnique(CPPPATH = [
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
 ])
 
-csdktest_env.PrependUnique(LIBS = [
-    'octbstack', 'connectivity_abstraction'
+ocsample_env.PrependUnique(LIBS = [
+    'octbstack',
+    'connectivity_abstraction'
 ])
-if env.get('SECURED') == '1':
-       if env.get('WITH_TCP') == True:
-               csdktest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
+if ocsample_env.get('SECURED') == '1':
+       if ocsample_env.get('WITH_TCP') == True:
+               ocsample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
 
-csdktest_env.AppendUnique(LIBPATH = [
-    csdktest_env.get('BUILD_DIR'),
+ocsample_env.AppendUnique(LIBPATH = [
+    ocsample_env.get('BUILD_DIR'),
 ])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-occlient = csdktest_env.Program('occlient', ['occlient.c'])
-ocserver = csdktest_env.Program('ocserver', ['ocserver.c'])
+occlient = ocsample_env.Program('occlient', ['occlient.c'])
+ocserver = ocsample_env.Program('ocserver', ['ocserver.c'])
index eca3886..4d8bc9e 100644 (file)
 # limitations under the License.
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-Import('env')
 
-samples_env = env.Clone()
+Import('stacksamples_env')
+
+samples_env = stacksamples_env.Clone()
 SConscript('#build_common/thread.scons', exports={'thread_env': samples_env})
 
 target_os = samples_env.get('TARGET_OS')
@@ -66,8 +67,7 @@ if target_os not in ['windows']:
 if samples_env.get('SECURED') == '1':
     samples_env.AppendUnique(LIBS=['tinydtls'])
 
-if target_os in ['windows']:
-    samples_env.AppendUnique(LIBS=['ws2_32'])
+samples_env.AppendUnique(LIBS = ['timer'])
 
 samples_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
index 37f3b08..18ac0a6 100644 (file)
@@ -18,9 +18,9 @@
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-Import('env')
+Import('stacksamples_env')
 
-samples_env = env.Clone()
+samples_env = stacksamples_env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
@@ -33,7 +33,7 @@ samples_env.PrependUnique(CPPPATH = [
                '../../../../../oc_logger/include'
                ])
 
-target_os = env.get('TARGET_OS')
+target_os = samples_env.get('TARGET_OS')
 if target_os not in ['windows']:
        samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
 
@@ -42,13 +42,13 @@ if target_os not in ['windows']:
                samples_env.AppendUnique(LIBS = ['pthread'])
        samples_env.Append(LINKFLAGS = ['-Wl,--no-as-needed'])
 
-samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+samples_env.AppendUnique(LIBPATH = [samples_env.get('BUILD_DIR')])
 if target_os in ['windows', 'msys_nt']:
        samples_env.PrependUnique(LIBS = ['ocsrm', 'ws2_32', 'iphlpapi'])
 else:
        samples_env.PrependUnique(LIBS = ['m'])
 samples_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'coap'])
-if env.get('SECURED') == '1':
+if samples_env.get('SECURED') == '1':
        samples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
 
 
@@ -57,7 +57,7 @@ if target_os == 'android':
        samples_env.AppendUnique(LIBS = ['gnustl_shared'])
        samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
 
-       if not env.get('RELEASE'):
+       if not samples_env.get('RELEASE'):
                samples_env.AppendUnique(LIBS = ['log'])
 
 if target_os in ['darwin', 'ios']:
@@ -72,17 +72,17 @@ samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 ocserverbasicops = samples_env.Program('ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
 occlientbasicops = samples_env.Program('occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
 ocamsservice = samples_env.Program('ocamsservice', ['common.cpp', 'ocamsservice.cpp'])
-if env.get('SECURED') == '1':
+if samples_env.get('SECURED') == '1':
        occlientdirectpairing = samples_env.Program('occlientdirectpairing', 'occlientdirectpairing.cpp')
        Alias("samples", [ocserverbasicops, occlientbasicops, ocamsservice, occlientdirectpairing])
 else:
        Alias("samples", [ocserverbasicops, occlientbasicops, ocamsservice])
 
-env.AppendTarget('samples')
+samples_env.AppendTarget('samples')
 
 src_dir = samples_env.get('SRC_DIR')
 sec_samples_src_dir = src_dir + '/resource/csdk/stack/samples/linux/secure/'
-sec_samples_build_dir = env.get('BUILD_DIR') +'/resource/csdk/stack/samples/linux/secure'
+sec_samples_build_dir = samples_env.get('BUILD_DIR') +'/resource/csdk/stack/samples/linux/secure'
 
 samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
     sec_samples_src_dir + 'oic_svr_db_server.json'))
@@ -92,7 +92,7 @@ samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
     sec_samples_src_dir + 'oic_svr_db_client_nondevowner.json'))
 samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
     sec_samples_src_dir + 'oic_amss_db.json'))
-if env.get('SECURED') == '1':
+if samples_env.get('SECURED') == '1':
        samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
                sec_samples_src_dir + 'oic_svr_db_client_directpairing.json'))
        samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
index 9ae9c61..e55b271 100644 (file)
@@ -69,7 +69,7 @@ scons %{JOB} --prefix=%{_prefix} \
 mkdir -p %{DEST_INC_DIR}
 mkdir -p %{DEST_LIB_DIR}/pkgconfig
 
-cp -f %{ROOTDIR}/resource/csdk/liboctbstack.so %{buildroot}/%{_libdir}
+cp -f %{ROOTDIR}/resource/csdk/stack/liboctbstack.so %{buildroot}/%{_libdir}
 cp -f %{ROOTDIR}/resource/c_common/libc_common.a %{buildroot}/%{_libdir}
 cp -f %{ROOTDIR}/resource/csdk/security/libocsrm.a %{buildroot}/%{_libdir}
 cp -f %{ROOTDIR}/resource/csdk/connectivity/src/libconnectivity_abstraction.so %{buildroot}/%{_libdir}
index d534c2c..ed3d2e6 100644 (file)
@@ -55,8 +55,7 @@ if target_os != 'darwin':
     stacktest_env.PrependUnique(LIBS = ['oc_logger'])
 
 if stacktest_env.get('SECURED') == '1':
-       stacktest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
-       stacktest_env.AppendUnique(LIBS = ['tinydtls'])
+       stacktest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto', 'tinydtls'])
 
 if stacktest_env.get('LOGGING'):
        stacktest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
@@ -67,6 +66,7 @@ if target_os not in ['msys_nt', 'windows']:
 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
        stacktest_env.PrependUnique(LIBS = ['resource_directory'])
 
+stacktest_env.AppendUnique(LIBS = ['timer'])
 ######################################################################
 # Source files and Targets
 ######################################################################
index 710c18f..e6d27be 100644 (file)
@@ -61,8 +61,8 @@ unittests_env.PrependUnique(LIBS = [
                'octbstack_test',
                'oc_logger',
                'connectivity_abstraction',
-               'coap'
-               ])
+               'coap',
+               'timer'])
 
 if unittests_env.get('SECURED') == '1':
        unittests_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
index 3434b85..d1407b8 100644 (file)
@@ -54,9 +54,9 @@ if with_upstream_libcoap == '1':
     env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
 else:
     env.AppendUnique(CPPPATH = ['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
-local_env.PrepareLib('cjson')
+SConscript('#/extlibs/cjson/SConscript')
 
-local_env.PrependUnique(LIBS = ['cjsonLibrary', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
+local_env.PrependUnique(LIBS = ['cjson', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
 if target_os not in ['windows']:
     local_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
 
index 5eb8f16..cff7ab3 100755 (executable)
@@ -24,8 +24,8 @@ lib_env = env.Clone()
 SConscript('#service/third_party_libs.scons', 'lib_env')
 raml_env = lib_env.Clone()
 
-raml_env.PrepareLib('cjson')
-raml_env.PrepareLib('yaml')
+SConscript('#/extlibs/cjson/SConscript')
+SConscript('#/extlibs/yaml/SConscript')
 ######################################################################
 # Build flags
 ######################################################################
@@ -41,7 +41,7 @@ raml_env.AppendUnique(CPPDEFINES = ['LINUX'])
 raml_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
 
 raml_env.PrependUnique(LIBS = ['octbstack', 'YamlParser'])
-raml_env.AppendUnique(LIBS = ['pthread', 'm', 'cjsonLibrary'])
+raml_env.AppendUnique(LIBS = ['pthread', 'm', 'cjson'])
 
 ######################################################################
 # Source files and Targets