Commit a8c4123b authored by Ravi Nanjundappa's avatar Ravi Nanjundappa Committed by Erich Keane

Fix for the Jira issue IOT-524

This patch addresses the first part of IOT-524.
Added the --prefix option to install all the build output files
in the user preferred location, if opted for.
All exe files will go into PREFIX/bin and all library files will
go into PREFIX/lib
For ex: /home/XYZ/bin and /home/XYZ/lib

Change-Id: Id1ab0fe0ca0ed0b3b86095df87f172448c366daf
Signed-off-by: default avatarRavi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1439Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarJon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: default avatarYounghyun Joo <yh_.joo@samsung.com>
Reviewed-by: default avatarMinji Park <minjii.park@samsung.com>
Reviewed-by: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent bd2e4dad
......@@ -90,6 +90,14 @@ help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_up
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Arduino)', device_name, None, None),)
AddOption('--prefix',
dest='prefix',
type='string',
nargs=1,
action='store',
metavar='DIR',
help='installation prefix')
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
######################################################################
......@@ -107,7 +115,7 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil
tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
)
else:
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os)
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
Help(help_vars.GenerateHelpText(env))
......@@ -188,6 +196,22 @@ def __install(ienv, targets, name):
Alias(name, i_n)
env.AppendUnique(TS = [name])
def __installlib(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/lib', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __installbin(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/bin', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __append_target(ienv, name, targets = None):
if targets:
env.Alias(name, targets)
......@@ -211,6 +235,8 @@ env.AddMethod(__print_targets, 'PrintTargets')
env.AddMethod(__src_to_obj, 'SrcToObj')
env.AddMethod(__append_target, 'AppendTarget')
env.AddMethod(__install, 'InstallTarget')
env.AddMethod(__installlib, 'UserInstallTargetLib')
env.AddMethod(__installbin, 'UserInstallTargetBin')
env.SetDir(env.GetLaunchDir())
env['ROOT_DIR']=env.GetLaunchDir()+'/..'
......
......@@ -97,4 +97,5 @@ if not env.get('RELEASE'):
samples_env.AppendTarget('samples')
env.InstallTarget(libtinydtls, 'libtinydtls');
env.UserInstallTargetLib(libtinydtls, 'libtinydtls');
......@@ -23,3 +23,4 @@ compatibilitylib_src = ['OCAndroid.cpp']
if target_os == 'android':
static_compatibilitylib = compatibilitylib_env.StaticLibrary('compatibility', compatibilitylib_src)
compatibilitylib_env.InstallTarget(static_compatibilitylib, 'libcompatibility')
compatibilitylib_env.UserInstallTargetLib(static_compatibilitylib, 'libcompatibility')
......@@ -50,3 +50,4 @@ common_src = [
commonlib = common_env.StaticLibrary('c_common', common_src)
common_env.InstallTarget(commonlib, 'c_common')
common_env.UserInstallTargetLib(commonlib, 'c_common')
......@@ -115,8 +115,10 @@ liboctbstack_src = [
if target_os in ['arduino','darwin','ios'] :
static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
liboctbstack_env.UserInstallTargetLib(static_liboctbstack, 'liboctbstack')
else:
static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
liboctbstack_env.UserInstallTargetLib([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
......@@ -68,6 +68,14 @@ help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_va
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
AddOption('--prefix',
dest='prefix',
type='string',
nargs=1,
action='store',
metavar='DIR',
help='installation prefix')
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
######################################################################
......@@ -85,7 +93,7 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil
tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
)
else:
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os)
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
Help(help_vars.GenerateHelpText(env))
......@@ -161,6 +169,22 @@ def __install(ienv, targets, name):
Alias(name, i_n)
env.AppendUnique(TS = [name])
def __installlib(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/lib', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __installbin(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/bin', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __append_target(ienv, target):
env.AppendUnique(TS = [target])
......@@ -182,6 +206,8 @@ env.AddMethod(__print_targets, 'PrintTargets')
env.AddMethod(__src_to_obj, 'SrcToObj')
env.AddMethod(__append_target, 'AppendTarget')
env.AddMethod(__install, 'InstallTarget')
env.AddMethod(__installlib, 'UserInstallTargetLib')
env.AddMethod(__installbin, 'UserInstallTargetBin')
env.SetDir(env.GetLaunchDir())
env['ROOT_DIR']=env.GetLaunchDir()+'/..'
......
......@@ -69,3 +69,4 @@ libcoap_src = [
libcoap = libcoap_env.StaticLibrary('libcoap', libcoap_src, OBJPREFIX='libcoap_')
libcoap_env.InstallTarget([libcoap], 'libcoap')
libcoap_env.UserInstallTargetLib([libcoap], 'libcoap')
......@@ -47,5 +47,6 @@ if secured == '1':
libRMInterface = app_env.SharedLibrary('RMInterface', sample_src, OBJPREFIX='libRMInterface_')
app_env.InstallTarget(libRMInterface, 'RMInterface')
app_env.UserInstallTargetLib(libRMInterface, 'RMInterface')
......@@ -47,6 +47,7 @@ if secured == '1':
else:
casample =sample_env.Program('casample', [sample_src])
env.InstallTarget(casample, 'casample')
env.UserInstallTargetBin(casample, 'casample')
......
......@@ -56,6 +56,15 @@ help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL'
help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
AddOption('--prefix',
dest='prefix',
type='string',
nargs=1,
action='store',
metavar='DIR',
help='installation prefix')
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
######################################################################
......@@ -73,7 +82,7 @@ if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compil
tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
)
else:
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os)
env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
Help(help_vars.GenerateHelpText(env))
......@@ -149,6 +158,22 @@ def __install(ienv, targets, name):
def __append_target(ienv, target):
env.AppendUnique(TS = [target])
def __installlib(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/lib', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __installbin(ienv, targets, name):
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/bin', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
def __print_targets(env):
Help('''
===============================================================================
......@@ -167,6 +192,8 @@ env.AddMethod(__print_targets, 'PrintTargets')
env.AddMethod(__src_to_obj, 'SrcToObj')
env.AddMethod(__append_target, 'AppendTarget')
env.AddMethod(__install, 'InstallTarget')
env.AddMethod(__installlib, 'UserInstallTargetLib')
env.AddMethod(__installbin, 'UserInstallTargetBin')
env.SetDir(env.GetLaunchDir())
env['ROOT_DIR']=env.GetLaunchDir()
......
......@@ -108,4 +108,5 @@ if ca_os in ['android', 'tizen']:
else:
calib = env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
env.InstallTarget(calib, 'libconnectivity_abstraction')
env.UserInstallTargetLib(calib, 'libconnectivity_abstraction')
......@@ -99,6 +99,7 @@ libocsrm_src = [
libocsrm = libocsrm_env.StaticLibrary('libocsrm', libocsrm_src)
libocsrm_env.InstallTarget(libocsrm, 'libocsrm')
libocsrm_env.UserInstallTargetLib(libocsrm, 'libocsrm')
if env.get('SECURED') == '1':
SConscript('provisioning/SConscript')
......
......@@ -83,5 +83,6 @@ provisioning_src = [
provisioningserver = provisioning_env.StaticLibrary('ocspapi', provisioning_src)
provisioning_env.InstallTarget(provisioningserver, 'libocspapi')
provisioning_env.UserInstallTargetLib(provisioningserver, 'libocspapi')
SConscript('sample/SConscript')
......@@ -50,6 +50,7 @@ liboc_logger = liboc_logger_env.SharedLibrary('oc_logger',
['c/oc_logger.c', 'c/oc_console_logger.c', 'cpp/oc_ostream_logger.cpp'])
liboc_logger_env.InstallTarget([liboc_logger_core, liboc_logger], 'liboc_logger')
liboc_logger_env.UserInstallTargetLib([liboc_logger_core, liboc_logger], 'liboc_logger')
if target_os not in ['ios', 'android']:
SConscript('examples/SConscript')
......
......@@ -71,4 +71,5 @@ oclib_src = [
oclib_env.AppendUnique(CPPPATH = [oclib_env.get('SRC_DIR') + '/extlibs/cereal/include'])
oclib = oclib_env.SharedLibrary('oc', oclib_src)
oclib_env.InstallTarget(oclib, 'liboc')
oclib_env.UserInstallTargetLib(oclib, 'liboc')
......@@ -74,6 +74,7 @@ else :
notificationsdk = notimgr_env.StaticLibrary('NotificationManager', notimgr_src)
notimgr_env.InstallTarget(notificationsdk, 'libResouceHosting')
notimgr_env.UserInstallTargetLib(notificationsdk, 'libResouceHosting')
# Go to build sample apps
SConscript('SampleApp/SConscript')
......
......@@ -35,3 +35,4 @@ cpluff_src.extend(env.Glob('kazlib/*.c'))
cpluff = cpluff_env.StaticLibrary('cpluff', cpluff_src)
cpluff_env.InstallTarget(cpluff, 'libcpluff')
cpluff_env.UserInstallTargetLib(cpluff, 'libcpluff')
......@@ -64,7 +64,8 @@ pmimpl_env.PrependUnique(LIBS = File(env.get('BUILD_DIR') + '/libcpluff.a'))
pmimpl = pmimpl_env.SharedLibrary('pmimpl', pmimpl_src)
plugin_manager_env.InstallTarget([ppm, pmimpl], 'libppm')
plugin_manager_env.UserInstallTargetLib([ppm, pmimpl], 'libppm')
# Build JNI library for android
if env.get('TARGET_OS') == 'android':
SConscript('src/Android/jni/SConscript')
\ No newline at end of file
SConscript('src/Android/jni/SConscript')
......@@ -31,6 +31,7 @@ ppm_jni_src = ['PluginManager.cpp']
ppm_jni = ppm_jni_env.SharedLibrary('PluginManager', ppm_jni_src)
ppm_jni_env.InstallTarget(ppm_jni, 'libPluginManager')
ppm_jni_env.UserInstallTargetLib(ppm_jni, 'libPluginManager')
######################################################################
# Install the libraries to /libs/<TARGET_ARCH> directory
......@@ -43,6 +44,7 @@ gnu_lib_paths = env.get('LIBPATH')
for gnu_lib_path in gnu_lib_paths:
gnu_lib_path = gnu_lib_path + '/libgnustl_shared.so'
if os.path.exists(gnu_lib_path):
ppm_jni_env.Install(ppm_sdk+'/src/Android/libs/'+env.get('TARGET_ARCH'), gnu_lib_path)
ppm_jni_env.Install(ppm_sdk+'/src/Android/libs/'+env.get('TARGET_ARCH'), gnu_lib_path)
break
......
......@@ -25,5 +25,6 @@ mosquitto_src = env.Glob('*.c')
mosquitto = mosquitto_env.StaticLibrary('mosquitto', mosquitto_src)
mosquitto_env.InstallTarget(mosquitto, 'libmosquitto')
mosquitto_env.UserInstallTargetLib(mosquitto, 'libmosquitto')
SConscript('cpp/SConscript')
......@@ -22,3 +22,4 @@ mosquittopp_env.AppendUnique(LIBS = ['mosquitto', 'ssl', 'crypto'])
######################################################################
mosquittopp = mosquittopp_env.SharedLibrary('mosquittopp', 'mosquittopp.cpp')
mosquittopp_env.InstallTarget(mosquittopp, 'libmosquittopp')
mosquittopp_env.UserInstallTargetLib(mosquittopp, 'libmosquittopp')
......@@ -70,6 +70,7 @@ libssmsdk = sdk_env.StaticLibrary(
source = [ssm_sdk_cpp_src]
)
sdk_env.InstallTarget(libssmsdk, 'libSSMCORE')
sdk_env.UserInstallTargetLib(libssmsdk, 'libSSMCORE')
######################################################################
# build DiscomfortIndexSensor plugin
......@@ -87,6 +88,7 @@ DiscomfortIndexSensor_src = [ Glob(DISCOMFORTINDEXSENSOR_DIR + 'src/*.cpp')]
DiscomfortIndexSensor = DiscomfortIndexSensor_env.SharedLibrary('DiscomfortIndexSensor', DiscomfortIndexSensor_src)
DiscomfortIndexSensor_env.InstallTarget(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
DiscomfortIndexSensor_env.UserInstallTargetLib(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
......@@ -107,6 +109,7 @@ BMISensor_src = [ Glob(BMISENSOR_DIR + 'src/*.cpp')]
BMISensor = BMISensor_env.SharedLibrary('BMISensor', BMISensor_src)
BMISensor_env.InstallTarget(BMISensor, 'libBMISensor')
BMISensor_env.UserInstallTargetLib(BMISensor, 'libBMISensor')
......@@ -162,6 +165,7 @@ shared_libssmcore = ssmcore_env.SharedLibrary(
)
ssmcore_env.InstallTarget([shared_libssmcore, static_libssmcore], 'libSSMCORE')
ssmcore_env.UserInstallTargetLib([shared_libssmcore, static_libssmcore], 'libSSMCORE')
#######################################################################
## build SampleApp
......
......@@ -52,6 +52,7 @@ tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
things_manager_env.UserInstallTargetLib([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
# Build JNI layer
#if target_os == 'android':
......
......@@ -34,6 +34,7 @@ tm_jni_src = [tm_jni_env.Glob('tm/src/*.cpp'), tm_jni_env.Glob('jniutil/src/*.cp
tm_jni = tm_jni_env.SharedLibrary('things-manager-jni', tm_jni_src)
tm_jni_env.InstallTarget(tm_jni, 'libthings-manager-jni')
tm_jni_env.UserInstallTargetLib(tm_jni, 'libthings-manager-jni')
# Install the libraries to /libs/<TARGET_ARCH> directory
tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/liboc_logger.so')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment