mirror of
https://github.com/microsoft/DirectX-Headers.git
synced 2024-11-23 09:56:39 +08:00
Fix issues from discussion.
This commit is contained in:
parent
37144c617a
commit
e369292807
@ -10,10 +10,6 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
#pkg-config values
|
||||
set(DXHEADERS_URL "https://github.com/microsoft/DirectX-Headers")
|
||||
set(DXHEADERS_DESCRIPTION "Headers for using D3D12")
|
||||
|
||||
# It's useful to know if you are a top level project or not, if your project is
|
||||
# being consumed via add_subdirectory
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
@ -93,13 +89,14 @@ if (DXHEADERS_INSTALL)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/directx-headers/cmake)
|
||||
|
||||
# Create pkg-config file
|
||||
set(DIRECTX_HEADERS_L DirectX-Headers)
|
||||
set(DIRECTX_GUIDS_L DirectX-Guids)
|
||||
|
||||
include(cmake/JoinPaths.cmake)
|
||||
# from: https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files
|
||||
join_paths(DIRECTX_INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
join_paths(DIRECTX_LIBDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/DirectX-Headers.pc.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/DirectX-Headers.pc" @ONLY)
|
||||
|
||||
|
||||
# Install the pkg-config file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectX-Headers.pc"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
@ -1,11 +1,10 @@
|
||||
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||
exec_prefix="${prefix}"
|
||||
libdir="${prefix}/lib"
|
||||
includedir="${prefix}/include"
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@DIRECTX_LIBDIR_FOR_PKG_CONFIG@
|
||||
includedir=@DIRECTX_INCLUDEDIR_FOR_PKG_CONFIG@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: @DXHEADERS_DESCRIPTION@
|
||||
URL: @DXHEADERS_URL@
|
||||
Description: Headers for using D3D12
|
||||
URL: https://github.com/microsoft/DirectX-Header
|
||||
Version: @PROJECT_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -l@DIRECTX_HEADERS_L@ -l@DIRECTX_GUIDS_L@
|
||||
Libs: -lDirectX-Headers -lDirectX-Guids
|
||||
|
23
cmake/JoinPaths.cmake
Normal file
23
cmake/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