1 #******************************************************************
3 # Copyright 2014 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # Simulator build script
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
30 simulator_env = lib_env.Clone()
33 SConscript('ramlparser/SConscript')
35 target_os = env.get('TARGET_OS')
36 ######################################################################
38 ######################################################################
39 simulator_env.AppendUnique(CPPPATH = ['inc', 'src/client', 'src/server', 'src/common'])
40 simulator_env.AppendUnique(CPPPATH = [
41 '../../resource/include/',
42 '../../resource/csdk/stack/include',
43 '../../resource/csdk/ocrandom/include',
44 '../../resource/csdk/logger/include',
45 '../../resource/oc_logger/include',
47 './ramlparser/raml/model',
48 './ramlparser/raml/jsonSchemaParser',
49 '../../extlibs/yaml/yaml/include'
52 # Including Java path for building JNI files
54 os.environ['JAVA_HOME']
57 *************************************** Error *********************************
58 * JAVA_HOME environment variable not set
59 * Simulator has dependency on java, Please set environment variable JAVA_HOME
60 *******************************************************************************
64 java_headers = [os.path.join(os.environ['JAVA_HOME'], 'include')]
65 java_headers.append(os.path.join(java_headers[0], 'win32'))
66 java_headers.append(os.path.join(java_headers[0], 'linux'))
67 java_headers.append(os.path.join(java_headers[0], 'solaris'))
68 simulator_env.AppendUnique(CPPPATH = java_headers)
70 simulator_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
71 simulator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap','RamlParser','YamlParser'])
72 simulator_env.AppendUnique(LIBS = ['pthread'])
74 simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
76 ######################################################################
77 # Source files and Targets
78 ######################################################################
79 simulator_src = [env.Glob('src/*.cpp')
80 ,env.Glob('src/*/*.cpp')
81 ,env.Glob('java/jni/*.cpp')
83 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
85 simulator_env.InstallTarget(simulatorsdk, 'libSimulator')
87 #Build sample application
88 SConscript('examples/server/SConscript')
89 SConscript('examples/client/SConscript')