--- /dev/null
+# Factorize pthread configurations in single file
+import os
+
+Import('env')
+
+thread_env = env.Clone()
+target_os = thread_env.get('TARGET_OS')
+
+# Export flags once for all
+compiler = thread_env.get('CC')
+if 'gcc' in compiler:
+ thread_env.AppendUnique(CFLAGS = ['-Wall'])
+ if target_os not in ['android']:
+ thread_env.AppendUnique(CFLAGS = ['-pthread'])
+ thread_env.AppendUnique(LIBS = ['pthread'])
+
+Return('thread_env')
# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
-Import('env')
-
-provisioning_env = env.Clone()
+provisioning_env = SConscript('#build_common/thread.scons')
+target_os = provisioning_env.get('TARGET_OS')
root_dir = './../../../../'
######################################################################
'../../../../extlibs/asn1cert',
'ck_manager/include'
])
-target_os = env.get('TARGET_OS')
-if target_os != 'tizen':
+if target_os not in ['tizen']:
provisioning_env.AppendUnique(CPPPATH = ['../../../../extlibs/sqlite3'])
provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
-if target_os not in ['windows']:
- provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
-if target_os not in ['windows', 'msys_nt']:
- provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
- # Note: 'pthread' is in libc for android.
- # On other platforms, if use new gcc(>4.9?) it isn't required, otherwise, it's required
- if target_os != 'android':
- provisioning_env.AppendUnique(LIBS = ['dl', 'pthread'])
-
-provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+
+if 'g++' in provisioning_env.get('CXX'):
+ provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+
+provisioning_env.AppendUnique(LIBPATH = [provisioning_env.get('BUILD_DIR')])
provisioning_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
provisioning_env.AppendUnique(LIBS = ['tinydtls'])
-if env.get('DTLS_WITH_X509') == '1':
+if provisioning_env.get('DTLS_WITH_X509') == '1':
provisioning_env.AppendUnique(LIBS = ['CKManager', 'asn1'])
if target_os not in ['msys_nt', 'windows', 'android']:
if target_os in ['windows', 'msys_nt']:
provisioning_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi', 'timer'])
-if target_os == 'tizen':
+if target_os in ['tizen']:
provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
-if target_os == 'android':
+if target_os in ['android']:
provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
provisioning_env.AppendUnique(LIBS = ['gnustl_static'])
- if not env.get('RELEASE'):
+ if not provisioning_env.get('RELEASE'):
provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os in ['darwin', 'ios']:
provisioning_env.InstallTarget(provisioningserver, 'ocpmapi')
provisioning_env.UserInstallTargetLib(provisioningserver, 'ocpmapi')
-if env.get('DTLS_WITH_X509') == '1':
+if provisioning_env.get('DTLS_WITH_X509') == '1':
SConscript('ck_manager/SConscript')
if target_os in ['linux', 'msys_nt', 'windows']:
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-Import('env')
-target_os = env.get('TARGET_OS')
-samples_env = env.Clone()
-with_ra = env.get ('WITH_RA')
+thread_env = SConscript('#build_common/thread.scons')
+samples_env = thread_env.Clone()
+target_os = samples_env.get('TARGET_OS')
+with_ra = samples_env.get ('WITH_RA')
+
######################################################################
# Build flags
######################################################################
'../../../../../connectivity/lib/libcoap-4.1.1'
])
-compiler = env.get('CXX')
+compiler = samples_env.get('CXX')
if 'g++' in compiler:
- samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
- samples_env.AppendUnique(LIBS=['pthread'])
-samples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+ samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+
+samples_env.AppendUnique(RPATH = [samples_env.get('BUILD_DIR')])
+samples_env.AppendUnique(LIBPATH = [samples_env.get('BUILD_DIR')])
samples_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction', 'coap'])
if target_os not in ['windows']:
samples_env.PrependUnique(LIBS = ['m'])
-if env.get('SECURED') == '1':
+if samples_env.get('SECURED') == '1':
samples_env.AppendUnique(LIBS = ['tinydtls'])
samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
list_of_samples.append (ocremoteaccessclient)
Alias("samples", list_of_samples)
-env.AppendTarget('samples')
+samples_env.AppendTarget('samples')
cp -R ./resource/csdk/stack/samples/tizen/build/packaging/*.spec $sourcedir/tmp/packaging
cp -R ./resource $sourcedir/tmp/
cp -R ./build_common/external_libs.scons $sourcedir/tmp/
+mkdir -p $sourcedir/tmp/build_common/
+cp -a ./build_common/*.scons $sourcedir/tmp/build_common/
# copy dependency RPMs and conf files for tizen build
cp ./tools/tizen/*.rpm $sourcedir/tmp
##
# Examples build script
##
-Import('env')
+thread_env = SConscript('#build_common/thread.scons')
+lib_env = thread_env.Clone()
+
# Add third party libraries
-lib_env = env.Clone()
SConscript('#resource/third_party_libs.scons', 'lib_env')
-
examples_env = lib_env.Clone()
-
+target_os = examples_env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
'../oc_logger/include'
])
-target_os = env.get('TARGET_OS')
-if target_os not in ['windows']:
- 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 = ['pthread'])
-
-examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-examples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
+examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
examples_env.PrependUnique(LIBS = ['coap'])
examples_env.AppendUnique(LIBS = ['connectivity_abstraction'])
examples_env.AppendUnique(LIBS = ['oc_logger'])
examples_env.AppendUnique(LIBS = ['octbstack'])
examples_env.AppendUnique(LIBS = ['oc'])
+compiler = examples_env.get('CXX')
+if 'g++' in compiler:
+ examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+
if target_os in ['msys_nt', 'windows']:
examples_env.PrependUnique(LIBS = ['mswsock', 'ws2_32', 'iphlpapi', 'ole32'])
##
# Examples build script
##
-Import('env')
+thread_env = SConscript('#build_common/thread.scons')
+lib_env = thread_env.Clone()
+target_os = lib_env.get('TARGET_OS')
+
# Add third party libraries
-lib_env = env.Clone()
SConscript('#resource/third_party_libs.scons', 'lib_env')
-with_ra = env.get('WITH_RA')
-with_ra_ibb = env.get('WITH_RA_IBB')
+with_ra = lib_env.get('WITH_RA')
+with_ra_ibb = lib_env.get('WITH_RA_IBB')
examples_env = lib_env.Clone()
'../../csdk/security/provisioning/include/internal'
])
-target_os = env.get('TARGET_OS')
-if target_os not in ['windows']:
- 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 = ['dl','pthread'])
-
-examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-examples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
+examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
'oc_logger', 'connectivity_abstraction', 'coap'])
if with_ra_ibb:
if with_ra:
examples_env.AppendUnique(LIBS = ['ra_xmpp'])
-if env.get('SECURED') == '1':
+if examples_env.get('SECURED') == '1':
examples_env.AppendUnique(LIBS = ['tinydtls'])
examples_env.AppendUnique(LIBS = ['timer'])
-if env.get('DTLS_WITH_X509') == '1':
+if examples_env.get('DTLS_WITH_X509') == '1':
examples_env.AppendUnique(LIBS = ['CKManager'])
examples_env.AppendUnique(LIBS = ['asn1'])
-if target_os == 'android':
+if 'g++' in examples_env.get('CXX'):
+ examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+
+if target_os in ['android']:
examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
examples_env.AppendUnique(LIBS = ['gnustl_shared'])
- if not env.get('RELEASE'):
+ if not examples_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
######################################################################
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/'
+svr_db_build_dir = examples_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')
-
+examples_env.AppendTarget('examples')
##
# OCLib (share library) build script
##
-Import('env')
-
import os
+thread_env = SConscript('#build_common/thread.scons')
+lib_env = thread_env.Clone()
# Add third party libraries
-lib_env = env.Clone()
SConscript('#resource/third_party_libs.scons', 'lib_env')
oclib_env = lib_env.Clone()
secured = lib_env.get('SECURED')
+target_os = oclib_env.get('TARGET_OS')
+
######################################################################
# Build flags
######################################################################
'../csdk/connectivity/api'
])
-oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+oclib_env.AppendUnique(LIBPATH = [oclib_env.get('BUILD_DIR')])
oclib_env.AppendUnique(LIBS = ['oc_logger'])
oclib_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'ocsrm'])
-target_os = env.get('TARGET_OS')
-if target_os in ['linux']:
- oclib_env.AppendUnique(LIBS = ['pthread'])
-
-if target_os not in ['windows']:
- oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
+if 'g++' in oclib_env.get('CXX'):
+ oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+ oclib_env.AppendUnique(CXXFLAGS = ['-Wall'])
+ oclib_env.AppendUnique(CXXFLAGS = ['-fPIC'])
if target_os not in ['darwin', 'ios', 'windows']:
oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
if target_os == 'tizen':
oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
-if target_os in ['linux'] and env.get('SIMULATOR', False):
- oclib_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
+if target_os in ['linux'] and oclib_env.get('SIMULATOR', False):
+ oclib_env.Append( RPATH = oclib_env.Literal('\\$$ORIGIN'))
if target_os in ['msys_nt', 'windows']:
- oclib_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'oc_logger')])
- oclib_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(oclib_env.get('BUILD_DIR'), 'resource', 'oc_logger')])
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(oclib_env.get('BUILD_DIR'), 'resource', 'csdk')])
oclib_env.AppendUnique(LIBS=['octbstack', 'logger', 'oc_logger','connectivity_abstraction', 'ocsrm', 'c_common', 'routingmanager'])
oclib_env.AppendUnique(LIBS=[ 'coap', 'ws2_32' ,'iphlpapi'])
if secured == '1':
oclib = oclib_env.SharedLibrary('oc', oclib_src)
oclib_env.InstallTarget(oclib, 'oc')
oclib_env.UserInstallTargetLib(oclib, 'oc')
-header_dir = env.get('SRC_DIR') + '/resource/include/'
+header_dir = os.path.join(oclib_env.get('SRC_DIR') , 'resource' , 'include') + os.sep
oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
oclib_env.UserInstallTargetHeader(header_dir + 'OCDirectPairing.h', 'resource', 'OCDirectPairing.h')
# Add Provisioning library
-if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1':
+if target_os in ['linux', 'android', 'tizen'] and secured == '1':
SConscript('../provisioning/SConscript')