Base code for simulator module.
[platform/upstream/iotivity.git] / service / simulator / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 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 # Simulator build script
23 ##
24
25 import os
26 Import('env')
27
28 lib_env = env.Clone()
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
30 simulator_env = lib_env.Clone()
31
32 target_os = env.get('TARGET_OS')
33 ######################################################################
34 # Build flags
35 ######################################################################
36 simulator_env.AppendUnique(CPPPATH = ['inc', 'src'])
37 simulator_env.AppendUnique(CPPPATH = [
38                 '../../resource/include/',
39                 '../../resource/csdk/stack/include',
40                 '../../resource/csdk/ocrandom/include',
41                 '../../resource/csdk/logger/include',
42                 '../../resource/oc_logger/include',
43                 ])
44
45 # Including Java path for building JNI files
46 java_home = ARGUMENTS.get('JAVA_HOME', 0)
47 if not java_home:
48         print '''
49         *************************************** Error *********************************
50         * JAVA_HOME variable not set in scons command                                 *
51         *******************************************************************************
52         '''
53 else:   
54         java_headers = [os.path.join(java_home, 'include')]
55         java_headers.append(os.path.join(java_headers[0], 'win32'))
56         java_headers.append(os.path.join(java_headers[0], 'linux'))
57         java_headers.append(os.path.join(java_headers[0], 'solaris'))
58         simulator_env.AppendUnique(CPPPATH = java_headers)
59
60 simulator_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
61 simulator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
62 simulator_env.AppendUnique(LIBS = ['pthread'])
63
64 simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
65
66 ######################################################################
67 # Source files and Targets
68 ######################################################################
69 simulator_src = [env.Glob('src/*.cpp'), env.Glob('java/jni/*.cpp')]
70 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
71
72 simulator_env.InstallTarget(simulatorsdk, 'libSimulator')
73
74 #Build sample application
75 SConscript('examples/server/SConscript')