Convert line delimiters to unix style of scon script
[platform/upstream/iotivity.git] / service / basis / common / primitiveResource / 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 # things_manager project build script
23 ##
24 import os
25 Import('env')
26
27 # Add third party libraries
28 lib_env = env.Clone()
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
30
31 src_dir = lib_env.get('SRC_DIR')
32
33 service_common_env = lib_env.Clone()
34 target_os = env.get('TARGET_OS')
35
36 ######################################################################
37 # Build flags
38 ######################################################################
39 service_common_env.AppendUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs', 'include', 'src'])
40
41 if target_os not in ['windows', 'winrt']:
42     service_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
43     if target_os != 'android':
44         service_common_env.AppendUnique(CXXFLAGS = ['-pthread'])
45
46 if target_os == 'android':
47     service_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
48     service_common_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
49
50 service_common_env.AppendUnique(LIBS = ['dl'])
51
52 ######################################################################
53 # Source files and Targets
54 ######################################################################
55 service_common_src = env.Glob('src/*.cpp')
56 service_common_static = service_common_env.StaticLibrary('ServiceCommon', service_common_src)
57 service_common_shared = service_common_env.SharedLibrary('ServiceCommon', service_common_src)
58
59 service_common_env.InstallTarget([service_common_static,service_common_shared], 'libServiceCommon')
60
61 ######################################################################
62 # Build Test
63 ######################################################################
64 service_common_test_env = service_common_env.Clone();
65 service_common_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
66
67 gtest = File(src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs/libgtest.a')
68 gtest_main = File(src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs/libgtest_main.a')
69
70 service_common_test_env.PrependUnique(LIBS = [
71     'oc',
72     'octbstack',
73     'oc_logger',
74     'connectivity_abstraction',
75     'coap',
76     'libServiceCommon',
77     gtest,
78     gtest_main
79     ])
80
81 service_common_test_src = env.Glob('unittests/*.cpp')
82
83 service_common_test = service_common_test_env.Program('service_common_test', service_common_test_src)
84 Alias("service_common_test", service_common_test)
85 env.AppendTarget('service_common_test')