From 2ff2c826a521e993bdab0a805e830c77d9346349 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 31 Mar 2023 15:23:03 +0100 Subject: [PATCH] [build] Generate pkg-config metadata to link to DXVK libraries This allows dependent projects to query the version and location of DXVK via the pkg-config interface. The include directories aren't yet set, because the headers aren't installed; that will follow in a subsequent commit. The naming of these pkg-config files is based on proposed Fedora packages for DXVK 2.0, and is not compatible with older Fedora packages for DXVK 1.x (which used the naming convention dxvk-native-d3d9 and so on). Packagers can create symlinks such as dxvk-native-d3d9.pc -> dxvk-d3d9.pc if they want to retain compatibility with older names. Signed-off-by: Simon McVittie --- meson.build | 2 ++ src/d3d10/meson.build | 7 +++++++ src/d3d11/meson.build | 7 +++++++ src/d3d9/meson.build | 7 +++++++ src/dxgi/meson.build | 7 +++++++ 5 files changed, 30 insertions(+) diff --git a/meson.build b/meson.build index d6e26d90b..cfa841a6a 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,6 @@ project('dxvk', ['c', 'cpp'], version : 'v2.3.1', meson_version : '>= 0.58', default_options : [ 'cpp_std=c++17', 'warning_level=2' ]) +pkg = import('pkgconfig') cpu_family = target_machine.cpu_family() platform = target_machine.system() fs = import('fs') @@ -146,6 +147,7 @@ else endif dxvk_name_prefix = 'dxvk_' + dxvk_pkg_prefix = 'dxvk-' link_args += [ '-static-libgcc', diff --git a/src/d3d10/meson.build b/src/d3d10/meson.build index 80038a961..6a690c435 100644 --- a/src/d3d10/meson.build +++ b/src/d3d10/meson.build @@ -28,3 +28,10 @@ d3d10_core_dll = shared_library(dxvk_name_prefix+'d3d10core', d3d10_core_src, d3 d3d10_core_dep = declare_dependency( link_with : [ d3d10_core_dll ], ) + +if platform != 'windows' + pkg.generate(d3d10_core_dll, + filebase: dxvk_pkg_prefix + 'd3d10core', + subdirs: 'dxvk', + ) +endif diff --git a/src/d3d11/meson.build b/src/d3d11/meson.build index 195f2b77d..20bec0820 100644 --- a/src/d3d11/meson.build +++ b/src/d3d11/meson.build @@ -92,3 +92,10 @@ d3d11_dep = declare_dependency( link_with : [ d3d11_dll ], include_directories : [ dxvk_include_path ], ) + +if platform != 'windows' + pkg.generate(d3d11_dll, + filebase: dxvk_pkg_prefix + 'd3d11', + subdirs: 'dxvk', + ) +endif diff --git a/src/d3d9/meson.build b/src/d3d9/meson.build index 34ef3fd84..bc3eac428 100644 --- a/src/d3d9/meson.build +++ b/src/d3d9/meson.build @@ -71,3 +71,10 @@ d3d9_dep = declare_dependency( link_with : [ d3d9_dll ], include_directories : [ dxvk_include_path ], ) + +if platform != 'windows' + pkg.generate(d3d9_dll, + filebase: dxvk_pkg_prefix + 'd3d9', + subdirs: 'dxvk', + ) +endif diff --git a/src/dxgi/meson.build b/src/dxgi/meson.build index f34c73182..7c3f43208 100644 --- a/src/dxgi/meson.build +++ b/src/dxgi/meson.build @@ -35,3 +35,10 @@ dxgi_dep = declare_dependency( link_with : [ dxgi_dll ], include_directories : [ dxvk_include_path ], ) + +if platform != 'windows' + pkg.generate(dxgi_dll, + filebase: dxvk_pkg_prefix + 'dxgi', + subdirs: 'dxvk', + ) +endif