1 #######################################################################
2 # Copyright 2016 Samsung Electronics All Rights Reserved.
4 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 ######################################################################
21 # Easy-setup Enrollee SDK build script
22 ######################################################################
25 enrollee_env = env.Clone()
27 target_os = enrollee_env.get('TARGET_OS')
29 if enrollee_env.get('RELEASE'):
30 enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
31 enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
33 enrollee_env.AppendUnique(CCFLAGS = ['-g'])
35 if enrollee_env.get('LOGGING'):
36 enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
38 ######################################################################
40 ######################################################################
41 enrollee_env.PrependUnique(CPPPATH = [
42 enrollee_env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
43 enrollee_env.get('SRC_DIR') + '/resource/include',
44 enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
45 enrollee_env.get('SRC_DIR') + '/resource/oc_logger/include',
46 enrollee_env.get('SRC_DIR') + '/resource/csdk/stack/include',
47 enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
48 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/include',
49 enrollee_env.get('SRC_DIR') + '/extlibs/cjson',
50 enrollee_env.get('SRC_DIR') + '/extlibs/sqlite3',
51 enrollee_env.get('SRC_DIR') + '/service/easy-setup/inc',
52 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
53 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
55 if enrollee_env.get('SECURED') == '1':
56 enrollee_env.AppendUnique(CPPPATH = [
57 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
58 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
59 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
61 if target_os not in ['windows']:
62 enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
64 if not env.get('RELEASE'):
65 enrollee_env.PrependUnique(LIBS = ['gcov'])
66 enrollee_env.AppendUnique(CCFLAGS = ['--coverage'])
68 ######################################################################
70 ######################################################################
71 if target_os in ['linux']:
72 enrollee_env.AppendUnique(LIBS = ['pthread', 'dl'])
73 enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
74 enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
75 enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
76 enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
77 if enrollee_env.get('SECURED') == '1':
78 enrollee_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
80 ######################################################################
82 ######################################################################
83 if target_os == 'tizen':
84 enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
85 enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
86 enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
87 enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
89 ######################################################################
91 ######################################################################
92 if target_os == 'arduino':
93 enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
94 enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
95 enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
97 ######################################################################
98 # Source files and Targets
99 ######################################################################
100 es_enrollee_src = None
102 if target_os in ['linux', 'tizen']:
103 es_enrollee_common_src = ['./src/easysetup.c','./src/resourcehandler.c']
104 enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', es_enrollee_common_src)
105 enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
106 enrollee_env.UserInstallTargetLib(enrollee_sdk_shared, 'libESEnrollee')
108 if target_os == 'arduino':
109 es_enrollee_common_src = ['./src/easysetup.c','./src/resourcehandler.c']
110 enrollee_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', es_enrollee_common_src)
111 enrollee_env.InstallTarget(enrollee_sdk_static, 'libESEnrolleeSDK')
112 enrollee_env.UserInstallTargetLib(enrollee_sdk_static, 'libESEnrollee')
114 #Go to build sample apps
115 #if target_os == 'arduino':
116 # SConscript('../sampleapp/enrollee/arduino/SConscript')
118 if target_os in ['linux']:
119 SConscript('../sampleapp/enrollee/linux/SConscript')
120 #Build UnitTestcases for Enrollee
121 SConscript('../enrollee/unittests/SConscript')