d544610ea8d2e55c197ac2cb8bfb559462637cbc
[platform/upstream/iotivity.git] / service / basis / resourceContainer / 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 # resource container 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 resource_container_env = lib_env.Clone()
32 target_os = env.get('TARGET_OS')
33 ######################################################################
34 # Build flags
35 ######################################################################
36 resource_container_env.AppendUnique(
37         CPPPATH = [
38                 env.get('SRC_DIR')+'/extlibs', 
39                 'include', 
40                 'src',
41                 '../serverBuilder/include',
42                 '../common/primitiveResource/include'
43         ])
44
45 if target_os not in ['windows', 'winrt']:
46     resource_container_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
47     if target_os != 'android':
48         resource_container_env.AppendUnique(CXXFLAGS = ['-pthread'])
49
50 if target_os == 'android':
51     resource_container_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
52     resource_container_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
53         
54 #resource_container_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
55 resource_container_env.PrependUnique(LIBS = ['ServerBuilder', 'ServiceCommon', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', 'coap'])
56 resource_container_env.AppendUnique(LIBS = ['dl'])
57
58 ######################################################################
59 # Source files and Targets
60 ######################################################################
61 res_container_src = env.Glob('src/*.cpp')
62 res_container_static = resource_container_env.StaticLibrary('ResContainerLib', res_container_src)
63 res_container_shared = resource_container_env.SharedLibrary('ResContainerLib', res_container_src)
64
65 resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer')
66
67 #resource_container_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
68
69 #containertestapp = resource_container_env.Program('ContainerTest', res_container_src)
70 #Alias("containertest", containertestapp)
71 #env.AppendTarget('containertest')
72
73 #Go to build sample apps
74 #SConscript('resource-container/examples/SHPBundle/SConscript')
75
76 ######################################################################
77 # build Sample Resource Bundle
78 ######################################################################
79 SConscript('resource-container/examples/SampleBundle/SConscript')
80
81 sample_resource_bundle_env = resource_container_env.Clone()
82 sample_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
83
84 SAMPLE_RESOURCE_BUNDLE_DIR = 'examples/SampleBundle/'
85 sample_resource_bundle_env.AppendUnique(CPPPATH = [
86                 SAMPLE_RESOURCE_BUNDLE_DIR + 'include',
87                 'include/'
88                 ])              
89                 
90
91 sample_resource_bundle_src = [ Glob(SAMPLE_RESOURCE_BUNDLE_DIR + 'src/*.cpp'), Glob('src/*.cpp')]
92
93 SampleBundle = sample_resource_bundle_env.SharedLibrary('SampleBundle', sample_resource_bundle_src)
94 sample_resource_bundle_env.InstallTarget(SampleBundle, 'libSampleBundle')
95
96 ######################################################################
97 # Build Container Test
98 ######################################################################
99 containertest_env = resource_container_env.Clone();
100 #containertest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
101
102 # Copy test configuration
103 Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
104 Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml")
105
106 containertestapp = containertest_env.Program('ContainerTest', res_container_src)
107 Alias("containertest", containertestapp)
108 env.AppendTarget('containertest')