606850112422686113e5ff25863a06fd41402054
[platform/upstream/iotivity.git] / service / basis / common / primitiveResource / SConscript
1 #******************************************************************\r
2 #\r
3 # Copyright 2015 Samsung Electronics All Rights Reserved.\r
4 #\r
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 #\r
7 # Licensed under the Apache License, Version 2.0 (the "License");\r
8 # you may not use this file except in compliance with the License.\r
9 # You may obtain a copy of the License at\r
10 #\r
11 #      http://www.apache.org/licenses/LICENSE-2.0\r
12 #\r
13 # Unless required by applicable law or agreed to in writing, software\r
14 # distributed under the License is distributed on an "AS IS" BASIS,\r
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 # See the License for the specific language governing permissions and\r
17 # limitations under the License.\r
18 #\r
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 ##\r
22 # things_manager project build script\r
23 ##\r
24 import os\r
25 Import('env')\r
26 \r
27 # Add third party libraries\r
28 lib_env = env.Clone()\r
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')\r
30 \r
31 src_dir = lib_env.get('SRC_DIR')\r
32 \r
33 service_common_env = lib_env.Clone()\r
34 target_os = env.get('TARGET_OS')\r
35 \r
36 ######################################################################\r
37 # Build flags\r
38 ######################################################################\r
39 service_common_env.AppendUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs', 'include', 'src'])\r
40 \r
41 if target_os not in ['windows', 'winrt']:\r
42     service_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])\r
43     if target_os != 'android':\r
44         service_common_env.AppendUnique(CXXFLAGS = ['-pthread'])\r
45 \r
46 if target_os == 'android':\r
47     service_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])\r
48     service_common_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])\r
49 \r
50 service_common_env.AppendUnique(LIBS = ['dl'])\r
51 \r
52 ######################################################################\r
53 # Source files and Targets\r
54 ######################################################################\r
55 service_common_src = env.Glob('src/*.cpp')\r
56 service_common_static = service_common_env.StaticLibrary('ServiceCommon', service_common_src)\r
57 service_common_shared = service_common_env.SharedLibrary('ServiceCommon', service_common_src)\r
58 \r
59 service_common_env.InstallTarget([service_common_static,service_common_shared], 'libServiceCommon')\r
60 \r
61 ######################################################################\r
62 # Build Test\r
63 ######################################################################\r
64 service_common_test_env = service_common_env.Clone();\r
65 service_common_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])\r
66 \r
67 gtest = File(src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs/libgtest.a')\r
68 gtest_main = File(src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs/libgtest_main.a')\r
69 \r
70 service_common_test_env.PrependUnique(LIBS = [\r
71     'oc',\r
72     'octbstack',\r
73     'oc_logger',\r
74     'connectivity_abstraction',\r
75     'coap',\r
76     'libServiceCommon',\r
77     gtest,\r
78     gtest_main\r
79     ])\r
80 \r
81 service_common_test_src = env.Glob('unittests/*.cpp')\r
82 \r
83 service_common_test = service_common_test_env.Program('service_common_test', service_common_test_src)\r
84 Alias("service_common_test", service_common_test)\r
85 env.AppendTarget('service_common_test')