Skip to content

Commit

Permalink
Update in custom user paths of L0
Browse files Browse the repository at this point in the history
Changes the handling of the L0_LIBRARY and L0_INCLUDE_DIR environment variables. The user can provide any direct path to the libze_loader.so file and to the include directory containing level zero headers. No 'level-zero' subdirectory appended to these paths anymore.

Note that the path to the include directory has to end with a  slash, like ie. "level-zero/include/".
  • Loading branch information
PatKamin committed Jun 6, 2024
1 parent ed73e4b commit 8c33780
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions source/adapters/level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ set(TARGET_NAME ur_adapter_level_zero)
# Copy L0 loader/headers locally to the build to avoid leaking their path.
set(LEVEL_ZERO_COPY_DIR ${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader)
if (DEFINED L0_LIBRARY)
get_filename_component(LEVEL_ZERO_LIB_NAME "${L0_LIBRARY}" NAME)
set(LEVEL_ZERO_LIBRARY ${LEVEL_ZERO_COPY_DIR}/${LEVEL_ZERO_LIB_NAME})
message(STATUS "Copying Level Zero loader and headers to local build tree")
file(COPY ${L0_LIBRARY} DESTINATION ${LEVEL_ZERO_COPY_DIR} FOLLOW_SYMLINK_CHAIN)
get_filename_component(LEVEL_ZERO_LIB_NAME "${L0_LIBRARY}" NAME)
set(LEVEL_ZERO_LIBRARY ${LEVEL_ZERO_COPY_DIR}/${LEVEL_ZERO_LIB_NAME})
message(STATUS "Copying Level Zero loader and headers to local build tree")
file(COPY ${L0_LIBRARY} DESTINATION ${LEVEL_ZERO_COPY_DIR} FOLLOW_SYMLINK_CHAIN)
endif()
if (DEFINED L0_INCLUDE_DIR)
set(LEVEL_ZERO_INCLUDE_DIR ${LEVEL_ZERO_COPY_DIR}/level_zero)
file(COPY ${L0_INCLUDE_DIR}/level_zero DESTINATION ${LEVEL_ZERO_COPY_DIR})
message(STATUS "L0_INCLUDE_DIR: ${L0_INCLUDE_DIR}")
if(EXISTS "${L0_INCLUDE_DIR}/ze_api.h")
message(STATUS "ze_api.h exists in L0_INCLUDE_DIR")
else()
message(STATUS "ze_api.h does not exist in L0_INCLUDE_DIR")
endif()

set(LEVEL_ZERO_INCLUDE_DIR ${LEVEL_ZERO_COPY_DIR})
file(COPY ${L0_INCLUDE_DIR} DESTINATION ${LEVEL_ZERO_COPY_DIR})
endif()

if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
Expand Down

0 comments on commit 8c33780

Please sign in to comment.