1 # //******************************************************************
3 # // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # // Licensed under the Apache License, Version 2.0 (the "License");
8 # // you may not use this file except in compliance with the License.
9 # // You may obtain a copy of the License at
11 # // http://www.apache.org/licenses/LICENSE-2.0
13 # // Unless required by applicable law or agreed to in writing, software
14 # // distributed under the License is distributed on an "AS IS" BASIS,
15 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # // See the License for the specific language governing permissions and
17 # // limitations under the License.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 # libocsrm (share library) build script
27 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29 libocsrm_env = lib_env.Clone()
31 target_os = env.get('TARGET_OS')
32 # As in the source code, it includes arduino Time library (C++)
33 # It requires compile the .c with g++
34 if target_os == 'arduino':
35 libocsrm_env.Replace(CC = env.get('CXX'))
36 libocsrm_env.Replace(CFLAGS = env.get('CXXFLAGS'))
38 ######################################################################
40 ######################################################################
41 libocsrm_env.PrependUnique(CPPPATH = [
42 '../../../extlibs/cjson/',
44 '../ocrandom/include',
46 '../stack/include/internal',
47 '../../oc_logger/include',
48 '../connectivity/lib/libcoap-4.1.1',
49 '../connectivity/external/inc',
50 '../connectivity/inc',
51 '../connectivity/api',
52 '../security/include',
53 '../security/include/internal',
56 if target_os not in ['arduino', 'windows', 'winrt']:
57 libocsrm_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
58 libocsrm_env.AppendUnique(CFLAGS = ['-std=c99'])
60 if target_os not in ['windows', 'winrt']:
61 libocsrm_env.AppendUnique(CFLAGS = ['-Wall'])
63 libocsrm_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
64 libocsrm_env.AppendUnique(LIBS = ['coap', 'm'])
66 if target_os == 'arduino':
67 libocsrm_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
69 libocsrm_env.AppendUnique(CFLAGS = ['-fPIC'])
71 if target_os in ['darwin', 'ios']:
72 libocsrm_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
73 libocsrm_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
74 libocsrm_env.AppendUnique(LIBS = ['coap'])
76 if not env.get('RELEASE'):
77 libocsrm_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
79 ######################################################################
80 # Source files and Targets
81 ######################################################################
84 OCSRM_SRC + 'secureresourcemanager.c',
85 OCSRM_SRC + 'resourcemanager.c',
86 OCSRM_SRC + 'aclresource.c',
87 OCSRM_SRC + 'pstatresource.c',
88 OCSRM_SRC + 'doxmresource.c',
89 OCSRM_SRC + 'credresource.c',
90 OCSRM_SRC + 'policyengine.c',
91 OCSRM_SRC + 'psinterface.c',
92 OCSRM_SRC + 'srmresourcestrings.c',
93 OCSRM_SRC + 'base64.c'
96 libocsrm = libocsrm_env.StaticLibrary('libocsrm', libocsrm_src)
98 libocsrm_env.InstallTarget(libocsrm, 'libocsrm')
100 if env.get('SECURED') == '1':
101 SConscript('provisioning/SConscript')