Merge branch 'master' into iot-1785
[platform/upstream/iotivity.git] / build_common / external_libs.scons
index 1201273..57f3fd0 100644 (file)
@@ -2,7 +2,7 @@
 # This script manages external libraries
 #
 # Some methods are added to manage external packages:
-#    'PrepareLib': Checks the existence of an external library, if it
+#      'PrepareLib': Checks the existence of an external library, if it
 # doesn't exist, calls the script user provided to download(if required)
 # and build the source code of the external library or notify user to
 # install the library.
@@ -13,7 +13,7 @@
 #   'InstallLib': Install library binaries(.so, .a etc)
 #
 # By default, assume the script for an exteranl library is:
-#    <src_dir>/extlibs/<libname>/SConscript
+#      <src_dir>/extlibs/<libname>/SConscript
 #
 # Note: After the external library is built:
 #   Head files should be installed to <src_dir>/deps/<target_os>/include
@@ -34,11 +34,23 @@ rd_mode = env.get('RD_MODE')
 if target_os == 'android':
        if target_arch == 'armeabi-v7a-hard':
                target_arch = 'armeabi-v7a'
+       env.AppendUnique(CCFLAGS = ['-D__JAVA__'])
 
 if target_os == 'darwin':
        env.AppendUnique(CPPPATH = ['/usr/local/include'])
        env.AppendUnique(LIBPATH = ['/usr/local/lib'])
 
+if env.get('BUILD_JAVA') == True and target_os != 'android':
+       if env.get('JAVA_HOME') != None:
+                       env.AppendUnique(CCFLAGS = ['-D__JAVA__'])
+                       env.AppendUnique(CPPPATH = [
+                       env.get('JAVA_HOME') + '/include',
+                       env.get('JAVA_HOME') + '/include/' + target_os
+               ])
+       else:
+               raise SCons.Errors.StopError( 'BUILD_JAVA is specified, but JAVA_HOME is not set.')
+
+
 # External library include files are in <src_dir>/deps/<target_os>/include
 # the library binaries are in <src_dir>/deps/<target_os>/lib/<arch>
 if target_os not in ['windows']:
@@ -49,7 +61,7 @@ if target_os not in ['windows']:
 # download the source code and build it
 # @param libname - the name of the library try to prepare
 # @param lib - the lib(.so, .a etc) to check (a library may include more then
-#      one lib, e.g. boost, includes boost_thread, boost_system ...
+#        one lib, e.g. boost, includes boost_thread, boost_system ...
 # @param path - the directory of the library building script, if it's not set,
 #                      by default, it's <src_dir>/extlibs/<libname>/
 # @param script - the building script, by default, it's 'SConscript'
@@ -141,9 +153,6 @@ env.AddMethod(__download, "Download")
 env.AddMethod(__install_head_file, "InstallHeadFile")
 env.AddMethod(__install_lib, "InstallLib")
 
-if env.get('SECURED') == '1' and target_os != 'tizen':
-       SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'sqlite3', 'SConscript'))
-
-if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
-        if target_os not in ['tizen']:
-                SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'sqlite3', 'SConscript'))
+if env.get('SECURED') == '1' or 'SERVER' in rd_mode:
+       if target_os not in ['linux', 'tizen']:
+               SConscript('#extlibs/sqlite3/SConscript')