Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / service / resource-directory / SConscript
1 # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
2 #******************************************************************
3 #
4 # Copyright 2015 Samsung Electronics All Rights Reserved.
5 #
6 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #      http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #
20 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21
22 ##
23 # Resource Directory build script
24 ##
25
26 Import('env')
27
28 if env.get('RELEASE'):
29     env.AppendUnique(CCFLAGS = ['-Os'])
30     env.AppendUnique(CPPDEFINES = ['NDEBUG'])
31 else:
32     env.AppendUnique(CCFLAGS = ['-g'])
33
34 if env.get('LOGGING'):
35     env.AppendUnique(CPPDEFINES = ['TB_LOG'])
36
37 lib_env = env.Clone()
38 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
39 rd_env = lib_env.Clone()
40
41 target_os = env.get('TARGET_OS')
42 ######################################################################
43 # Build flags
44 ######################################################################
45 rd_env.AppendUnique(CPPPATH = ['include'])
46 rd_env.AppendUnique(CPPPATH = ['src/internal'])
47 rd_env.AppendUnique(CPPPATH = ['../../resource/csdk/logger/include'])
48 rd_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
49
50 if target_os not in ['windows', 'winrt']:
51     rd_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
52
53 if target_os == 'linux':
54     rd_env.AppendUnique(LIBS = ['pthread'])
55
56 if target_os == 'android':
57     rd_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
58     rd_env.AppendUnique(LIBS = ['gnustl_static'])
59
60     if not env.get('RELEASE'):
61         rd_env.AppendUnique(LIBS = ['log'])
62
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66 RD_SRC_DIR = 'src/'
67 rd_src = [
68         RD_SRC_DIR + '/internal/rd_storage.c',
69         RD_SRC_DIR + 'rd_server.c',
70         RD_SRC_DIR + 'rd_client.c',
71          ]
72
73 if target_os in ['tizen'] :
74     rdsdk = rd_env.SharedLibrary('resource_directory', rd_src)
75 else :
76     rdsdk = rd_env.StaticLibrary('resource_directory', rd_src)
77
78 rd_env.InstallTarget(rdsdk, 'libresource_directory')
79 rd_env.UserInstallTargetLib(rdsdk, 'libresource_directory')
80 rd_env.UserInstallTargetHeader('/include/rd_client.h', 'service/resource-directory', 'rd_client.h')
81 rd_env.UserInstallTargetHeader('/include/rd_server.h', 'service/resource-directory', 'rd_server.h')
82
83 ######################################################################
84 # Samples for the resource directory
85 ######################################################################
86 SConscript('samples/SConscript')