1 #******************************************************************
3 # Copyright 2016 Samsung Electronics 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 ######################################################################
22 # easy-setup Mediator C++[Rich] SDK build script
23 ######################################################################
27 easysetup_path = os.curdir
29 if env.get('RELEASE'):
30 env.AppendUnique(CCFLAGS = ['-Os'])
31 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
33 env.AppendUnique(CCFLAGS = ['-g'])
35 if env.get('LOGGING'):
36 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
38 # Easysetup provides reference implemenation of Arduino Enrollee.
39 # Mediator applications developed on different platforms will be default defining the
40 # flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
41 # modifications must be enabled instead (and the existing define must be commented).
43 ##### The following lines must be uncommented, if target Enrollee is not Arduino
44 target_enrollee = env.get('ES_TARGET_ENROLLEE')
45 if target_enrollee == 'arduino':
46 print "REMOTE_ARDUINO_ENROLEE flag is defined."
47 print "The Mediator application will be working only with Arduino Enrollee."
48 env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
50 # Add third party libraries
52 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
54 easy_setup_env = lib_env.Clone()
55 target_os = env.get('TARGET_OS')
57 ######################################################################
59 ######################################################################
60 easy_setup_env.AppendUnique(CPPPATH = ['inc', 'src', '../../inc'])
62 if target_os not in ['windows', 'winrt']:
63 easy_setup_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
65 if target_os == 'linux':
66 easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
68 if target_os in ['android']:
69 easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
70 easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
71 easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
72 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
73 if not env.get('RELEASE'):
74 easy_setup_env.AppendUnique(LIBS = ['log'])
76 if target_os == 'linux':
77 easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
78 easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
79 easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
80 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
81 if env.get('SECURED') == '1':
82 easy_setup_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
84 if target_os in ['android','linux']:
85 easy_setup_env.PrependUnique(CPPPATH = [
86 env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
87 env.get('SRC_DIR') + '/resource/include',
88 env.get('SRC_DIR') + '/resource/csdk/logger/include',
89 env.get('SRC_DIR') + '/resource/csdk/stack/include',
90 env.get('SRC_DIR') + '/resource/csdk/logger/include',
91 env.get('SRC_DIR') + '/resource/csdk/security/include',
92 env.get('SRC_DIR') + '/extlibs/cjson',
93 env.get('SRC_DIR') + '/extlibs/sqlite3',
94 env.get('SRC_DIR') + '/service/easy-setup/inc',
96 if env.get('SECURED') == '1':
97 easy_setup_env.AppendUnique(CPPPATH = [
98 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
99 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
100 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
102 ######################################################################
103 # Source files and Targets
104 ######################################################################
107 print"easysetup_path %s" % easysetup_path
111 if target_os in ['android','linux']:
112 if env.get('SECURED') == '1':
113 env.AppendUnique(es_src = [os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
115 es_common_src = ['src/RemoteEnrollee.cpp',
116 'src/RemoteEnrolleeResource.cpp',
118 'src/ESException.cpp']
120 env.AppendUnique(es_src = es_common_src)
122 es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich', env.get('es_src'))
123 easy_setup_env.InstallTarget(es_sdk_shared, 'libESMediatorRich')
125 print "Files path is %s" % env.get('es_src')
127 #Go to build sample apps
128 if target_os == 'linux':
129 SConscript('../../sampleapp/mediator/linux/richsdk_sample/SConscript')