Skip to content

Commit 42310ca

Browse files
authored
level-zero: Changes to get ze_loader loaded for Android (#365)
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 <[email protected]>
1 parent e121961 commit 42310ca

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/inc/ze_util.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ inline void getLastErrorString(std::string &errorValue) {
4444
# include <link.h>
4545
# include <dlfcn.h>
4646
# define HMODULE void*
47-
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION
48-
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so." L0_VALIDATION_LAYER_SUPPORTED_VERSION
4947
# define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY|RTLD_LOCAL)
5048
# define GET_LIBRARY_ERROR(ERROR_STRING) ERROR_STRING.assign(dlerror())
5149
# define FREE_DRIVER_LIBRARY(LIB) dlclose(LIB)
@@ -56,6 +54,14 @@ inline void getLastErrorString(std::string &errorValue) {
5654
# define strdup_safe strdup
5755
#endif
5856

57+
#if defined(ANDROID)
58+
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so"
59+
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so"
60+
#elif !defined(WIN32)
61+
# define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION
62+
# define MAKE_LAYER_NAME(NAME) "lib" NAME ".so." L0_VALIDATION_LAYER_SUPPORTED_VERSION
63+
#endif
64+
5965
inline std::string create_library_path(const char *name, const char *path){
6066
std::string library_path;
6167
if (path && (strcmp("", path) != 0)) {

0 commit comments

Comments
 (0)