port 2A step 2: copy the 40250 header closure into the port mirror
76 closure headers (EterBase, EterLocale, EterPack, EterLib, GameLib, MilesLib, EffectLib, SphereLib, EterImageLib) copied by the new port_copy.py (CP949->UTF-8, LF, include-path case only); platform-class headers go to the mirror path too, as the interface platform/ implements. Six manual `// PORT:` edits (Random, Singleton, Pool, Stl, Utils, FlyTarget). - common/D3D8Types.h: D3D8 value types with SDK values/layout, opaque COM interfaces - common/shim/sdk (d3d8/d3dx8/mss) on every platform, common/shim/win32 off Windows - Win32Types/Win32Crt: HRESULT, GUID, LARGE_INTEGER, LOGFONT/TEXTMETRIC, _atoi64, CRITICAL_SECTION on std::recursive_mutex - header gate prepends each library's StdAfx.h (40250's precompiled header) port_gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain). ScriptLib/EterPythonLib/UserInterface wait for 2P (their StdAfx includes Python). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,29 @@
|
||||
|
||||
file(GLOB_RECURSE MT_PORT_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
file(GLOB_RECURSE MT_PORT_HEADERS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
|
||||
if(WIN32)
|
||||
# Stand-ins for Windows SDK headers; on Windows the real ones are used.
|
||||
list(FILTER MT_PORT_HEADERS EXCLUDE REGEX "/common/shim/win32/")
|
||||
endif()
|
||||
|
||||
add_library(port_logic STATIC ${MT_PORT_SOURCES})
|
||||
target_include_directories(port_logic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# 40250 system headers the ported sources keep including verbatim: D3D8/D3DX/Miles SDK types everywhere,
|
||||
# Windows/CRT ones only where the platform has none.
|
||||
set(MT_PORT_SHIMS ${CMAKE_CURRENT_SOURCE_DIR}/common/shim/sdk)
|
||||
if(NOT WIN32)
|
||||
list(APPEND MT_PORT_SHIMS ${CMAKE_CURRENT_SOURCE_DIR}/common/shim/win32)
|
||||
endif()
|
||||
# EterBase/lzo.h includes <lzo/lzo1x.h>; third_party/minilzo provides that path.
|
||||
list(APPEND MT_PORT_SHIMS ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/minilzo)
|
||||
target_include_directories(port_logic PUBLIC ${MT_PORT_SHIMS})
|
||||
# 40250 sources carry MSVC `#pragma warning(...)` lines verbatim, and non-literal printf formats
|
||||
# (EterImageLib/StdAfx.h) that the Android toolchain turns into errors.
|
||||
set(MT_PORT_WARNING_FLAGS)
|
||||
if(NOT MSVC)
|
||||
set(MT_PORT_WARNING_FLAGS -Wno-unknown-pragmas -Wno-format-security)
|
||||
endif()
|
||||
target_compile_options(port_logic PUBLIC ${MT_PORT_WARNING_FLAGS})
|
||||
target_compile_features(port_logic PUBLIC cxx_std_20)
|
||||
if(WIN32)
|
||||
target_link_libraries(port_logic PUBLIC winmm)
|
||||
@@ -36,17 +56,25 @@ foreach(src IN LISTS MT_PORT_SOURCES)
|
||||
endforeach()
|
||||
|
||||
# Gate: every header under port/ compiles on its own (and twice, for its include guard), with its
|
||||
# library's definitions. Built by default, so every platform build enforces it.
|
||||
# library's definitions. As in 40250, where each library's StdAfx.h is the precompiled header of
|
||||
# every translation unit, the library's StdAfx.h comes first. Built by default, so every platform
|
||||
# build enforces it.
|
||||
set(MT_PORT_GATE_SOURCES)
|
||||
foreach(hdr IN LISTS MT_PORT_HEADERS)
|
||||
file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${hdr})
|
||||
string(MAKE_C_IDENTIFIER "${rel}" id)
|
||||
set(tu ${CMAKE_CURRENT_BINARY_DIR}/header_gate/${id}.cpp)
|
||||
file(CONFIGURE OUTPUT ${tu} CONTENT "#include \"${rel}\"\n#include \"${rel}\"\n")
|
||||
string(REGEX REPLACE "/.*" "" lib "${rel}")
|
||||
set(pch "")
|
||||
# 40250 spells it StdAfx.h or Stdafx.h; use the on-disk name for case-sensitive hosts.
|
||||
file(GLOB stdafx RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${lib}/[Ss]td[Aa]fx.h)
|
||||
if(NOT lib STREQUAL "common" AND stdafx)
|
||||
set(pch "#include \"${stdafx}\"\n")
|
||||
endif()
|
||||
file(CONFIGURE OUTPUT ${tu} CONTENT "${pch}#include \"${rel}\"\n#include \"${rel}\"\n")
|
||||
set_property(SOURCE ${tu} APPEND PROPERTY OBJECT_DEPENDS ${hdr})
|
||||
list(APPEND MT_PORT_GATE_SOURCES ${tu})
|
||||
# Definitions follow the header's library, not the generated file's location.
|
||||
string(REGEX REPLACE "/.*" "" lib "${rel}")
|
||||
if(DEFINED MT_PORT_DEFINES_${lib})
|
||||
set_property(SOURCE ${tu} APPEND PROPERTY COMPILE_DEFINITIONS ${MT_PORT_DEFINES_${lib}})
|
||||
else()
|
||||
@@ -54,8 +82,9 @@ foreach(hdr IN LISTS MT_PORT_HEADERS)
|
||||
endif()
|
||||
endforeach()
|
||||
add_library(port_header_gate OBJECT ${MT_PORT_GATE_SOURCES})
|
||||
target_include_directories(port_header_gate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(port_header_gate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MT_PORT_SHIMS})
|
||||
target_compile_features(port_header_gate PRIVATE cxx_std_20)
|
||||
target_compile_options(port_header_gate PRIVATE ${MT_PORT_WARNING_FLAGS})
|
||||
add_dependencies(port_logic port_header_gate)
|
||||
|
||||
if(BUILD_TESTING AND CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
|
||||
|
||||
Reference in New Issue
Block a user