Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Add FindDetours for windows #23747

Merged
merged 1 commit into from Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions cmake/modules/FindDetours.cmake
@@ -0,0 +1,37 @@
#.rst:
# FindDetours
# --------
# Finds the Detours library
#
# This will define the following target:
#
# windows::Detours - The Detours library

if(NOT TARGET windows::Detours)
find_path(DETOURS_INCLUDE_DIR NAMES detours.h
NO_CACHE)

find_library(DETOURS_LIBRARY_RELEASE NAMES detours
NO_CACHE)
find_library(DETOURS_LIBRARY_DEBUG NAMES detoursd
NO_CACHE)

include(SelectLibraryConfigurations)
select_library_configurations(DETOURS)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Detours
REQUIRED_VARS DETOURS_LIBRARY DETOURS_INCLUDE_DIR)

if(DETOURS_FOUND)
add_library(windows::Detours UNKNOWN IMPORTED)
set_target_properties(windows::Detours PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${DETOURS_INCLUDE_DIR}"
IMPORTED_LOCATION "${DETOURS_LIBRARY_RELEASE}")
if(DETOURS_LIBRARY_DEBUG)
set_target_properties(windows::Detours PROPERTIES
IMPORTED_LOCATION_DEBUG "${DETOURS_LIBRARY_DEBUG}")
endif()
set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP windows::Detours)
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/platform/windows/windows.cmake
@@ -1,3 +1,3 @@
set(PLATFORM_REQUIRED_DEPS D3DX11Effects)
set(PLATFORM_REQUIRED_DEPS D3DX11Effects Detours)
set(APP_RENDER_SYSTEM dx11)
list(APPEND PLATFORM_DEFINES -DNTDDI_VERSION=NTDDI_WINBLUE -D_WIN32_WINNT=_WIN32_WINNT_WINBLUE)
5 changes: 0 additions & 5 deletions xbmc/windowing/windows/WinSystemWin32DX.cpp
Expand Up @@ -25,11 +25,6 @@
#ifndef _M_X64
#include "utils/SystemInfo.h"
#endif
#if _DEBUG
#pragma comment(lib, "detoursd.lib")
#else
#pragma comment(lib, "detours.lib")
#endif
#pragma comment(lib, "dxgi.lib")
#include <windows.h>
#include <winnt.h>
Expand Down