Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / resource / csdk / resource-directory / samples / 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 # ResourceDirectory Sample Apps build script
23 ##
24
25 Import('env')
26
27 lib_env = env.Clone()
28 SConscript('#service/third_party_libs.scons', 'lib_env')
29
30 rd_sample_app_env = lib_env.Clone()
31
32 target_os = env.get('TARGET_OS')
33 ######################################################################
34 # Build flags
35 ######################################################################
36 rd_sample_app_env.AppendUnique(CPPPATH = ['../include'])
37
38 if target_os not in ['windows']:
39     rd_sample_app_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
40 rd_sample_app_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
41 rd_sample_app_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
42 rd_sample_app_env.PrependUnique(LIBS = ['resource_directory', 'oc', 'octbstack'])
43
44 if env.get('SECURED') == '1':
45     rd_sample_app_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
46
47 if env.get('LOGGING'):
48     rd_sample_app_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
49
50 if rd_sample_app_env.get('RD_MODE'):
51     rd_mode = rd_sample_app_env.get('RD_MODE')
52     if 'CLIENT' in rd_mode:
53         rd_sample_app_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
54     if 'SERVER' in rd_mode:
55         rd_sample_app_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
56
57 ####################################################################
58 # Source files and Targets
59 ######################################################################
60 rd_queryClient = rd_sample_app_env.Program('rd_queryClient', 'rd_queryClient.cpp')
61
62 if 'SERVER' in rd_sample_app_env.get('RD_MODE'):
63     rd_server = rd_sample_app_env.Program('rd_server', 'rd_main.c')
64     Alias("resource_directory", [rd_server, rd_queryClient])
65
66 if 'CLIENT' in rd_sample_app_env.get('RD_MODE'):
67     rd_publishingClient = rd_sample_app_env.Program('rd_publishingClient', 'rd_publishingClient.cpp')
68     rd_client = rd_sample_app_env.Program('rd_client', 'rdclient.cpp')
69     Alias("resource_directory", [rd_publishingClient, rd_client, rd_queryClient])
70
71 env.AppendTarget('resource_directory')