Merge "Merge branch 'master' into simulator" into simulator
[platform/upstream/iotivity.git] / service / things-manager / 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 # things_manager project build script
23 ##
24 import os
25 Import('env')
26
27 # Add third party libraries
28 lib_env = env.Clone()
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
30
31 things_manager_env = lib_env.Clone()
32 target_os = env.get('TARGET_OS')
33 ######################################################################
34 # Build flags
35 ######################################################################
36 things_manager_env.AppendUnique(CPPPATH = ['../../extlibs/timer', 'sdk/inc', 'sdk/src'])
37
38 things_manager_env.PrependUnique(LIBS = ['oc', 'octbstack'])
39
40 if target_os not in ['windows', 'winrt']:
41     things_manager_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
42     if target_os != 'android':
43         things_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
44         things_manager_env.AppendUnique(LIBS = ['pthread'])
45
46 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
47     things_manager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
48
49 if target_os == 'android':
50     things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
51     things_manager_env.PrependUnique(LIBS = ['gnustl_shared'])
52
53 ######################################################################
54 # Source files and Targets
55 ######################################################################
56
57
58 # Remove it if the conversion for Android and Tizen platform is done
59 if target_os in ['linux', 'tizen']:
60    tgm_src = env.Glob('sdk/src/*.cpp', '../../extlibs/timer/timer.c')
61    tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
62    tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
63
64    things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
65    things_manager_env.UserInstallTargetLib([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
66
67    # Build JNI layer
68    #if target_os == 'android':
69    #    SConscript(os.path.join('sdk', 'java', 'jni', 'SConscript'))
70
71     #Go to build sample apps
72    SConscript('sampleapp/SConscript')
73
74