Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / src / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 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 # OCLib (share library) build script
23 ##
24 Import('env')
25
26 # Add third party libraries
27 lib_env = env.Clone()
28 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29
30 oclib_env = lib_env.Clone()
31 ######################################################################
32 # Build flags
33 ######################################################################
34 oclib_env.AppendUnique(CPPPATH = [
35                 '../include/',
36                 '../csdk/stack/include',
37                 '../csdk/ocrandom/include',
38                 '../csdk/logger/include',
39                 '../oc_logger/include',
40                 '../csdk/connectivity/lib/libcoap-4.1.1'
41                 ])
42
43 target_os = env.get('TARGET_OS')
44 if target_os not in ['windows', 'winrt']:
45         oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
46
47 if target_os == 'android':
48         oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
49         oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
50         oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger', 'boost_thread', 'gnustl_shared', 'log'])
51
52 if target_os in ['darwin', 'ios']:
53         oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
54         oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
55
56 ######################################################################
57 # Source files and Targets
58 ######################################################################
59 oclib_src = [
60                 'OCPlatform.cpp',
61                 'OCPlatform_impl.cpp',
62                 'OCResource.cpp',
63                 'OCUtilities.cpp',
64                 'OCException.cpp',
65                 'OCRepresentation.cpp',
66                 'InProcServerWrapper.cpp',
67                 'InProcClientWrapper.cpp',
68                 'OCResourceRequest.cpp'
69         ]
70
71 oclib = oclib_env.SharedLibrary('oc', oclib_src)
72 oclib_env.InstallTarget(oclib, 'liboc')
73 oclib_env.UserInstallTargetLib(oclib, 'liboc')
74