[IOT-2029] split scons builder code out of external_libs.scons
[contrib/iotivity.git] / service / resource-encapsulation / examples / linux / secureResourceExample / 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 # linux RE Secure sample apps  build script (Secure Server &  Client)
23 ##
24 Import('env')
25
26 # Add third party libraries
27 lib_env = env.Clone()
28 SConscript('#service/third_party_libs.scons', 'lib_env')
29 sample_env = lib_env.Clone()
30
31 sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
32 sample_env.AppendUnique(LIBS = [
33     'coap',
34     'connectivity_abstraction',
35     'oc_logger',
36     'octbstack',
37     'oc',
38     'rcs_common',
39     'pthread',
40     'mbedtls', 'mbedx509', 'mbedcrypto'
41     ])
42 sample_env.AppendUnique(CPPPATH = [
43     '../../../include',
44     '#/resource/csdk/include',
45     '#/resource/csdk/stack/include',
46     '#/resource/include',
47     '#/resource/oc_logger/include'
48 ])
49
50 if env.get('SECURED') == '1':
51     sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
52
53 if 'rt' in sample_env.get('LIBS'):
54     sample_env.Append(LIBS = ['rt'])
55
56 ######################################################################
57 # ##### Authorized Client #####
58 ######################################################################
59 client_env = sample_env.Clone()
60 client_env.AppendUnique(LIBS = 'rcs_client')
61
62 sampleAuthorizedClient = client_env.Program('sampleAuthorizedClient', 'SampleAuthorizedClient.cpp')
63 client_env.InstallTarget(sampleAuthorizedClient, 'sampleAuthorizedClient')
64
65 ######################################################################
66 # ##### Secure Server #####
67 ######################################################################
68 server_env = sample_env.Clone()
69 server_env.AppendUnique(LIBS = 'rcs_server')
70
71 sampleSecureServer = server_env.Program('sampleSecureServer', 'SampleSecureServer.cpp')
72 server_env.InstallTarget(sampleSecureServer, 'sampleSecureServer')
73
74 ######################################################################
75 # ##### Copy the client & Server credentials files to build directory #####
76 ######################################################################
77
78 src_dir = sample_env.get('SRC_DIR')
79 svr_db_src_dir = src_dir + '/service/resource-encapsulation/examples/linux/secureResourceExample/'
80 svr_db_build_dir = env.get('BUILD_DIR') +'/service/resource-encapsulation/examples/linux/secureResourceExample/'
81 sample_env.Alias("install", sample_env.Install( svr_db_build_dir,
82                 svr_db_src_dir + 'oic_svr_db_client.json'))
83 sample_env.Alias("install", sample_env.Install( svr_db_build_dir,
84                 svr_db_src_dir + 'oic_svr_db_server.json'))