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 src_dir = env.get('SRC_DIR')
30 SConscript(src_dir + '/service/third_party_libs.scons', 'lib_env')
31 simulator_env = lib_env.Clone()
34 SConscript('ramlparser/SConscript')
36 target_os = env.get('TARGET_OS')
37 ######################################################################
39 ######################################################################
40 simulator_env.AppendUnique(CPPPATH = ['inc', 'src/client', 'src/server', 'src/common'])
41 simulator_env.AppendUnique(CPPPATH = [
42 '../../resource/include/',
43 '../../resource/csdk/stack/include',
44 '../../resource/c_common/ocrandom/include',
45 '../../resource/csdk/logger/include',
46 '../../resource/oc_logger/include',
48 './ramlparser/raml/model',
49 './ramlparser/raml/jsonSchemaParser',
50 '../../extlibs/yaml/yaml/include'
53 # Including Java path for building JNI files
55 os.environ['JAVA_HOME']
58 *************************************** Error *********************************
59 * JAVA_HOME environment variable not set
60 * Simulator has dependency on java, Please set environment variable JAVA_HOME
61 *******************************************************************************
65 java_headers = [os.path.join(os.environ['JAVA_HOME'], 'include')]
66 java_headers.append(os.path.join(java_headers[0], 'win32'))
67 java_headers.append(os.path.join(java_headers[0], 'linux'))
68 java_headers.append(os.path.join(java_headers[0], 'solaris'))
69 simulator_env.AppendUnique(CPPPATH = java_headers)
71 simulator_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
73 simulator_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
74 simulator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'RamlParser'])
75 simulator_env.AppendUnique(LIBS = ['pthread'])
77 simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-Wall', '-fmessage-length=0', '-std=c++0x'])
79 ######################################################################
80 # Source files and Targets
81 ######################################################################
82 simulator_src = [env.Glob('src/*.cpp')
83 ,env.Glob('src/*/*.cpp')
84 ,env.Glob('java/jni/*.cpp')
86 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
88 simulator_env.InstallTarget(simulatorsdk, 'libSimulatorManager')
90 #Build sample application
91 SConscript('examples/server/SConscript')
92 SConscript('examples/client/SConscript')