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(env.get('SRC_DIR') + '/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 == 'linux':
68 easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
71 ######################################################################
73 ######################################################################
74 if target_os == '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 = ['coap'])
79 easy_setup_env.AppendUnique(LIBS = ['connectivity_abstraction'])
80 easy_setup_env.AppendUnique(LIBS = ['oc_logger'])
81 easy_setup_env.AppendUnique(LIBS = ['octbstack'])
82 easy_setup_env.AppendUnique(LIBS = ['oc'])
83 easy_setup_env.AppendUnique(LIBS = ['pthread'])
85 ######################################################################
87 ######################################################################
88 if target_os == 'android':
89 easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
90 easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
91 easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
92 easy_setup_env.PrependUnique(LIBS = ['coap'])
93 easy_setup_env.AppendUnique(LIBS = ['connectivity_abstraction'])
94 easy_setup_env.AppendUnique(LIBS = ['oc_logger'])
95 easy_setup_env.AppendUnique(LIBS = ['octbstack'])
96 easy_setup_env.AppendUnique(LIBS = ['oc'])
97 easy_setup_env.AppendUnique(LIBS = ['gnustl_shared'])
99 if not env.get('RELEASE'):
100 easy_setup_env.AppendUnique(LIBS = ['log'])
103 if target_os in ['android','linux']:
104 easy_setup_env.PrependUnique(CPPPATH = [
105 env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
106 env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
107 env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
108 env.get('SRC_DIR') + '/resource/csdk/stack/include',
109 env.get('SRC_DIR') + '/resource/csdk/security/include',
110 env.get('SRC_DIR') + '/extlibs/cjson',
111 env.get('SRC_DIR') + '/service/easy-setup/inc',
114 ######################################################################
115 # Source files and Targets
116 ######################################################################
118 if target_os == 'android':
119 es_m_csdk_static = easy_setup_env.StaticLibrary('libESMediatorCSDK',
120 ['src/provisioningapi.cpp',
121 'src/wifiprovisioning.cpp',
122 'src/provisioning.cpp'])
123 easy_setup_env.InstallTarget(es_m_csdk_static, 'libESMediatorCSDK')
125 if target_os == 'linux':
126 es_m_csdk_shared = easy_setup_env.SharedLibrary('ESMediatorCSDK',
127 ['src/provisioningapi.cpp',
128 'src/wifiprovisioning.cpp',
129 'src/provisioning.cpp'])
130 easy_setup_env.InstallTarget(es_m_csdk_shared, 'libESMediatorCSDK')
132 #Go to build sample apps
133 SConscript('../../sampleapp/mediator/linux/csdk_sample/SConscript')
135 ######################################################################
136 #Build UnitTestcases for Mediator[CSDK]
137 ################################################ ######################
138 if target_os == 'linux':
139 SConscript('unittests/SConscript')