1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH 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 # Examples build script
24 thread_env = SConscript('#build_common/thread.scons')
25 lib_env = thread_env.Clone()
27 # Add third party libraries
28 SConscript('#resource/third_party_libs.scons', 'lib_env')
29 examples_env = lib_env.Clone()
30 target_os = examples_env.get('TARGET_OS')
31 ######################################################################
33 ######################################################################
34 examples_env.AppendUnique(CPPPATH = [
36 '../csdk/stack/include',
37 '../c_common/ocrandom/include',
38 '../csdk/logger/include',
39 '../oc_logger/include'
42 examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
43 examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
44 examples_env.PrependUnique(LIBS = ['coap'])
45 examples_env.AppendUnique(LIBS = ['connectivity_abstraction'])
46 examples_env.AppendUnique(LIBS = ['oc_logger'])
47 examples_env.AppendUnique(LIBS = ['octbstack'])
48 examples_env.AppendUnique(LIBS = ['oc'])
50 compiler = examples_env.get('CXX')
52 examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
54 if target_os in ['msys_nt', 'windows']:
55 examples_env.PrependUnique(LIBS = ['mswsock', 'ws2_32', 'iphlpapi', 'ole32'])
57 if examples_env.get('SECURED') == '1':
58 examples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
59 examples_env.AppendUnique(CPPDEFINES = ['_WITH_DTLS_'])
60 if target_os in ['msys_nt', 'windows']:
61 examples_env.AppendUnique(LIBS = ['advapi32'])
63 if target_os == 'android':
64 examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
65 examples_env.AppendUnique(LIBS = ['gnustl_shared'])
67 if not examples_env.get('RELEASE'):
68 examples_env.AppendUnique(LIBS = ['log'])
70 if target_os in ['darwin', 'ios']:
71 examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
73 if examples_env.get('WITH_CLOUD'):
74 examples_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
76 if target_os in ['msys_nt', 'windows']:
77 examples_env.AppendUnique(LIBS = ['Comctl32', 'Gdi32', 'User32'])
79 if examples_env.get('LOGGING'):
80 examples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
82 def make_single_file_cpp_program(program_name):
83 return examples_env.Program(program_name, program_name + ".cpp")
85 ######################################################################
86 # Source files and Targets
87 ######################################################################
89 'simpleserver', 'simpleclient',
91 'directpairingclient',
92 'devicediscoveryserver', 'devicediscoveryclient',
93 'simpleserverHQ', 'simpleclientHQ',
96 if target_os not in ['windows', 'msys_nt']:
98 'fridgeserver', 'fridgeclient',
99 'presenceserver', 'presenceclient',
100 'roomserver', 'roomclient',
109 examples = map(make_single_file_cpp_program, example_names)
111 ######################################################################
113 ######################################################################
114 clientjson = examples_env.Install(examples_env.get('BUILD_DIR') + '/resource/examples/',
115 examples_env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_client.dat')
116 serverjson = examples_env.Install(examples_env.get('BUILD_DIR') + '/resource/examples/',
117 examples_env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_server.dat')
118 directpairingdat = examples_env.Install(examples_env.get('BUILD_DIR') + '/resource/examples/',
119 examples_env.get('SRC_DIR') + '/resource/examples/' + 'oic_svr_db_client_directpairing.dat')
121 examples += [clientjson, serverjson, directpairingdat]
123 if target_os in ['msys_nt', 'windows']:
124 winUIClient = examples_env.Program('winUIClient', ['winuiclientgui.cpp', 'winuiclient.cpp'])
125 mediaserver = examples_env.Program('mediaserver', 'mediaserver.cpp')
126 examples += [winUIClient, mediaserver]
128 Alias("examples", examples)
129 examples_env.AppendTarget('examples')