Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / extlibs / raxmpp / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Intel Mobile Communications GmbH 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 # raxmpp library build script
23 #
24 ######################################################################
25 import os
26 import commands
27
28 Import('env')
29
30 src_dir = env.get('SRC_DIR')
31 target_os = env.get('TARGET_OS')
32 target_arch = env.get('TARGET_ARCH')
33 with_ra = env.get('WITH_RA')
34 if with_ra:
35         # check 'raxmppl' library, if it doesn't exits, ask user to download it
36         if not os.path.exists('raxmpp'):
37                 print '''
38         *********************************** Error: ***********************************************
39         * Please download ra_xmpp as following :
40         *     $ git clone https://gerrit.iotivity.org/gerrit/iotivity-xmpp extlibs/raxmpp/raxmpp
41         ******************************************************************************************
42         '''
43                 Exit(1)
44
45         print 'building with ra_xmpp'
46         if env.get('RELEASE'):
47                 print src_dir
48                 build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out', target_os, target_arch, 'release/')
49         else:
50                 build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out/', target_os, target_arch, 'debug/')
51         os.chdir('raxmpp')
52         sconsflags = ' RELEASE=true' if  env['RELEASE'] else ' RELEASE=false'
53         foo=commands.getoutput('scons external' + sconsflags )
54         print foo
55         foo=commands.getoutput('scons' + sconsflags )
56         print foo
57
58         env.AppendUnique(CPPPATH = src_dir+'/extlibs/raxmpp/raxmpp/ra_xmpp/',
59                                 LIBPATH=build_dir,
60                                 RPATH = build_dir)