Imported Upstream version 1.0.1
[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, sys
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 #Raml Parser
33 SConscript('ramlparser/SConscript')
34
35 target_os = env.get('TARGET_OS')
36 ######################################################################
37 # Build flags
38 ######################################################################
39 simulator_env.AppendUnique(CPPPATH = ['inc', 'src/client-controller', 'src/service-provider', 'src/common'])
40 simulator_env.AppendUnique(CPPPATH = [
41                 '../../resource/include/',
42                 '../../resource/csdk/stack/include',
43                 '../../resource/c_common/ocrandom/include',
44                 '../../resource/csdk/logger/include',
45                 '../../resource/oc_logger/include',
46                 './ramlparser/raml',
47                 './ramlparser/raml/model',              
48                 './ramlparser/raml/jsonSchemaParser',   
49                 '../../extlibs/yaml/yaml/include'
50                 ])
51
52 # Including Java path for building JNI files
53 try:
54         os.environ['JAVA_HOME']
55 except KeyError:
56         print '''
57 *************************************** Error *********************************
58 * JAVA_HOME environment variable not set                                      
59 * Simulator has dependency on java, Please set environment variable JAVA_HOME
60 *******************************************************************************
61         '''
62         sys.exit(1)
63         
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)
69
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'])
73
74 simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
75
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')
82                 ]
83 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
84
85 simulator_env.InstallTarget(simulatorsdk, 'libSimulator')
86
87 #Build sample application
88 SConscript('examples/server/SConscript')
89 SConscript('examples/client-controller/SConscript')