Changed the folder structure and changed the shared library to static library
[platform/upstream/iotivity.git] / service / easy-setup / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 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 env.AppendUnique(CPPDEFINES = ['EASY_SETUP_CA_INIT'])
30
31 easy_setup_env = env.Clone()
32 target_os = env.get('TARGET_OS')
33
34 lib_env = env.Clone()
35 if target_os == 'android':
36         SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
37
38 ######################################################################
39 # Build flags
40 ######################################################################
41 easy_setup_env.AppendUnique(CPPPATH = ['sdk/inc', 'sdk/src', 'sdk/common'])
42
43 if target_os not in ['windows', 'winrt']:
44     easy_setup_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
45     if target_os not in ['android', 'arduino']:
46         easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
47
48 if target_os in ['android', 'linux']:
49         easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
50         easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
51         easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
52         if target_os not in ['linux', 'arduino']:
53                 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])      
54                 if not env.get('RELEASE'):
55                         easy_setup_env.AppendUnique(LIBS = ['log'])
56         else:
57                 easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
58
59 if target_os == 'arduino':
60         easy_setup_env.AppendUnique(CPPPATH = [
61                                        '../../resource/oc_logger/include',
62                                        '../../resource/csdk/logger/include',
63                                        '../../resource/csdk/stack/include',
64                                        '../../extlibs/cjson',
65                                        'sdk/enrollee/arduino/wifi',
66                                        'sdk/enrollee/common/src',
67                                        'sdk/enrollee/common/inc'])
68
69 if target_os in ['android','linux']:                                       
70         easy_setup_env.PrependUnique(CPPPATH = [
71                 env.get('SRC_DIR') + '/resource/csdk/ocmalloc/include',         
72                 env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
73                 env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
74         env.get('SRC_DIR') + '/resource/csdk/stack/include',
75         env.get('SRC_DIR') + '/resource/csdk/logger/include',
76                 env.get('SRC_DIR') + '/resource/csdk/security/include',
77                 env.get('SRC_DIR') + '/extlibs/cjson',
78                 'sdk/common',
79                 'sdk/mediator/inc'])
80
81 ######################################################################
82 # Source files and Targets
83 ######################################################################
84
85 if target_os == 'arduino':
86         es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
87                                         ['sdk/enrollee/common/src/easysetup.cpp',
88                                         'sdk/enrollee/common/src/resourceHandler.cpp',
89                                         'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
90         easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK')
91
92
93 if target_os == 'android':
94         es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
95                                         ['sdk/mediator/src/easysetupmgr.cpp',
96                                         'sdk/mediator/src/camutex_pthreads.c',
97                                         'sdk/mediator/src/provisioninghandler.cpp'])
98         easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
99
100 if target_os == 'linux':
101         es_sdk_shared = easy_setup_env.SharedLibrary('ESSDKLibrary',
102                                         ['sdk/mediator/src/easysetupmgr.cpp',
103                                         'sdk/mediator/src/camutex_pthreads.c',
104                                         'sdk/mediator/src/provisioninghandler.cpp'])
105         easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
106
107 #Go to build sample apps
108 SConscript('sampleapp/SConscript')
109
110