Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pkg-config files generation #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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} COMPONENT level-zero-devel
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero
Expand All @@ -56,6 +50,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
11 changes: 7 additions & 4 deletions source/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
# SPDX-License-Identifier: MIT

set(logging_files logging.h logging.cpp)
add_library(utils STATIC ${logging_files})
add_library(level_zero_utils STATIC ${logging_files})

if(SYSTEM_SPDLOG)
target_link_libraries(utils PUBLIC spdlog::spdlog)
target_link_libraries(level_zero_utils PUBLIC spdlog::spdlog)
else()
target_include_directories(utils PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/spdlog_headers>)
target_include_directories(level_zero_utils PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/spdlog_headers>)
endif()
set_property(TARGET utils PROPERTY POSITION_INDEPENDENT_CODE ON)

target_include_directories(level_zero_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

set_property(TARGET level_zero_utils PROPERTY POSITION_INDEPENDENT_CODE ON)
Loading