#****************************************************************** # # Copyright 2015 Samsung Electronics All Rights Reserved. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## # Examples build script ## Import('env') # Add third party libraries lib_env = env.Clone() SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env') with_ra = env.get('WITH_RA') with_ra_ibb = env.get('WITH_RA_IBB') examples_env = lib_env.Clone() ###################################################################### # Build flags ###################################################################### examples_env.AppendUnique(CPPPATH = [ '../../include/', '../../csdk/stack/include', '../../csdk/logger/include', '../../oc_logger/include', '../../csdk/connectivity/api', '../../csdk/security/include', '../../csdk/security/include/internal', '../../csdk/security/provisioning/include', '../../csdk/security/provisioning/include/oxm', '../../csdk/security/provisioning/include/internal' ]) target_os = env.get('TARGET_OS') if target_os not in ['windows', 'winrt']: examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread']) # Note: 'pthread' is in libc for android. On other platform, if use # new gcc(>4.9?) it isn't required, otherwise, it's required if target_os != 'android': examples_env.AppendUnique(LIBS = ['-lpthread', '-ldl']) examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) examples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')]) examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap']) if with_ra_ibb: examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH']) print "RALIBS = %s" % examples_env['RALIBS'] print "RALIBPATH = %s" % examples_env['RALIBPATH'] print "RARPATH = %s" % examples_env['RARPATH'] examples_env.AppendUnique(LIBS = 'wksxmppxep') else : if with_ra: examples_env.AppendUnique(LIBS = ['ra_xmpp']) if env.get('SECURED') == '1': examples_env.AppendUnique(LIBS = ['tinydtls']) examples_env.AppendUnique(LIBS = ['timer']) if env.get('DTLS_WITH_X509') == '1': examples_env.AppendUnique(LIBS = ['CKManager']) examples_env.AppendUnique(LIBS = ['asn1']) if target_os == 'android': examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) examples_env.AppendUnique(LIBS = ['gnustl_shared']) if not env.get('RELEASE'): examples_env.AppendUnique(LIBS = ['log']) if target_os in ['darwin', 'ios']: examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE']) ###################################################################### # Source files and Targets ###################################################################### provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp') src_dir = examples_env.get('SRC_DIR') svr_db_src_dir = src_dir + '/resource/provisioning/examples/' svr_db_build_dir = env.get('BUILD_DIR') +'/resource/provisioning/examples/' clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json') clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat') Alias("examples", [provisioningclient, clientjson,clientdat]) env.AppendTarget('examples')