Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / easy-setup / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Samsung Electronics All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
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
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # easy-setup project build script
23 ##
24
25 import os
26
27 Import('env')
28
29 transport = env.get('TARGET_TRANSPORT')
30
31 env.AppendUnique(CPPDEFINES = ['EASY_SETUP_CA_INIT'])
32
33 easy_setup_env = env.Clone()
34 #
35 target_os = env.get('TARGET_OS')
36
37 lib_env = env.Clone()
38 if target_os == 'android':
39         SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
40
41 ######################################################################
42 # Build flags
43 ######################################################################
44 easy_setup_env.AppendUnique(CPPPATH = ['sdk/inc', 'sdk/src', 'sdk/common'])
45
46 if target_os not in ['windows', 'winrt']:
47     easy_setup_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
48     if target_os not in ['android', 'arduino']:
49         easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
50
51 if target_os in ['android', 'linux']:
52         easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
53         easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
54         easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
55         if target_os not in ['linux', 'arduino']:
56                 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])      
57                 if not env.get('RELEASE'):
58                         easy_setup_env.AppendUnique(LIBS = ['log'])
59         else:
60                 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
61 if target_os == 'arduino':
62         easy_setup_env.AppendUnique(CPPPATH = [
63                                '../../resource/oc_logger/include',
64                                '../../resource/csdk/logger/include',
65                                '../../resource/csdk/stack/include',
66                                '../../extlibs/cjson',
67                                    'sdk/enrollee/arduino/wifi',
68                                    'sdk/enrollee/api',
69                                    'sdk/enrollee/src',
70                                'sdk/enrollee/inc'])
71         easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
72 if target_os in ['android','linux']:                                       
73         easy_setup_env.PrependUnique(CPPPATH = [
74                 env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',           
75                 env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
76                 env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
77         env.get('SRC_DIR') + '/resource/csdk/stack/include',
78         env.get('SRC_DIR') + '/resource/csdk/logger/include',
79                 env.get('SRC_DIR') + '/resource/csdk/security/include',
80                 env.get('SRC_DIR') + '/extlibs/cjson',
81                 'sdk/common',
82                 'sdk/mediator/inc'])
83
84 ######################################################################
85 # Source files and Targets
86 ######################################################################
87
88 if target_os == 'arduino':
89         es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
90                                         ['sdk/enrollee/src/easysetup.cpp',
91                                         'sdk/enrollee/src/resourceHandler.cpp',
92                                         'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
93         easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK')
94
95 if target_os == 'android':
96         es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
97                                         ['sdk/mediator/src/prov_adapter.cpp',
98                                         'sdk/mediator/src/wifi_provisioning.cpp',
99                                         'sdk/mediator/src/provisioning.cpp'])
100         easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
101
102 if target_os == 'linux':
103         es_sdk_shared = easy_setup_env.SharedLibrary('ESSDKLibrary',
104                                         ['sdk/mediator/src/prov_adapter.cpp',
105                                         'sdk/mediator/src/wifi_provisioning.cpp',
106                                         'sdk/mediator/src/provisioning.cpp'])
107         easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
108
109 #Go to build sample apps
110 SConscript('sampleapp/SConscript')
111
112