mirror of
https://github.com/microsoft/DirectXMath
synced 2024-11-21 20:00:12 +00:00
add pkg-config support. (#174)
This commit is contained in:
parent
a55148fc56
commit
3d199f08c7
@ -68,6 +68,20 @@ install(FILES
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME})
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME})
|
||||||
|
|
||||||
|
# Create pkg-config file
|
||||||
|
include(build/JoinPaths.cmake)
|
||||||
|
# from: https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files
|
||||||
|
join_paths(DIRECTXMATH_INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
join_paths(DIRECTXMATH_LIBDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/build/DirectXMath.pc.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/DirectXMath.pc" @ONLY)
|
||||||
|
|
||||||
|
# Install the pkg-config file
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectXMath.pc"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
||||||
#--- Test suite
|
#--- Test suite
|
||||||
if (DEFINED VCPKG_TARGET_ARCHITECTURE)
|
if (DEFINED VCPKG_TARGET_ARCHITECTURE)
|
||||||
set(DXMATH_ARCHITECTURE ${VCPKG_TARGET_ARCHITECTURE})
|
set(DXMATH_ARCHITECTURE ${VCPKG_TARGET_ARCHITECTURE})
|
||||||
|
10
build/DirectXMath.pc.in
Normal file
10
build/DirectXMath.pc.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
libdir=@DIRECTXMATH_LIBDIR_FOR_PKG_CONFIG@
|
||||||
|
includedir=@DIRECTXMATH_INCLUDEDIR_FOR_PKG_CONFIG@
|
||||||
|
|
||||||
|
Name: @PROJECT_NAME@
|
||||||
|
Description: @PROJECT_DESCRIPTION@
|
||||||
|
URL: @PROJECT_HOMEPAGE_URL@
|
||||||
|
Version: @PROJECT_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Libs:
|
23
build/JoinPaths.cmake
Normal file
23
build/JoinPaths.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# This module provides function for joining paths
|
||||||
|
# known from most languages
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (MIT OR CC0-1.0)
|
||||||
|
# Copyright 2020 Jan Tojnar
|
||||||
|
# https://github.com/jtojnar/cmake-snips
|
||||||
|
#
|
||||||
|
# Modelled after Python’s os.path.join
|
||||||
|
# https://docs.python.org/3.7/library/os.path.html#os.path.join
|
||||||
|
# Windows not supported
|
||||||
|
function(join_paths joined_path first_path_segment)
|
||||||
|
set(temp_path "${first_path_segment}")
|
||||||
|
foreach(current_segment IN LISTS ARGN)
|
||||||
|
if(NOT ("${current_segment}" STREQUAL ""))
|
||||||
|
if(IS_ABSOLUTE "${current_segment}")
|
||||||
|
set(temp_path "${current_segment}")
|
||||||
|
else()
|
||||||
|
set(temp_path "${temp_path}/${current_segment}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${joined_path} "${temp_path}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
Loading…
Reference in New Issue
Block a user