Files
mtgodot-poc/CMakeLists.txt
T
shenleiandClaude Opus 5 9a8e11f3dd port 2A step 4: platform skeleton + rest of the 2V3 header closure
- Mirror the remaining non-Python 2V3 closure headers (98 more, 173 total): EffectLib,
  EterGrnLib, SpeedTreeLib, SphereLib, PRTerrainLib, EterImageLib, EterBase/Poly, cipher/tea,
  EterLib Grp*/IME/Input/MSWindow/StateManager, GameLib actor/map/race headers, EterPack.
- SDK shims: granny.h, SpeedTreeRT.h, imm.h, Dimm.h (the SDK MIDL header, not mirrored),
  dinput/d3dx8 additions; D3D8 render-state enums, FVF macros and the COM resource hierarchy;
  more Win32 GDI/handle types with layout static_asserts.
- PORT edits for MSVC-permissive code (typename, friend visibility, <algorithm>, pointer→uintptr_t)
  and PRTerrainLib/StdAfx.h dropping the ScriptLib/Python include.
- port_logic links the vendored cryptopp/minilzo.
- extension/src/platform: port_platform target with 103 generated stub files (1917 function
  stubs, 146 static members) from the new platform_stub.py (clang -ast-dump-filter);
  MT_PLATFORM_STUB() marks every unimplemented body. libmtgodot links port_platform and
  port_gate.sh builds it.

Gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 21:46:24 +09:00

84 lines
3.6 KiB
CMake

# mtgodot-poc — top level
# Phase 1 (macOS) scaffolding. See docs/GODOT-POC-PLAN.md §M0'.
#
# libgr2 / formats / oracle / tools were vendored in from the retired xrender-poc
# repo (2026-08-29). libgr2 is the shared core (gr2 v6/v7 reader, oracle-verified);
# formats = .msa/.msm parsers (needed M2 T2.2/T2.3); tools = libgr2 validation.
cmake_minimum_required(VERSION 3.20)
project(mtgodot_poc CXX C)
include(CTest)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 17)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(MTGODOT_BUILD_EXTENSION "Build the Godot GDExtension (pulls in godot-cpp)" ON)
option(MTGODOT_BUILD_TOOLS "Build libgr2 validation tools (gr2dump/gr2fuzz/oracle_diff)" OFF)
option(MTGODOT_BUILD_NET_TOOLS "Build host-only protocol probes without Godot" OFF)
option(MTGODOT_BUILD_PORT "Build only port_logic (with MTGODOT_BUILD_EXTENSION=OFF), e.g. for Linux/Windows" OFF)
# --- shared, cross-platform core (no godot-cpp, no third-party) ---
add_subdirectory(libgr2)
add_subdirectory(formats)
if(MTGODOT_BUILD_TOOLS)
add_subdirectory(tools)
endif()
# --- the Godot extension ---
# Phase 1 was macOS-only; Phase 2 (BACKLOG F1/F2) adds iOS + Android. The three
# native deps are vendored (extension/third_party), so the only gate now is
# "is this a platform we've wired output naming + a toolchain for".
if(MTGODOT_BUILD_EXTENSION)
set(_mt_plat "${CMAKE_SYSTEM_NAME}")
if(_mt_plat STREQUAL "Darwin" OR _mt_plat STREQUAL "iOS" OR _mt_plat STREQUAL "Android")
message(STATUS "mtgodot extension: building for ${_mt_plat}")
else()
message(FATAL_ERROR
"MTGODOT_BUILD_EXTENSION: supported targets are macOS / iOS / Android "
"(got CMAKE_SYSTEM_NAME='${_mt_plat}'). See docs/PLATFORMS.md. "
"Use -DMTGODOT_BUILD_EXTENSION=OFF to build just libgr2/formats/tools.")
endif()
add_subdirectory(extension)
endif()
# FreeBSD is the native build target of the archived 40250 server, but it is
# not a supported Godot extension target. Keep the live classic probe
# available as a small host-only build so a FreeBSD jail/VM can compile and run
# it without pulling in godot-cpp or the Darwin/iOS/Android extension.
if(MTGODOT_BUILD_NET_TOOLS AND NOT MTGODOT_BUILD_EXTENSION)
add_subdirectory(extension/third_party)
add_library(mtnet_host STATIC
extension/src/net/secure_cipher.cpp
extension/src/net/net_stream.cpp
extension/src/net/entity_store.cpp
extension/src/net/mark_image.cpp
extension/src/net/classic/classic_stream.cpp
extension/src/net/classic/classic_parser.cpp
extension/src/net/classic/classic_session.cpp
extension/src/net/classic/classic_cipher.cpp
)
target_include_directories(mtnet_host PUBLIC extension/src/net)
target_link_libraries(mtnet_host PUBLIC mt3p::sodium mt3p::minilzo mt3p::cryptopp)
target_compile_features(mtnet_host PUBLIC cxx_std_20)
add_executable(net_classic_e2e_host extension/tools/net_classic_e2e.cpp)
target_link_libraries(net_classic_e2e_host PRIVATE mtnet_host)
endif()
# port_logic has no Godot dependency. On targets without an extension build (Linux, Windows) it is
# built on its own so the 2A gate (header self-containment, static_asserts) runs per platform.
if(MTGODOT_BUILD_PORT AND NOT MTGODOT_BUILD_EXTENSION)
if(NOT TARGET mt3p::cryptopp)
add_subdirectory(extension/third_party)
endif()
add_subdirectory(extension/src/port)
endif()