diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-09-12 13:49:08 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 13:49:08 +1000 |
commit | 38128e22de2f59e0397428ea8540c4b1b39c3b23 (patch) | |
tree | b01fe6959b90d1a4c55a0f30b07795c91d9ba09c | |
parent | 498905259c54f0fe290043663490511de57ad544 (diff) | |
parent | e2423c7daf032fc45e1aac5b6a8f6fddc8b87b91 (diff) |
Merge pull request #23747 from fuzzard/cmake_win_detours
[cmake] Add FindDetours for windows
-rw-r--r-- | cmake/modules/FindDetours.cmake | 37 | ||||
-rw-r--r-- | cmake/platform/windows/windows.cmake | 2 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinSystemWin32DX.cpp | 5 |
3 files changed, 38 insertions, 6 deletions
diff --git a/cmake/modules/FindDetours.cmake b/cmake/modules/FindDetours.cmake new file mode 100644 index 0000000000..81cc0e9016 --- /dev/null +++ b/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() diff --git a/cmake/platform/windows/windows.cmake b/cmake/platform/windows/windows.cmake index b269fe86b5..a5e13a9c5c 100644 --- a/cmake/platform/windows/windows.cmake +++ b/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) diff --git a/xbmc/windowing/windows/WinSystemWin32DX.cpp b/xbmc/windowing/windows/WinSystemWin32DX.cpp index 4dff636464..52bea4ac99 100644 --- a/xbmc/windowing/windows/WinSystemWin32DX.cpp +++ b/xbmc/windowing/windows/WinSystemWin32DX.cpp @@ -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> |