From: Wook Song Date: Tue, 27 Aug 2019 03:52:16 +0000 (+0900) Subject: [macOS/Conf] Support .dylib as a file extension of sub-plugins X-Git-Tag: accepted/tizen/unified/20190905.060558~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1ade53d78df1b5fed10a2006e2f773ef39e8c37;p=platform%2Fupstream%2Fnnstreamer.git [macOS/Conf] Support .dylib as a file extension of sub-plugins This patch adds .dylib as a file extension of sub-plugins to support. Signed-off-by: Wook Song --- diff --git a/gst/nnstreamer/nnstreamer_conf.c b/gst/nnstreamer/nnstreamer_conf.c index a70f717..09e8260 100644 --- a/gst/nnstreamer/nnstreamer_conf.c +++ b/gst/nnstreamer/nnstreamer_conf.c @@ -125,14 +125,14 @@ _validate_file (nnsconf_type_path type, const gchar * fullpath) } /** - * @brief Private function to fill in ".so list" with fullpath-filenames in a directory. + * @brief Private function to fill in ".so/.dylib list" with fullpath-filenames in a directory. * @param[in] type conf type to scan. * @param[in] dir Directory to be searched. * @param[in/out] listF The fullpath list to be updated. * @param[in/out] listB The basename list to be updated. * @param[in/out] counter increased by the number of appended elements. * @return True if successfully updated. - * @todo This assumes .so for all sub plugins. Support Windows/Mac/iOS! + * @todo This assumes .so/.dylib for all sub plugins. Support Windows! */ static gboolean _get_filenames (nnsconf_type_path type, const gchar * dir, GSList ** listF, @@ -146,9 +146,9 @@ _get_filenames (nnsconf_type_path type, const gchar * dir, GSList ** listF, return FALSE; while (NULL != (name = g_dir_read_name (gdir))) { - /* check file prefix for given type, handle .so only. */ + /* check file prefix for given type, currently handle .so and .dylib. */ if (g_str_has_prefix (name, subplugin_prefixes[type]) && - g_str_has_suffix (name, ".so")) { + g_str_has_suffix (name, NNSTREAMER_SO_FILE_EXTENSION)) { fullpath = g_build_filename (dir, name, NULL); if (_validate_file (type, fullpath)) { @@ -381,7 +381,8 @@ nnsconf_get_fullpath (const gchar * subpluginname, nnsconf_type_path type) nnsconf_loadconf (FALSE); - filename = g_strconcat (subplugin_prefixes[type], subpluginname, ".so", NULL); + filename = g_strconcat (subplugin_prefixes[type], subpluginname, + NNSTREAMER_SO_FILE_EXTENSION, NULL); ret = nnsconf_get_fullpath_from_file (filename, type); g_free (filename); diff --git a/gst/nnstreamer/nnstreamer_conf.h b/gst/nnstreamer/nnstreamer_conf.h index 8cf6352..0239808 100644 --- a/gst/nnstreamer/nnstreamer_conf.h +++ b/gst/nnstreamer/nnstreamer_conf.h @@ -43,6 +43,16 @@ G_BEGIN_DECLS #define NNSTREAMER_SYS_ROOT_PATH_PREFIX "/" #endif /* G_OS_WIN32 */ +/** + * Hard-coded system-dependent file extension string of shared + * (dynamic loadable) object + */ +#ifdef __MACOS__ +#define NNSTREAMER_SO_FILE_EXTENSION ".dylib" +#else +#define NNSTREAMER_SO_FILE_EXTENSION ".so" +#endif + /* Env-var names */ #define NNSTREAMER_ENVVAR_CONF_FILE "NNSTREAMER_CONF" #define NNSTREAMER_ENVVAR_FILTERS "NNSTREAMER_FILTERS"