port: EterImageLib Image/TGAImage/DXTCImage verbatim (+ d3d.h ddraw shim)

-fno-strict-aliasing on the port targets: 40250 relies on MSVC's lack of
type-based alias analysis (DXTCImage reads Color8888 through DWORD*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 13:31:21 +09:00
co-authored by Claude Opus 5.5
parent 32c5a09d6e
commit 75ea2703c6
10 changed files with 2758 additions and 152 deletions
+6
View File
@@ -43,6 +43,9 @@ endif()
set(MT_PORT_WARNING_FLAGS)
if(NOT MSVC)
set(MT_PORT_WARNING_FLAGS -Wno-unknown-pragmas -Wno-format-security)
# MSVC does no type-based alias analysis and 40250 relies on it (DXTCImage reads a Color8888 through a
# DWORD*; clang -O2 then loads the colour before it is written).
list(APPEND MT_PORT_WARNING_FLAGS -fno-strict-aliasing)
endif()
target_compile_options(port_logic PUBLIC ${MT_PORT_WARNING_FLAGS})
# 40250 headers keep `#pragma comment(lib, "d3d8.lib")` etc. verbatim; clang turns them into ELF
@@ -208,6 +211,9 @@ if(BUILD_TESTING AND CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
add_executable(port_input_test ${PROJECT_SOURCE_DIR}/tests/port/port_input_test.cpp)
target_link_libraries(port_input_test PRIVATE port_platform)
add_test(NAME port.input COMMAND $<TARGET_FILE:port_input_test>)
add_executable(port_eter_image_test ${PROJECT_SOURCE_DIR}/tests/port/port_eter_image_test.cpp)
target_link_libraries(port_eter_image_test PRIVATE port_platform)
add_test(NAME port.eter_image COMMAND $<TARGET_FILE:port_eter_image_test>)
# MilesLib: the 40250 sound managers over the Miles emulation (platform/MilesLib/MilesAil.cpp).
add_executable(port_miles_test ${PROJECT_SOURCE_DIR}/tests/port/port_miles_test.cpp)