Files
mtgodot-poc/CMakeLists.txt
T

74 lines
3.1 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)
# --- 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()