cmake: prefer system renderdoc library (#452)

This commit is contained in:
Alexandre Bouvier 2024-08-16 16:49:32 +00:00 committed by GitHub
parent 444cdfbba5
commit 154771cca5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -71,6 +71,7 @@ find_package(FFmpeg 5.1.2 MODULE)
find_package(fmt 10.2.1 CONFIG) find_package(fmt 10.2.1 CONFIG)
find_package(glslang 14.2.0 CONFIG) find_package(glslang 14.2.0 CONFIG)
find_package(magic_enum 0.9.6 CONFIG) find_package(magic_enum 0.9.6 CONFIG)
find_package(RenderDoc 1.6.0 MODULE)
find_package(SDL3 3.1.2 CONFIG) find_package(SDL3 3.1.2 CONFIG)
find_package(toml11 3.8.1 CONFIG) find_package(toml11 3.8.1 CONFIG)
find_package(tsl-robin-map 1.3.0 CONFIG) find_package(tsl-robin-map 1.3.0 CONFIG)
@ -80,7 +81,6 @@ find_package(xbyak 7.07 CONFIG)
find_package(xxHash 0.8.2 MODULE) find_package(xxHash 0.8.2 MODULE)
find_package(zlib-ng 2.2.0 MODULE) find_package(zlib-ng 2.2.0 MODULE)
find_package(Zydis 4.1.0 CONFIG) find_package(Zydis 4.1.0 CONFIG)
find_package(RenderDoc MODULE)
if (APPLE) if (APPLE)
find_package(date 3.0.1 CONFIG) find_package(date 3.0.1 CONFIG)

25
cmake/FindRenderDoc.cmake Normal file
View File

@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
find_path(RENDERDOC_INCLUDE_DIR renderdoc_app.h)
if (RENDERDOC_INCLUDE_DIR AND EXISTS "${RENDERDOC_INCLUDE_DIR}/renderdoc_app.h")
file(STRINGS "${RENDERDOC_INCLUDE_DIR}/renderdoc_app.h" RENDERDOC_VERSION_LINE REGEX "typedef struct RENDERDOC_API")
string(REGEX REPLACE ".*typedef struct RENDERDOC_API_([0-9]+)_([0-9]+)_([0-9]+).*" "\\1.\\2.\\3" RENDERDOC_VERSION "${RENDERDOC_VERSION_LINE}")
unset(RENDERDOC_VERSION_LINE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RenderDoc
REQUIRED_VARS RENDERDOC_INCLUDE_DIR
VERSION_VAR RENDERDOC_VERSION
)
if (RenderDoc_FOUND AND NOT TARGET RenderDoc::API)
add_library(RenderDoc::API INTERFACE IMPORTED)
set_target_properties(RenderDoc::API PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${RENDERDOC_INCLUDE_DIR}"
)
endif()
mark_as_advanced(RENDERDOC_INCLUDE_DIR)