tizen: Don't build sqlite sources
[platform/upstream/iotivity.git] / resource / csdk / 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 rd_env = env.Clone()
27
28 if rd_env.get('LOGGING'):
29     rd_env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
30
31 target_os = env.get('TARGET_OS')
32 src_dir = env.get('SRC_DIR')
33 rd_mode = env.get('RD_MODE')
34
35 ######################################################################
36 # Build flags
37 ######################################################################
38 rd_env.AppendUnique(CPPPATH = ['include', 'src/internal', '../stack/include'])
39
40 if 'CLIENT' in rd_mode:
41     rd_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
42 if 'SERVER' in rd_mode:
43     rd_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
44
45 rd_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
46
47 if target_os not in ['windows']:
48     rd_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
49
50 if target_os in ['linux']:
51     rd_env.AppendUnique(LIBS = ['pthread'])
52
53 if target_os == 'android':
54     rd_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
55     rd_env.AppendUnique(LIBS = ['gnustl_static'])
56
57     if not env.get('RELEASE'):
58         rd_env.AppendUnique(LIBS = ['log'])
59
60 if target_os in ['tizen']:
61     rd_env.ParseConfig('pkg-config --cflags --libs sqlite3')
62 else:
63     rd_env.AppendUnique(CPPPATH = ['../../../extlibs/sqlite3'])
64
65 ######################################################################
66 # Source files and Targets
67 ######################################################################
68 RD_SRC_DIR = 'src/'
69 rd_src = []
70 if 'SERVER' in rd_mode:
71     rd_src += [
72             RD_SRC_DIR + 'internal/rd_database.c',
73             RD_SRC_DIR + 'rd_server.c',
74             ]
75     if target_os not in ['tizen'] :
76         rd_src += [ '../../../extlibs/sqlite3/sqlite3.c' ]
77 if 'CLIENT' in rd_mode:
78     rd_src += [RD_SRC_DIR + 'rd_client.c',]
79
80 if target_os in ['tizen'] :
81     rdsdk = rd_env.SharedLibrary('resource_directory', rd_src)
82 else :
83     rdsdk = rd_env.StaticLibrary('resource_directory', rd_src)
84
85 rd_env.InstallTarget(rdsdk, 'resource_directory')
86 rd_env.UserInstallTargetLib(rdsdk, 'resource_directory')
87 if 'CLIENT' in rd_mode:
88     rd_env.UserInstallTargetHeader('include/rd_client.h', 'service/resource-directory', 'rd_client.h')
89
90 if 'SERVER' in rd_mode:
91     rd_env.UserInstallTargetHeader('include/rd_server.h', 'service/resource-directory', 'rd_server.h')
92     rd_env.UserInstallTargetHeader('include/rd_database.h', 'service/resource-directory', 'rd_database.h')
93
94 ######################################################################
95 # Samples for the resource directory
96 ######################################################################
97 if target_os in ['linux']:
98     SConscript('samples/SConscript')
99
100 ######################################################################
101 # Build UnitTests Things Manager
102 ################################################ ######################
103 if target_os in ['linux']:
104     SConscript('unittests/SConscript')