Skip to content

Commit

Permalink
Allow pkg-config files on Windows as well (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Jan 9, 2025
1 parent 7f0f28e commit 187f6a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party)

if(MSVC AND (MSVC_VERSION LESS 1900))
message(FATAL_ERROR "Visual Studio Compiler Version >= 1900 Required to build.")
message(FATAL_ERROR "Visual Studio Compiler Version >= 1900 Required to build.")
endif()

# This project follows semantic versioning (https://semver.org/)
Expand Down
23 changes: 9 additions & 14 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,13 @@ install(TARGETS ze_loader
NAMELINK_COMPONENT level-zero-devel
)

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}")
file(RELATIVE_PATH pkgconfig_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH pkgconfig_include_dir "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
file(RELATIVE_PATH pkgconfig_lib_dir "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_LIBDIR}")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libze_loader.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" COMPONENT level-zero-devel)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/level-zero.pc.in
${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" COMPONENT level-zero-devel)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libze_loader.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/level-zero.pc.in ${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc @ONLY)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc"
"${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc"
DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" COMPONENT level-zero-devel)
7 changes: 3 additions & 4 deletions source/level-zero.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pc_path=${pcfiledir}
includedir=${pc_path}/@ze_loader_include_dir@
libdir=${pc_path}/@ze_loader_lib_dir@

prefix=${pcfiledir}/@pkgconfig_prefix@
includedir=${prefix}/@pkgconfig_include_dir@
libdir=${prefix}/@pkgconfig_lib_dir@

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

prefix=${pcfiledir}/@pkgconfig_prefix@
includedir=${prefix}/@pkgconfig_include_dir@
libdir=${prefix}/@pkgconfig_lib_dir@

Name: Level Zero Loader
Description: Runtime Library Loader for Level Zero
Expand All @@ -10,5 +9,3 @@ Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@
Requires:
Libs: -L${libdir} -lze_loader
CFlags: -I${includedir}


0 comments on commit 187f6a6

Please sign in to comment.