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 CSDK build script
23 ######################################################################
29 env.AppendUnique(CPPDEFINES = ['EASY_SETUP_CA_INIT'])
31 if env.get('RELEASE'):
32 env.AppendUnique(CCFLAGS = ['-Os'])
33 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
35 env.AppendUnique(CCFLAGS = ['-g'])
37 if env.get('LOGGING'):
38 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
40 # Easysetup provides reference implemenation of Arduino Enrollee.
41 # Mediator applications developed on different platforms will be default defining the
42 # flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
43 # modifications must be enabled instead (and the existing define must be commented).
45 ##### The following lines must be uncommented, if target Enrollee is not Arduino
46 target_enrollee = env.get('ES_TARGET_ENROLLEE')
47 if target_enrollee == 'arduino':
48 print "REMOTE_ARDUINO_ENROLEE flag is defined."
49 print "The Mediator application will be working only with Arduino Enrollee."
50 env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
53 easy_setup_env = env.Clone()
55 target_os = env.get('TARGET_OS')
57 if target_os in ['android']:
58 # Add third party libraries
59 SConscript('#service/third_party_libs.scons', 'lib_env')
61 ######################################################################
63 ######################################################################
65 easy_setup_env.AppendUnique(CPPPATH = ['inc', 'src','../../inc'])
66 easy_setup_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
67 if target_os in ['linux']:
68 easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
71 ######################################################################
73 ######################################################################
74 if target_os in ['linux']:
75 easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
76 easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
77 easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
78 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
80 ######################################################################
82 ######################################################################
83 if target_os == 'android':
84 easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
85 easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
86 easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
87 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
88 if not env.get('RELEASE'):
89 easy_setup_env.AppendUnique(LIBS = ['log'])
92 if target_os in ['android','linux']:
93 easy_setup_env.PrependUnique(CPPPATH = [
94 env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
95 env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
96 env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
97 env.get('SRC_DIR') + '/resource/csdk/stack/include',
98 env.get('SRC_DIR') + '/resource/csdk/security/include',
99 env.get('SRC_DIR') + '/extlibs/cjson',
100 env.get('SRC_DIR') + '/service/easy-setup/inc',
103 ######################################################################
104 # Source files and Targets
105 ######################################################################
107 if target_os == 'android':
108 es_m_csdk_static = easy_setup_env.StaticLibrary('libESMediatorCSDK',
109 ['src/provisioningapi.cpp',
110 'src/wifiprovisioning.cpp',
111 'src/provisioning.cpp'])
112 easy_setup_env.InstallTarget(es_m_csdk_static, 'libESMediatorCSDK')
114 if target_os in ['linux']:
115 es_m_csdk_shared = easy_setup_env.SharedLibrary('ESMediatorCSDK',
116 ['src/provisioningapi.cpp',
117 'src/wifiprovisioning.cpp',
118 'src/provisioning.cpp'])
119 easy_setup_env.InstallTarget(es_m_csdk_shared, 'libESMediatorCSDK')
121 #Go to build sample apps
122 SConscript('../../sampleapp/mediator/linux/csdk_sample/SConscript')
124 ######################################################################
125 #Build UnitTestcases for Mediator[CSDK]
126 ################################################ ######################
127 if target_os in ['linux']:
128 SConscript('unittests/SConscript')