Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / resource-directory / 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 # Resource Directory build script
23 ##
24
25 Import('env')
26
27 if env.get('RELEASE'):
28     env.AppendUnique(CCFLAGS = ['-Os'])
29     env.AppendUnique(CPPDEFINES = ['NDEBUG'])
30 else:
31     env.AppendUnique(CCFLAGS = ['-g'])
32
33 if env.get('LOGGING'):
34     env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
35
36 lib_env = env.Clone()
37 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
38 rd_env = lib_env.Clone()
39
40 target_os = env.get('TARGET_OS')
41 ######################################################################
42 # Build flags
43 ######################################################################
44 rd_env.AppendUnique(CPPPATH = ['include'])
45 rd_env.AppendUnique(CPPPATH = ['src/internal'])
46 rd_env.AppendUnique(CPPPATH = ['../../resource/csdk/logger/include'])
47 rd_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
48
49 if target_os not in ['windows', 'winrt']:
50     rd_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
51
52 if target_os == 'linux':
53     rd_env.AppendUnique(LIBS = ['pthread'])
54
55 if target_os == 'android':
56     rd_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
57     rd_env.AppendUnique(LIBS = ['gnustl_static'])
58
59     if not env.get('RELEASE'):
60         rd_env.AppendUnique(LIBS = ['log'])
61
62 ######################################################################
63 # Source files and Targets
64 ######################################################################
65 RD_SRC_DIR = 'src/'
66 rd_src = [
67         RD_SRC_DIR + '/internal/rd_storage.c',
68         RD_SRC_DIR + 'rd_server.c',
69         RD_SRC_DIR + 'rd_client.c',
70          ]
71
72 if target_os in ['tizen'] :
73     rdsdk = rd_env.SharedLibrary('resource_directory', rd_src)
74 else :
75     rdsdk = rd_env.StaticLibrary('resource_directory', rd_src)
76
77 rd_env.InstallTarget(rdsdk, 'libresource_directory')
78 rd_env.UserInstallTargetLib(rdsdk, 'libresource_directory')
79 rd_env.UserInstallTargetHeader('/include/rd_client.h', 'service/resource-directory', 'rd_client.h')
80 rd_env.UserInstallTargetHeader('/include/rd_server.h', 'service/resource-directory', 'rd_server.h')
81
82 ######################################################################
83 # Samples for the resource directory
84 ######################################################################
85 SConscript('samples/SConscript')