libocsrm_env = lib_env.Clone()
-target_os = env.get('TARGET_OS')
+target_os = libocsrm_env.get('TARGET_OS')
# As in the source code, it includes arduino Time library (C++)
# It requires compile the .c with g++
if target_os == 'arduino':
- libocsrm_env.Replace(CC = env.get('CXX'))
- libocsrm_env.Replace(CFLAGS = env.get('CXXFLAGS'))
+ libocsrm_env.Replace(CC = libocsrm_env.get('CXX'))
+ libocsrm_env.Replace(CFLAGS = libocsrm_env.get('CXXFLAGS'))
######################################################################
# Build flags
######################################################################
+with_upstream_libcoap = libocsrm_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.
+ libocsrm_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+else:
+ # For bring up purposes only, the forked version will live here.
+ libocsrm_env.AppendUnique(CPPPATH = ['../connectivity/lib/libcoap-4.1.1/include'])
+
libocsrm_env.PrependUnique(CPPPATH = [
'../../../extlibs/cjson/',
- '../../../extlibs/tinydtls/',
'../logger/include',
'../../c_common/ocrandom/include',
'../stack/include',
'../stack/include/internal',
'../../oc_logger/include',
- '../connectivity/lib/libcoap-4.1.1',
'../connectivity/external/inc',
'../connectivity/common/inc',
- '../connectivity/inc/pkix',
'../connectivity/inc',
'../connectivity/api',
'../security/include',
'../security/provisioning/include'
])
-if env.get('SECURED') == '1' and target_os not in ['tizen']:
- libocsrm_env.AppendUnique(CPPPATH = ['../../../extlibs/sqlite3'])
-
if target_os not in ['arduino', 'windows']:
- libocsrm_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
+ libocsrm_env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '_GNU_SOURCE'])
libocsrm_env.AppendUnique(CFLAGS = ['-std=c99', '-Wall'])
-libocsrm_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+libocsrm_env.AppendUnique(LIBPATH = [libocsrm_env.get('BUILD_DIR')])
libocsrm_env.AppendUnique(LIBS = ['coap'])
if target_os == 'arduino':
libocsrm_env.AppendUnique(LIBS = ['m'])
if target_os in ['windows', 'msys_nt']:
- libocsrm_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'oc_logger')])
+ libocsrm_env.AppendUnique(LIBPATH = [os.path.join(libocsrm_env.get('BUILD_DIR'), 'resource', 'oc_logger')])
if target_os in ['darwin', 'ios']:
libocsrm_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- libocsrm_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+ libocsrm_env.AppendUnique(LIBPATH = [libocsrm_env.get('BUILD_DIR')])
libocsrm_env.AppendUnique(LIBS = ['coap'])
if env.get('LOGGING'):
libocsrm_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
-if env.get('DTLS_WITH_X509') == '1':
- libocsrm_env.AppendUnique(CPPDEFINES = ['__WITH_X509__'])
+if env.get('MULTIPLE_OWNER') == '1':
+ libocsrm_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
######################################################################
# Source files and Targets
OCSRM_SRC + 'pstatresource.c',
OCSRM_SRC + 'doxmresource.c',
OCSRM_SRC + 'credresource.c',
- OCSRM_SRC + 'svcresource.c',
OCSRM_SRC + 'pconfresource.c',
OCSRM_SRC + 'dpairingresource.c',
OCSRM_SRC + 'policyengine.c',
OCSRM_SRC + 'directpairing.c'
]
-if env.get('SECURED') == '1':
- libocsrm_src = libocsrm_src + [OCSRM_SRC + 'provisioningdatabasemanager.c']
-
-if env.get('SECURED') == '1' and target_os != 'tizen':
- libocsrm_src = libocsrm_src + ['../../../extlibs/sqlite3/sqlite3.c']
-
-if env.get('SECURED') == '1':
- libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmpincommon.c', OCSRM_SRC + 'pbkdf2.c']
+if libocsrm_env.get('SECURED') == '1':
+ libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmpincommon.c', OCSRM_SRC + 'pbkdf2.c']
+ libocsrm_src = libocsrm_src + [OCSRM_SRC + 'crlresource.c', OCSRM_SRC + 'pkix_interface.c']
+ libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmverifycommon.c']
+ libocsrm_src = libocsrm_src + [OCSRM_SRC + 'psiutils.c'] # TODO : need for secure psi
if target_os in ['windows', 'msys_nt']:
libocsrm_src = libocsrm_src + [OCSRM_SRC + 'strptime.c']
-if (env.get('DTLS_WITH_X509') == '1' or env.get('WITH_TCP') == True) and env.get('SECURED') == '1':
- crl_src = [OCSRM_SRC + 'crlresource.c']
- libocsrm_src = libocsrm_src + crl_src
+
+libocsrm_src.extend(env['cbor_files'])
+
+# Insert a hack for Arduino, whose compiler may not support all defines expected
+# by tinycbor
+if target_os in ['arduino']:
+ libocsrm_env.AppendUnique(CPPDEFINES = ['INT64_MAX=0x7FFFFFFFFFFFFFFF'])
libocsrm_conf = Configure(libocsrm_env)
if libocsrm_conf.CheckFunc('strptime'):
libocsrm_env.InstallTarget(libocsrm, 'ocsrm')
-if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows'] and env.get('SECURED') == '1':
+if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows', 'ios'] and libocsrm_env.get('SECURED') == '1':
SConscript('provisioning/SConscript')
-if target_os in ['linux'] and env.get('SECURED') == '1':
+if target_os in ['linux'] and libocsrm_env.get('SECURED') == '1':
SConscript('tool/SConscript')