1 #******************************************************************
3 # Copyright 2015 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # Resource Directory build script
28 if rd_env.get('LOGGING'):
29 rd_env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
31 target_os = env.get('TARGET_OS')
32 src_dir = env.get('SRC_DIR')
33 rd_mode = env.get('RD_MODE')
35 ######################################################################
37 ######################################################################
38 rd_env.AppendUnique(CPPPATH = ['include',
43 '../../oc_logger/include',
46 if 'CLIENT' in rd_mode:
47 rd_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
48 if 'SERVER' in rd_mode:
49 rd_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
51 rd_env.PrependUnique(LIBPATH = [rd_env.get('BUILD_DIR')])
52 if target_os != 'android':
53 rd_env.PrependUnique(RPATH = [rd_env.get('BUILD_DIR')])
54 rd_env.PrependUnique(LIBS = ['octbstack', 'oc', 'oc_logger'])
56 if target_os not in ['windows']:
57 rd_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
59 if target_os in ['linux']:
60 rd_env.AppendUnique(LIBS = ['pthread'])
62 if target_os == 'android':
63 rd_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
64 rd_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libresource_directory.so'])
65 rd_env.AppendUnique(LIBS = ['gnustl_static'])
67 if not env.get('RELEASE'):
68 rd_env.AppendUnique(LIBS = ['log'])
70 if target_os in ['linux', 'tizen']:
71 rd_env.ParseConfig('pkg-config --cflags --libs sqlite3')
73 rd_env.AppendUnique(CPPPATH = ['../../../extlibs/sqlite3'])
75 ######################################################################
76 # Source files and Targets
77 ######################################################################
81 if 'SERVER' in rd_mode:
83 RD_SRC_DIR + 'internal/rd_database.c',
84 RD_SRC_DIR + 'rd_server.c',
86 if target_os not in ['linux', 'tizen', 'tizenrt'] :
87 rd_src += [ '../../../extlibs/sqlite3/sqlite3.c' ]
89 if 'CLIENT' in rd_mode:
90 rd_src += [RD_SRC_DIR + 'rd_client.c',]
91 if target_os not in ['arduino','darwin','ios', 'windows', 'winrt','tizenrt']:
92 rd_src += [ RD_SRC_DIR + 'RDClient.cpp',]
94 if target_os not in ['arduino', 'darwin', 'ios', 'windows', 'winrt', 'tizenrt']:
95 rdsdk_shared = rd_env.SharedLibrary('resource_directory', rd_src)
96 rdsdk_static = rd_env.StaticLibrary('resource_directory', rd_src)
97 rdsdk = Flatten([rdsdk_static, rdsdk_shared])
99 rdsdk = rd_env.StaticLibrary('resource_directory', rd_src)
100 rd_env.InstallTarget(rdsdk, 'resource_directory')
101 rd_env.UserInstallTargetLib(rdsdk, 'resource_directory')
103 if 'CLIENT' in rd_mode:
104 rd_env.UserInstallTargetHeader('include/rd_client.h', 'resource', 'rd_client.h')
105 rd_env.UserInstallTargetHeader('include/RDClient.h', 'resource', 'RDClient.h')
107 if 'SERVER' in rd_mode:
108 rd_env.UserInstallTargetHeader('include/rd_server.h', 'resource', 'rd_server.h')
109 rd_env.UserInstallTargetHeader('include/rd_database.h', 'resource', 'rd_database.h')
111 ######################################################################
112 # Samples for the resource directory
113 ######################################################################
114 if target_os in ['linux']:
115 SConscript('samples/SConscript')
117 ######################################################################
118 # Build UnitTests of the Resource Directory
119 ################################################ ######################
120 if target_os in ['linux']:
121 SConscript('unittests/SConscript')