[Easy-Setup] Changed the enrollee's cpp files to c files
[iotivity.git] / service / easy-setup / enrollee / SConscript
1 #######################################################################
2 # Copyright 2016 Samsung Electronics All Rights Reserved.
3 #
4 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5 #
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
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
19
20 ######################################################################
21 # Easy-setup Enrollee SDK build script
22 ######################################################################
23 Import('env')
24
25 enrollee_env = env.Clone()
26
27 target_os = enrollee_env.get('TARGET_OS')
28
29 if enrollee_env.get('RELEASE'):
30     enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
31     enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
32 else:
33     enrollee_env.AppendUnique(CCFLAGS = ['-g'])
34
35 if enrollee_env.get('LOGGING'):
36     enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
37
38 # Enrollees are implemented for IP transport only.
39 if 'IP' in enrollee_env.get('TARGET_TRANSPORT'):
40         print "Enrollees are implemented for IP transport only"
41         enrollee_env.AppendUnique(CPPDEFINES = ['ESWIFI'])
42
43 if enrollee_env.get('ES_SOFTAP_MODE') == 'ENROLLEE_SOFTAP':
44         enrollee_env.AppendUnique(CPPDEFINES = ['ENROLLEE_SOFTAP'])
45
46 ######################################################################
47 # Build flags
48 ######################################################################
49 enrollee_env.PrependUnique(CPPPATH = [
50                 enrollee_env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
51                 enrollee_env.get('SRC_DIR') + '/resource/include',
52                 enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
53                 enrollee_env.get('SRC_DIR') + '/resource/oc_logger/include',
54         enrollee_env.get('SRC_DIR') + '/resource/csdk/stack/include',
55         enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
56                 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/include',
57                 enrollee_env.get('SRC_DIR') + '/extlibs/cjson',
58                 enrollee_env.get('SRC_DIR') + '/extlibs/sqlite3',
59                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/inc',
60                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
61                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
62                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src',
63                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino'])
64
65 if enrollee_env.get('SECURED') == '1':
66         enrollee_env.AppendUnique(CPPPATH = [
67                 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
68                 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
69                 enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
70
71 if target_os not in ['windows', 'winrt']:
72         enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
73
74 ######################################################################
75 # Linux Enrollee
76 ######################################################################
77 if target_os == 'linux':
78         enrollee_env.PrependUnique(CPPPATH = [
79                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi'])
80
81         enrollee_env.AppendUnique(LIBS = ['pthread', 'dl'])
82         enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
83         enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
84         enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
85         enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
86         if enrollee_env.get('SECURED') == '1':
87                 enrollee_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
88
89 ######################################################################
90 # Tizen Enrollee
91 ######################################################################
92 if target_os == 'tizen':
93         enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
94         enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
95         enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
96         enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
97         enrollee_env.AppendUnique(CPPPATH = [
98                                enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
99
100 ######################################################################
101 # Arduino Enrollee
102 ######################################################################
103 if target_os == 'arduino':
104         enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
105         enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
106         enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
107         enrollee_env.AppendUnique(CPPPATH = [
108                        enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi'])
109
110 ######################################################################
111 # Source files and Targets
112 ######################################################################
113 es_enrollee_src = None
114
115 if target_os == 'linux':
116         es_enrollee_common_src =        [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
117                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
118                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
119                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
120                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
121                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c']
122
123         enrollee_env.AppendUnique(es_enrollee_src = es_enrollee_common_src)
124
125         enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', enrollee_env.get('es_enrollee_src'))
126         enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
127
128 if target_os == 'tizen':
129         enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', [
130                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
131                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
132                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
133                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
134                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/networkhandler.c',
135                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/softapnative.c'])
136         enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrolleeSDK')
137         enrollee_env.UserInstallTargetLib(enrollee_sdk_shared, 'libESEnrolleeSDK')
138
139 if target_os == 'arduino':
140         es_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', [
141                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/easysetup.cpp',
142                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/onboarding.cpp',
143                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/softap.cpp',
144                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/resourcehandler.cpp',
145                 enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
146         enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK')
147
148 #Go to build sample apps
149 if target_os == 'arduino':
150         SConscript('../sampleapp/enrollee/arduino/SConscript')
151
152 if target_os == 'linux':
153         SConscript('../sampleapp/enrollee/linux/SConscript')
154         #Build UnitTestcases for Enrollee
155         SConscript('../enrollee/unittests/SConscript')
156