diff options
author | Miao Wang <miaowang@google.com> | 2015-02-05 00:01:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-02-05 00:01:02 +0000 |
commit | fe4f02f81d7c461835be97eebbde744885846e99 (patch) | |
tree | 9092a9f3ed80c0b666c71b0cc12390bea2abd448 /cpu_ref/rsCpuScript.cpp | |
parent | 9d640fbbd7c7875e1dd24a90060f5df3d9f176af (diff) | |
parent | f3213d7fd648da98bb3b03204eaf90f03c31926b (diff) | |
download | rs-fe4f02f81d7c461835be97eebbde744885846e99.tar.gz |
Merge "Make rsContext be able to have info about the path of native libs for 64bit Renderscript compat lib."
Diffstat (limited to 'cpu_ref/rsCpuScript.cpp')
-rw-r--r-- | cpu_ref/rsCpuScript.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp index 01fbcafd..3cec0b96 100644 --- a/cpu_ref/rsCpuScript.cpp +++ b/cpu_ref/rsCpuScript.cpp @@ -113,10 +113,9 @@ static int copyFile(const char *dstFile, const char *srcFile) { static std::string findSharedObjectName(const char *cacheDir, const char *resName) { - #ifndef RS_SERVER std::string scriptSOName(cacheDir); -#ifdef RS_COMPATIBILITY_LIB +#if defined(RS_COMPATIBILITY_LIB) && !defined(__LP64__) size_t cutPos = scriptSOName.rfind("cache"); if (cutPos != std::string::npos) { scriptSOName.erase(cutPos); @@ -126,11 +125,11 @@ static std::string findSharedObjectName(const char *cacheDir, scriptSOName.append("/lib/librs."); #else scriptSOName.append("/librs."); -#endif +#endif // RS_COMPATIBILITY_LIB #else std::string scriptSOName("lib"); -#endif +#endif // RS_SERVER scriptSOName.append(resName); scriptSOName.append(".so"); @@ -328,10 +327,15 @@ bool SharedLibraryUtils::createSharedLibrary(const char *cacheDir, const char *r #endif // RS_COMPATIBILITY_LIB -void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, const char *resName) { + +void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, const char *resName, const char *nativeLibDir) { void *loaded = nullptr; +#if defined(RS_COMPATIBILITY_LIB) && defined(__LP64__) + std::string scriptSOName = findSharedObjectName(nativeLibDir, resName); +#else std::string scriptSOName = findSharedObjectName(cacheDir, resName); +#endif // We should check if we can load the library from the standard app // location for shared libraries first. @@ -875,8 +879,8 @@ bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir, goto error; } #else // RS_COMPATIBILITY_LIB is defined - - mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName); + const char *nativeLibDir = mCtx->getContext()->getNativeLibDir(); + mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName, nativeLibDir); if (!mScriptSO) { goto error; |