diff --git a/cmake/dx8.cmake b/cmake/dx8.cmake index 8312a5949ab..8886bd0c7f8 100644 --- a/cmake/dx8.cmake +++ b/cmake/dx8.cmake @@ -1,19 +1,18 @@ -# Ronin 19/10/2025 Disabled DX8 SDK fetch - using real DX9 SDK instead via dx9.cmake -# The min-dx8-sdk contains mixed DX8/DX9 headers causing type conflicts with our typedef layer +# Map DX8 library names to DX9 libraries for linking. +# The DX8 SDK is no longer fetched; the DX9 SDK (dx9.cmake) provides all +# necessary headers and libraries. These interface targets allow existing +# CMakeLists that reference DX8 library names to link correctly. +if(NOT TARGET d3d8) + add_library(d3d8 INTERFACE) + target_link_libraries(d3d8 INTERFACE d3d9) +endif() -# FetchContent_Declare( -# dx8 -# GIT_REPOSITORY https://github.com/TheSuperHackers/min-dx8-sdk.git -# GIT_TAG 20d31185872e1304e0573f7f4885ae11e50670d3 -# ) -# -# FetchContent_MakeAvailable(dx8) +if(NOT TARGET d3dx8) + add_library(d3dx8 INTERFACE) + target_link_libraries(d3dx8 INTERFACE d3dx9) +endif() -# Ronin 19/01/2026 Map DX8 library names to DX9 libraries for linking -# Create interface targets that link to the actual DX9 libraries -add_library(d3d8 INTERFACE) -add_library(d3dx8 INTERFACE) - -# Link to DX9 libraries from the DirectX SDK -target_link_libraries(d3d8 INTERFACE d3d9) -target_link_libraries(d3dx8 INTERFACE d3dx9) +if(NOT TARGET d3d8lib) + add_library(d3d8lib INTERFACE) + target_link_libraries(d3d8lib INTERFACE d3d9lib) +endif() diff --git a/cmake/dx9.cmake b/cmake/dx9.cmake index 3f466002bcd..1594e508f94 100644 --- a/cmake/dx9.cmake +++ b/cmake/dx9.cmake @@ -1,23 +1,12 @@ -# DirectX 9 SDK Configuration -# Ronin 19/10/2025 Added DX9 SDK path for compatibility layer +FetchContent_Declare( + dx9 + GIT_REPOSITORY https://github.com/stephanmeesters/min-dx9-sdk.git + GIT_TAG d7c1c587f3bbab03900e8a6367669bb56e30e8b3 +) -# Try to find DirectX 9 SDK -set(DX9_SDK_PATH "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)") +FetchContent_MakeAvailable(dx9) -if(EXISTS "${DX9_SDK_PATH}") - message(STATUS "Found DirectX 9 SDK at: ${DX9_SDK_PATH}") - - # Ronin: Add include directories GLOBALLY with BEFORE to ensure DX9 headers take absolute precedence - include_directories(BEFORE SYSTEM "${DX9_SDK_PATH}/Include") - link_directories("${DX9_SDK_PATH}/Lib/x86") - - # Create interface library for DX9 - add_library(dx9 INTERFACE) - target_include_directories(dx9 SYSTEM INTERFACE BEFORE "${DX9_SDK_PATH}/Include") - target_link_directories(dx9 INTERFACE "${DX9_SDK_PATH}/Lib/x86") - target_link_libraries(dx9 INTERFACE d3d9 d3dx9) - -else() - message(WARNING "DirectX 9 SDK not found at: ${DX9_SDK_PATH}") - message(WARNING "Please install DirectX SDK June 2010 or update DX9_SDK_PATH in cmake/dx9.cmake") -endif() +# Add DX9 SDK include and lib directories globally so that targets linking +# d3d9 or d3dx9 directly can find the headers and libraries. +include_directories(BEFORE SYSTEM "${dx9_SOURCE_DIR}") +link_directories("${dx9_SOURCE_DIR}")