Commit be0d881d authored by Pawel Winogrodzki's avatar Pawel Winogrodzki Committed by Kevin Kane

IOT-1583: Removing /W3 warning from resource/csdk/security.

I'm also refactoring some SConscript files in order to enable
/W3 and /WX only for specific directories and I'm adding
_CRT_NONSTDC_NO_WARNINGS to disable warnings about issues we cannot
change anyway, because the code has to build for multiple platforms.

Change-Id: Ifef66b6c59540df2ceb40a54af47865d56a302d7
Signed-off-by: default avatarPawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16329Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
parent 68fe54ed
......@@ -30,6 +30,10 @@ if env.get('BUILD_JAVA') == True:
help_vars.Update(env)
Help(help_vars.GenerateHelpText(env))
# Add the default lib directory
build_dir = env.get('BUILD_DIR')
env.AppendUnique(LIBPATH = [build_dir])
env.AppendENVPath('LD_LIBRARY_PATH', [build_dir])
# Set release/debug flags
if env.get('RELEASE'):
......
# Factorize pthread configurations in single file
import os
Import('env')
Import('thread_env')
thread_env = env.Clone()
target_os = thread_env.get('TARGET_OS')
# Export flags once for all
......@@ -13,5 +12,3 @@ if 'gcc' in compiler:
if target_os not in ['android']:
thread_env.AppendUnique(CFLAGS = ['-pthread'])
thread_env.AppendUnique(LIBS = ['pthread'])
Return('thread_env')
......@@ -40,11 +40,11 @@ elif target_os in ['windows']:
boost_zip = boost_zip_file
else:
print '*** Downloading Boost zip file (> 100MB). Please wait... ***'
boost_zip = env.Download(boost_zip_file, boost_url)
boost_zip = boost_env.Download(boost_zip_file, boost_url)
# Unzip boost
print '*** Unpacking boost %s zip file ... ***' % boost_version
env.UnpackAll(boost_dir, boost_zip)
boost_env.UnpackAll(boost_dir, boost_zip)
# Rename from boost_1_60_0 -> boost
os.rename(boost_base_name, 'boost')
......@@ -70,10 +70,10 @@ elif target_os in ['windows']:
Exit(1)
elif target_os in ['android']:
env.Tool('URLDownload', toolpath=['../../tools/scons'])
env.Tool('UnpackAll', toolpath=['../../tools/scons'])
env.Tool('BoostBootstrap', toolpath=['../../tools/scons'])
env.Tool('BoostBuild', toolpath=['../../tools/scons'])
boost_env.Tool('URLDownload', toolpath=['../../tools/scons'])
boost_env.Tool('UnpackAll', toolpath=['../../tools/scons'])
boost_env.Tool('BoostBootstrap', toolpath=['../../tools/scons'])
boost_env.Tool('BoostBuild', toolpath=['../../tools/scons'])
host_os = sys.platform
......@@ -84,14 +84,14 @@ elif target_os in ['android']:
raise SCons.Errors.EnvironmentError(msg)
if not os.path.exists(boost_arch_name) and not os.path.exists(boost_base_name):
boost_arch_name = env.URLDownload(boost_arch_name, boost_url)
boost_arch_name = boost_env.URLDownload(boost_arch_name, boost_url)
if not os.path.exists(boost_base_name):
boost_arch_name = env.UnpackAll(boost_bootstrap, boost_arch_name)
boost_arch_name = boost_env.UnpackAll(boost_bootstrap, boost_arch_name)
boost_b2 = env.BoostBootstrap(boost_b2_name, boost_arch_name)
boost_b2 = boost_env.BoostBootstrap(boost_b2_name, boost_arch_name)
dep_sys_root = env['DEP_SYS_ROOT']
dep_sys_root = boost_env['DEP_SYS_ROOT']
dep_src_dir = dep_sys_root + os.sep + 'include'
dep_lib_dir = dep_sys_root + os.sep + 'lib'
......@@ -108,5 +108,5 @@ elif target_os in ['android']:
os.path.join(dep_src_dir, 'libboost_program_options.a')
]
boost_build = env.BoostBuild(boost_targets, boost_b2, PREFIX=dep_sys_root, MODULES=modules)
boost_build = boost_env.BoostBuild(boost_targets, boost_b2, PREFIX=dep_sys_root, MODULES=modules)
#******************************************************************
#
# Copyright 2016 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('env')
libcjson = env.StaticLibrary('cjsonLibrary', ['cJSON.c'])
env.InstallTarget(libcjson, 'libCjson');
......@@ -108,7 +108,7 @@ std::string JniSecureUtils::convertUUIDtoStr(OicUuid_t uuid)
{
std::ostringstream deviceId("");
char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*)0)->id)) + 1] = {0,};
uint32_t outLen = 0;
size_t outLen = 0;
B64Result b64Ret = B64_OK;
b64Ret = b64Encode(uuid.id, sizeof(uuid.id), base64Buff,
......
......@@ -51,9 +51,6 @@ if env.get('ROUTING') in ['GW', 'EP']:
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
SConscript('csdk/resource-directory/SConscript')
# Build libocsrm
SConscript('csdk/security/SConscript')
# Build liboctbstack
SConscript('csdk/SConscript')
......
......@@ -72,7 +72,6 @@
# include "windows/include/vs12_snprintf.h"
# endif
# define ssize_t SSIZE_T
# define F_OK 0
# define SHUT_RDWR SD_BOTH
# define sleep(SECS) Sleep(1000*(SECS))
# ifdef __cplusplus
......
/* *****************************************************************
*
* 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.
*
******************************************************************/
*
* 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.
*
******************************************************************/
#ifndef MEMMEM_H__
#define MEMMEM_H__
#include <string.h>
// crtdefs.h is required for size_t
#include <crtdefs.h>
......
......@@ -23,9 +23,10 @@
##
Import('env')
lib_env = env.Clone()
# Build libocsrm
SConscript('security/SConscript')
liboctbstack_env = lib_env.Clone()
liboctbstack_env = env.Clone()
target_os = env.get('TARGET_OS')
rd_mode = env.get('RD_MODE')
......@@ -137,7 +138,6 @@ if target_os == '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']:
......
......@@ -91,7 +91,7 @@ typedef enum {
* @param[in] buffer pointer to buffer of bytes
* @param[in] bufferSize max number of byte in buffer
*/
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint16_t bufferSize);
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, size_t bufferSize);
#define OCLog(level,tag,mes) LOG_(LOG_ID_MAIN, (level), (tag), mes)
#define OCLogv(level,tag,fmt,args...) LOG_(LOG_ID_MAIN, (level),tag,fmt,##args)
......@@ -147,7 +147,7 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1
* @param buffer - pointer to buffer of bytes
* @param bufferSize - max number of byte in buffer
*/
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint16_t bufferSize);
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, size_t bufferSize);
#else // For arduino platforms
/**
* Initialize the serial logger for Arduino
......
......@@ -123,7 +123,7 @@ static oc_log_level LEVEL_XTABLE[] = {OC_LOG_DEBUG, OC_LOG_INFO,
* @param buffer - pointer to buffer of bytes
* @param bufferSize - max number of byte in buffer
*/
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint16_t bufferSize)
void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, size_t bufferSize)
{
if (!buffer || !tag || (bufferSize == 0))
{
......@@ -134,8 +134,8 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1
// that this is a variable-sized object.
char lineBuffer[LINE_BUFFER_SIZE];
memset(lineBuffer, 0, sizeof lineBuffer);
int lineIndex = 0;
int i;
size_t lineIndex = 0;
size_t i;
for (i = 0; i < bufferSize; i++)
{
// Format the buffer data into a line
......
......@@ -24,16 +24,9 @@
Import('env')
import os
lib_env = env.Clone()
libocsrm_env = lib_env.Clone()
libocsrm_env = env.Clone()
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 = libocsrm_env.get('CXX'))
libocsrm_env.Replace(CFLAGS = libocsrm_env.get('CXXFLAGS'))
######################################################################
# Build flags
......@@ -44,25 +37,41 @@ if with_upstream_libcoap == '1':
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.AppendUnique(CPPPATH = ['#/resource/connectivity/lib/libcoap-4.1.1/include'])
libocsrm_env.PrependUnique(CPPPATH = [
'../../../extlibs/tinydtls/',
'../logger/include',
'../../c_common/ocrandom/include',
'../include',
'../stack/include',
'../stack/include/internal',
'../../oc_logger/include',
'../connectivity/external/inc',
'../connectivity/common/inc',
'../connectivity/inc',
'../connectivity/api',
'../security/include',
'../security/include/internal',
'../security/provisioning/include'
'#/extlibs/tinydtls',
'#/resource/csdk/logger/include',
'#/resource/c_common/ocrandom/include',
'#/resource/csdk/include',
'#/resource/csdk/stack/include',
'#/resource/csdk/stack/include/internal',
'#/resource/oc_logger/include',
'#/resource/csdk/connectivity/external/inc',
'#/resource/csdk/connectivity/common/inc',
'#/resource/csdk/connectivity/inc',
'#/resource/csdk/connectivity/api',
'#/resource/csdk/security/include',
'#/resource/csdk/security/include/internal',
'#/resource/csdk/security/provisioning/include'
])
if target_os in ['windows', 'msys_nt']:
libocsrm_env.AppendUnique(LIBPATH = [os.path.join(libocsrm_env.get('BUILD_DIR'), 'resource', 'oc_logger')])
libocsrm_env.AppendUnique(CCFLAGS=['/W3', '/WX'])
if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows'] and libocsrm_env.get('SECURED') == '1':
SConscript('provisioning/SConscript', 'libocsrm_env')
if target_os in ['linux', 'windows', 'darwin'] and libocsrm_env.get('SECURED') == '1':
SConscript('tool/SConscript', 'libocsrm_env')
# 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 = libocsrm_env.get('CXX'))
libocsrm_env.Replace(CFLAGS = libocsrm_env.get('CXXFLAGS'))
if target_os not in ['arduino', 'windows']:
libocsrm_env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '_GNU_SOURCE'])
libocsrm_env.AppendUnique(CFLAGS = ['-std=c99', '-Wall'])
......@@ -76,13 +85,8 @@ elif target_os not in ['windows', 'msys_nt']:
libocsrm_env.AppendUnique(CFLAGS = ['-fPIC'])
libocsrm_env.AppendUnique(LIBS = ['m'])
if target_os in ['windows', 'msys_nt']:
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 = [libocsrm_env.get('BUILD_DIR')])
libocsrm_env.AppendUnique(LIBS = ['coap'])
if env.get('LOGGING'):
libocsrm_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
......@@ -140,9 +144,3 @@ libocsrm_env = libocsrm_conf.Finish()
libocsrm = libocsrm_env.StaticLibrary('ocsrm', libocsrm_src)
libocsrm_env.InstallTarget(libocsrm, 'ocsrm')
if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows'] and libocsrm_env.get('SECURED') == '1':
SConscript('provisioning/SConscript')
if target_os in ['linux', 'windows', 'darwin'] and libocsrm_env.get('SECURED') == '1':
SConscript('tool/SConscript')
......@@ -64,7 +64,7 @@ typedef enum
* @return ::B64_OK for Success, otherwise some error value.
*/
B64Result b64Encode(const uint8_t* in, const size_t inLen,
char* outBuf, const size_t outBufSize, uint32_t *outLen);
char* outBuf, const size_t outBufSize, size_t* outLen);
/**
* Decode the encoded message in base64.
......@@ -79,7 +79,7 @@ B64Result b64Encode(const uint8_t* in, const size_t inLen,
* @return ::B64_OK for Success, otherwise some error value.
*/
B64Result b64Decode(const char* in, const size_t inLen,
uint8_t* outBuf, size_t outBufSize, uint32_t *outLen);
uint8_t* outBuf, size_t outBufSize, size_t* outLen);
#ifdef __cplusplus
}
......
......@@ -52,9 +52,9 @@ extern "C"
* @return 0 on success
*/
int DeriveCryptoKeyFromPassword(const unsigned char* passwd, size_t pLen,
const uint8_t* salt, const size_t saltLen,
const size_t iterations,
const size_t keyLen, uint8_t* derivedKey);
const uint8_t* salt, size_t saltLen,
size_t iterations,
size_t keyLen, uint8_t* derivedKey);
#ifdef __cplusplus
}
......
......@@ -62,14 +62,28 @@ struct OicParseQueryIter
#define VERIFY_SUCCESS(tag, op, logLevel) do{ if (!(op)) \
{OIC_LOG((logLevel), tag, #op " failed!!"); goto exit; } }while(0)
/**
* Macro to verify success of operation.
* eg: VERIFY_SUCCESS_RETURN(TAG, OC_STACK_OK == foo(), ERROR, OC_STACK_ERROR);
*/
#define VERIFY_SUCCESS_RETURN(tag, op, logLevel, retValue) do { if (!(op)) \
{OIC_LOG((logLevel), tag, #op " failed!!"); return retValue;} } while(0)
/**
* Macro to verify argument is not equal to NULL.
* eg: VERIFY_NON_NULL(TAG, ptrData, ERROR);
* eg: VERIFY_NOT_NULL(TAG, ptrData, ERROR);
* @note Invoking function must define "exit:" label for goto functionality to work correctly.
*/
#define VERIFY_NON_NULL(tag, arg, logLevel) do{ if (NULL == (arg)) \
#define VERIFY_NOT_NULL(tag, arg, logLevel) do{ if (NULL == (arg)) \
{ OIC_LOG((logLevel), tag, #arg " is NULL"); goto exit; } }while(0)
/**
* Macro to verify argument is not equal to NULL.
* eg: VERIFY_NOT_NULL_RETURN(TAG, ptrData, ERROR, OC_STACK_ERROR);
*/
#define VERIFY_NOT_NULL_RETURN(tag, arg, logLevel, retValue) do { if (NULL == (arg)) \
{ OIC_LOG((logLevel), tag, #arg " is NULL"); return retValue; } } while(0)
/**
* This method initializes the @ref OicParseQueryIter_t struct.
*
......
......@@ -19,47 +19,26 @@
# //
# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
Import('libocsrm_env')
provisioning_env = SConscript('#build_common/thread.scons')
provisioning_env = libocsrm_env.Clone()
SConscript('#build_common/thread.scons', exports = {'thread_env' : provisioning_env})
target_os = provisioning_env.get('TARGET_OS')
root_dir = './../../../../'
######################################################################
# Build flags
######################################################################
with_upstream_libcoap = provisioning_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.
provisioning_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
else:
# For bring up purposes only, the forked version will live here.
provisioning_env.AppendUnique(CPPPATH = ['../../connectivity/lib/libcoap-4.1.1/include'])
provisioning_env.AppendUnique(CPPPATH = [
'../../include',
'../../stack/include',
'../../stack/include/internal',
'../../../c_common/ocrandom/include',
'../../logger/include',
'../../../oc_logger/include',
'../../../c_common/oic_malloc/include',
'include',
'include/internal',
'include/cloud',
'include/oxm',
'../../resource/csdk/security/include',
'../../../../extlibs/tinydtls/',
'../../connectivity/inc',
'../../connectivity/inc/pkix',
'../../connectivity/external/inc',
'../../connectivity/common/inc',
'../../connectivity/api',
'../include',
'../include/internal',
'../../../../extlibs/tinydtls/ecc',
'../../../../extlibs/tinydtls/sha2',
'../../../../extlibs/asn1cert',
'ck_manager/include'
'#/resource/csdk/include',
'#/resource/c_common/oic_malloc/include',
'#/resource/csdk/security/provisioning/include/internal',
'#/resource/csdk/security/provisioning/include/cloud',
'#/resource/csdk/security/provisioning/include/oxm',
'#/resource/csdk/connectivity/inc/pkix',
'#/extlibs/tinydtls/ecc',
'#/extlibs/tinydtls/sha2',
'#/extlibs/asn1cert'
])
provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
......@@ -125,8 +104,8 @@ if provisioning_env.get('WITH_TCP') == True:
if target_os in ['linux', 'tizen']:
provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
else:
provisioning_env.AppendUnique(CPPPATH = ['../../../../extlibs/sqlite3'])
provisioning_src = provisioning_src + [root_dir+'/extlibs/sqlite3/sqlite3.c' ]
provisioning_env.AppendUnique(CPPPATH = ['#/extlibs/sqlite3'])
provisioning_src = provisioning_src + ['#/extlibs/sqlite3/sqlite3.c' ]
if target_os in ['windows', 'msys_nt']:
# octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
......@@ -140,4 +119,4 @@ provisioning_env.InstallTarget(provisioningserver, 'ocpmapi')
provisioning_env.UserInstallTargetLib(provisioningserver, 'ocpmapi')
if target_os in ['linux', 'msys_nt', 'windows', 'tizen']:
SConscript('sample/SConscript')
SConscript('sample/SConscript', 'provisioning_env')
......@@ -134,7 +134,7 @@ typedef enum OxmAllowTableIdx {
* @param[OUT} hasError - If there is no error, it's returned with 'false' but if there is a single
* or more error is/are occured during operation, it will be 'true'.
*/
typedef void (*OCProvisionResultCB)(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError);
typedef void (*OCProvisionResultCB)(void* ctx, size_t nOfRes, OCProvisionResult_t *arr, bool hasError);
/**
......
......@@ -19,137 +19,113 @@
# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
Import('env')
Import('env provisioning_env')
import os.path
provisioning_env = env.Clone()
target_os = provisioning_env.get('TARGET_OS')
provisioning_sample_env = provisioning_env.Clone()
target_os = provisioning_sample_env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
with_upstream_libcoap = provisioning_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.
provisioning_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
else:
# For bring up purposes only, the forked version will live here.
provisioning_env.AppendUnique(CPPPATH = ['../../../connectivity/lib/libcoap-4.1.1/include'])
provisioning_env.AppendUnique(CPPPATH = [
'../../../include',
'../../../ocrandom/include',
'../../../logger/include',
'../../../stack/include',
'../../../security/include',
'../../../security/include/internal',
'../../../security/provisioning/include/internal',
'../../../../oc_logger/include',
'../include',
'../include/oxm',
'../include/cloud',
'../../include',
'../../../../../extlibs/tinydtls',
'../../../../../extlibs/base64',
'../../../connectivity/inc',
'../../../connectivity/inc/pkix',
'../../../connectivity/common/inc',
'../../../connectivity/api',
'cloud'
provisioning_sample_env.AppendUnique(CPPPATH = [
'#/resource/csdk/include',
'#/extlibs/base64',
'#/resource/csdk/security/provisioning/sample/cloud'
])
target_os = env.get('TARGET_OS')
provisioning_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
provisioning_env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
provisioning_sample_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
provisioning_sample_env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
if target_os not in ['windows']:
provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-fpermissive'])
provisioning_env.AppendUnique(LIBS = ['pthread'])
provisioning_sample_env.AppendUnique(CFLAGS = ['-std=c99'])
provisioning_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-fpermissive'])
provisioning_sample_env.AppendUnique(LIBS = ['pthread'])
if target_os not in ['msys_nt', 'windows']:
provisioning_env.AppendUnique(LIBS = ['dl', 'm'])
provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
provisioning_sample_env.AppendUnique(LIBS = ['dl', 'm'])
provisioning_sample_env.ParseConfig('pkg-config --libs glib-2.0');
provisioning_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
else:
provisioning_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
provisioning_sample_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
provisioning_env.PrependUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'connectivity_abstraction', 'coap'])
provisioning_sample_env.PrependUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'connectivity_abstraction', 'coap'])
if target_os not in ['msys_nt', 'windows']:
# octbstack.dll is exporting ocpmapi and ocsrm APIs on Windows.
provisioning_env.PrependUnique(LIBS = ['ocpmapi', 'ocsrm'])
provisioning_sample_env.PrependUnique(LIBS = ['ocpmapi', 'ocsrm'])
if env.get('SECURED') == '1':
provisioning_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
provisioning_sample_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
if env.get('MULTIPLE_OWNER') == '1':
provisioning_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
provisioning_sample_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
provisioning_sample_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os == 'tizen':
provisioning_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
provisioning_sample_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
if target_os in ['linux', 'tizen']:
provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
provisioning_sample_env.ParseConfig('pkg-config --cflags --libs sqlite3')
######################################################################
# Source files and Targets
######################################################################