Skip to content

Commit

Permalink
Fixed pkg-config files generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Nov 20, 2024
1 parent fd459f2 commit deb9207
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion samples/zello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(MSVC)
)
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
${TARGET_LOADER_NAME}
${CMAKE_DL_LIBS}
)
15 changes: 6 additions & 9 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,25 @@ add_subdirectory(loader)
add_subdirectory(layers)
add_subdirectory(drivers)
add_subdirectory(utils)
target_include_directories(${TARGET_LOADER_NAME} PRIVATE utils)

set_target_properties(${TARGET_LOADER_NAME} PROPERTIES
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
SOVERSION "${PROJECT_VERSION_MAJOR}"
)

target_link_libraries(${TARGET_LOADER_NAME}
${CMAKE_DL_LIBS}
)
target_link_libraries(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_DL_LIBS} level_zero_utils)

if (UNIX)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries (${TARGET_LOADER_NAME} Threads::Threads)
target_link_libraries (${TARGET_LOADER_NAME} PRIVATE Threads::Threads)
endif()

if(WIN32)
target_link_libraries (${TARGET_LOADER_NAME} cfgmgr32.lib)
target_link_libraries (${TARGET_LOADER_NAME} PRIVATE cfgmgr32.lib)
endif()

# Link against utility sublibrary
target_link_libraries(${TARGET_LOADER_NAME} utils)

install(TARGETS ze_loader
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand All @@ -67,6 +61,9 @@ install(TARGETS ze_loader
)

if(UNIX)
file(RELATIVE_PATH ze_loader_include_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
file(RELATIVE_PATH ze_loader_lib_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_FULL_LIBDIR}")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libze_loader.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc
Expand Down
5 changes: 3 additions & 2 deletions source/level-zero.pc.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
pc_path=${pcfiledir}
includedir=${pc_path}/@ze_loader_include_dir@
libdir=${pc_path}/@ze_loader_lib_dir@


Name: Level Zero
Expand Down
5 changes: 3 additions & 2 deletions source/libze_loader.pc.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
pc_path=${pcfiledir}
includedir=${pc_path}/@ze_loader_include_dir@
libdir=${pc_path}/@ze_loader_lib_dir@


Name: Level Zero Loader
Expand Down
7 changes: 4 additions & 3 deletions source/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: MIT

add_library(utils
add_library(level_zero_utils
STATIC
"logging.h"
"logging.cpp"
)

target_include_directories(utils PRIVATE ${CMAKE_SOURCE_DIR}/third_party/spdlog_headers/)
target_include_directories(level_zero_utils
PRIVATE ${CMAKE_SOURCE_DIR}/third_party/spdlog_headers/
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

0 comments on commit deb9207

Please sign in to comment.