Skip to content

Commit 2940e23

Browse files
committed
level-zero: Changes to get ze_loader loaded for Android
As the generated driver library for android is libze_intel_npu.so without version suffix, updated MAKE_LIBRARY_NAME macro accordingly for it to be loaded. Signed-off-by: JeevakaPrabu <jeevaka.badrappan@intel.com>
1 parent e3b6efd commit 2940e23

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

source/inc/ze_util.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ inline void getLastErrorString(std::string &errorValue) {
4242
# include <link.h>
4343
# include <dlfcn.h>
4444
# define HMODULE void*
45-
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION
46-
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so." L0_VALIDATION_LAYER_SUPPORTED_VERSION
4745
# define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY|RTLD_LOCAL)
4846
# define GET_LIBRARY_ERROR(ERROR_STRING) ERROR_STRING.assign(dlerror())
4947
# define FREE_DRIVER_LIBRARY(LIB) dlclose(LIB)
@@ -52,6 +50,14 @@ inline void getLastErrorString(std::string &errorValue) {
5250
# define string_copy_s strncpy
5351
#endif
5452

53+
#if defined(ANDROID)
54+
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so"
55+
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so"
56+
#elif !defined(WIN32)
57+
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION
58+
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so." L0_VALIDATION_LAYER_SUPPORTED_VERSION
59+
#endif
60+
5561
inline std::string create_library_path(const char *name, const char *path){
5662
std::string library_path;
5763
if (path && (strcmp("", path) != 0)) {
@@ -156,4 +162,4 @@ inline std::string getenv_string ( const char* name){
156162
if ((nullptr == env))
157163
return "";
158164
return std::string(env);
159-
}
165+
}

0 commit comments

Comments
 (0)