From: Markus Jung Date: Wed, 8 Jul 2015 06:56:37 +0000 (+0900) Subject: Resource container build check for external libraries X-Git-Tag: 1.2.0+RC1~1430^2~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=041706dda946f17b124712d55cc3e28dcb8d2287;p=platform%2Fupstream%2Fiotivity.git Resource container build check for external libraries There is now a check for libcurl and the Java environment. If the external libraries are not available, instructions how to install are provided. Change-Id: Iee24b49f86ca64887cc84687d78998917177ce0a Signed-off-by: Markus Jung Reviewed-on: https://gerrit.iotivity.org/gerrit/1576 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/resource-manipulation/modules/resourceContainer/SConscript b/service/resource-manipulation/modules/resourceContainer/SConscript index b1eb87a..45ae6c7 100644 --- a/service/resource-manipulation/modules/resourceContainer/SConscript +++ b/service/resource-manipulation/modules/resourceContainer/SConscript @@ -33,6 +33,23 @@ target_os = env.get('TARGET_OS') ###################################################################### # Build flags ###################################################################### + +try: + print 'Java Home: ', os.environ['JAVA_HOME'] + print 'Java Lib: ', os.environ['JAVA_LIB'] +except KeyError: + print ''' +*********************************** Error ************************************* +* Cannot build resource container. JAVA_HOME or JAVA_LIB are not set properly +* Please configure JAVA_HOME to point to your Java 7 JDK and +* JAVA_LIB to your folder containing libjvm +* Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 +* export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server +******************************************************************************* + ''' + Return() + + resource_container_env.AppendUnique( CPPPATH = [ env.get('SRC_DIR')+'/extlibs', @@ -42,8 +59,8 @@ resource_container_env.AppendUnique( 'src', '../serverBuilder/include', '../common/primitiveResource/include', - '/usr/lib/jvm/java-7-openjdk-i386/include', - '/usr/lib/jvm/java-7-openjdk-i386/include/linux' + os.environ['JAVA_HOME']+'/include', + os.environ['JAVA_HOME']+'/include/linux' ]) if target_os not in ['windows', 'winrt']: @@ -55,7 +72,22 @@ if target_os == 'android': resource_container_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) resource_container_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log']) -resource_container_env.AppendUnique(LIBPATH = ['/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/']) + +resource_container_env.AppendUnique(LIBPATH = [os.environ['JAVA_LIB']]) + +conf = Configure(resource_container_env) +if not conf.CheckLib('jvm'): + print ''' +*********************************** Error ************************************* +* Cannot locate libjvm for resource container. +* Please check your JAVA_LIB to point to your folder containing libjvm. +* Example: export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/ +******************************************************************************* + ''' + resource_container_env = conf.Finish() + Return() +resource_container_env = conf.Finish() + resource_container_env.PrependUnique(LIBS = ['server_builder', 'service_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction']) resource_container_env.AppendUnique(LIBS = ['dl', 'jvm']) @@ -92,21 +124,35 @@ ss_resource_bundle_env.InstallTarget(SoftSensorBundle, 'libSoftSensorBundle') # build hue sample bundle ###################################################################### -hue_resource_bundle_env = resource_container_env.Clone() -hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) - -HUE_RESOURCE_BUNDLE_DIR = 'examples/HueSampleBundle/' -hue_resource_bundle_env.AppendUnique(CPPPATH = [ - HUE_RESOURCE_BUNDLE_DIR + 'include', - 'include/' - ]) +conf2 = Configure(lib_env) +if not conf2.CheckLib('curl'): + print '''X +*********************************** Error ************************************* +* Cannot build hue sample. Please install libcurl. +* Example (Ubuntu): +* sudo apt get install libcurl4-openssl-dev +* sudo ldconfig +* Hint: check with pkg-config --libc libcurl and clear scons cache. +* Skipping hue sample build. +******************************************************************************* + ''' +else: + hue_resource_bundle_env = resource_container_env.Clone() + hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) -hue_resource_bundle_env.PrependUnique(LIBS = ['curl']) + HUE_RESOURCE_BUNDLE_DIR = 'examples/HueSampleBundle/' + hue_resource_bundle_env.AppendUnique(CPPPATH = [ + HUE_RESOURCE_BUNDLE_DIR + 'include', + 'include/' + ]) + + hue_resource_bundle_env.PrependUnique(LIBS = ['curl']) + + hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp'), Glob('src/*.cpp')] -hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp'), Glob('src/*.cpp')] - -HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) -hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') + HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) + hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') +lib_env = conf2.Finish() ###################################################################### # build resource container unit tests diff --git a/service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTest.cpp b/service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTest.cpp index 51f610b..3f75aff 100644 --- a/service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTest.cpp +++ b/service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTest.cpp @@ -108,7 +108,7 @@ class ResourceContainerImplTest : public Test void SetUp() override { m_pResourceContainer = ResourceContainerImpl::getImplInstance(); - m_pBundleInfo = BundleInfo::createBundleInfo(); + m_pBundleInfo = BundleInfo::build(); } }; @@ -246,4 +246,4 @@ TEST(ConfigurationTest, getResourceConfigurationTestWithInvalideBundleId) config->getResourceConfiguration("test", &resourceConfig); EXPECT_EQ(bundles.empty(), true); -} \ No newline at end of file +} diff --git a/service/resource-manipulation/modules/resourceContainer/unittests/SConscript b/service/resource-manipulation/modules/resourceContainer/unittests/SConscript index c959f24..59e1d3f 100644 --- a/service/resource-manipulation/modules/resourceContainer/unittests/SConscript +++ b/service/resource-manipulation/modules/resourceContainer/unittests/SConscript @@ -24,6 +24,23 @@ import os Import('env') +try: + print 'Java Home: ', os.environ['JAVA_HOME'] + print 'Java Lib: ', os.environ['JAVA_LIB'] +except KeyError: + print ''' +*********************************** Error ************************************* +* Cannot build resource container. JAVA_HOME or JAVA_LIB are not set properly +* Please configure JAVA_HOME to point to your Java 7 JDK and +* JAVA_LIB to your folder containing libjvm +* Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 +* export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/ +******************************************************************************* + ''' + Return() + + + if env.get('RELEASE'): env.AppendUnique(CCFLAGS = ['-Os']) env.AppendUnique(CPPDEFINES = ['NDEBUG']) @@ -60,8 +77,8 @@ container_gtest_env.AppendUnique( '../bundle-api/include', '../../serverBuilder/include', '../../common/primitiveResource/include', - '/usr/lib/jvm/jdk1.8.0_40/include', - '/usr/lib/jvm/jdk1.8.0_40/include/linux' + os.environ['JAVA_HOME']+'/include', + os.environ['JAVA_HOME']+'/include/linux' ]) if target_os not in ['windows', 'winrt']: @@ -77,7 +94,21 @@ if target_os == 'android': container_gtest_env.PrependUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/hippomocks-master', gtest_dir + '/include']) -container_gtest_env.AppendUnique(LIBPATH = ['/usr/lib/jvm/jdk1.8.0_40/jre/lib/amd64/server/']) +container_gtest_env.AppendUnique(LIBPATH = [os.environ['JAVA_HOME']+'/jre/lib/i386/server/']) + +conf = Configure(container_gtest_env) +if not conf.CheckLib('jvm'): + print ''' +*********************************** Error ************************************* +* Cannot locate libjvm for resourc container test. Please check your JAVA_HOME +* and configure JAVA_LIB to point to your folder containing libjvm. +* Example: export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server +******************************************************************************* + ''' + container_gtest_env = conf.Finish() + Return() +container_gtest_env = conf.Finish() + container_gtest_env.PrependUnique(LIBS = ['ResContainerLib', 'server_builder', 'service_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', gtest, gtest_main]) container_gtest_env.AppendUnique(LIBS = ['dl', 'jvm'])