ce9a46cea49a844783995c06a4db1a19648ee277
[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                 './ramlparser/raml',
44                 './ramlparser/raml/model',              
45                 '../../extlibs/yaml/yaml/include'
46                 ])
47
48 # Including Java path for building JNI files
49 try:
50         os.environ['JAVA_HOME']
51 except KeyError:
52         print '''
53 *************************************** Error *********************************
54 * JAVA_HOME environment variable not set                                      
55 * Simulator has dependency on java, Please set environment variable JAVA_HOME
56 *******************************************************************************
57         '''
58         sys.exit(1)
59         
60 java_headers = [os.path.join(os.environ['JAVA_HOME'], 'include')]
61 java_headers.append(os.path.join(java_headers[0], 'win32'))
62 java_headers.append(os.path.join(java_headers[0], 'linux'))
63 java_headers.append(os.path.join(java_headers[0], 'solaris'))
64 simulator_env.AppendUnique(CPPPATH = java_headers)
65
66 simulator_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
67 simulator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap','RamlParser','YamlParser'])
68 simulator_env.AppendUnique(LIBS = ['pthread'])
69
70 simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
71
72 ######################################################################
73 # Source files and Targets
74 ######################################################################
75 simulator_src = [env.Glob('src/*.cpp'), env.Glob('java/jni/*.cpp')]
76 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
77
78 simulator_env.InstallTarget(simulatorsdk, 'libSimulator')
79
80 #Build sample application
81 SConscript('examples/server/SConscript')
82 SConscript('examples/client-controller/SConscript')
83 #Raml Parser
84 SConscript('ramlparser/SConscript')