railroader-setons-special-s.../native/CMakeLists.txt
seton a1fcf01125 Initial commit: S3 - Seton's Special Sauce v0.2.0
Consolidates two standalone Railroader mods into one UMM "everything mod"
with an optional-module framework. Modules are disabled by default and
toggled per-module from the S3 settings page.

Core framework:
- IModule contract plus ModuleRegistry, with each module owning a Harmony
  instance scoped by its id so only enabled modules patch the game
- Per-module flat JSON settings (SettingsStore). On this Mono runtime
  JsonUtility silently drops nested custom-class fields, so settings stay flat
- Foldout-per-module settings panel plus a detector that offers to disable the
  old standalone mods if they are still installed

Modules (moved over to parity, verified in-game):
- Physics Optimizer (was RailroaderPhysicsOverhaul): LOD fast-path and
  auto-freeze, profiler overlay, debug car tinting, /rpf console commands
- Map Popout (was RRPopout): native map detach window. Pure-UMM install that
  drops the winhttp proxy and LoadLibrary's RRPopout.dll from the mod folder.
  Native Win32 + D3D11 + Dear ImGui engine included. Fixes a latent break where
  the now-private MapBuilder.UpdateForZoom() is reached via Traverse.

Build: dotnet for the managed assembly (netstandard2.1) and CMake for the
native DLL. build-local.ps1 installs into the game, build-release.ps1 packages
the UMM drag-install zip.
2026-06-17 14:17:41 -04:00

72 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.21)
project(RRPopout CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ---------------------------------------------------------------------------
# Dear ImGui — fetched once at configure time, built as a static lib.
# Only the D3D11 backend is compiled; Win32 input is fed manually via atomics.
# ---------------------------------------------------------------------------
include(FetchContent)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.90.4
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(imgui)
add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_dx11.cpp
)
target_include_directories(imgui PUBLIC
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
# imgui_impl_dx11.cpp calls D3DCompile at runtime to build its own shaders.
target_link_libraries(imgui PUBLIC d3d11 d3dcompiler)
# Suppress MSVC warnings inside third-party ImGui source.
if(MSVC)
target_compile_options(imgui PRIVATE /W0)
endif()
# ---------------------------------------------------------------------------
# RRPopout native plugin DLL
# ---------------------------------------------------------------------------
add_library(RRPopout SHARED
src/dllmain.cpp
src/exports.cpp
src/popout_windows.cpp
src/d3d11_renderer.cpp
)
target_include_directories(RRPopout PRIVATE
include
external
)
target_link_libraries(RRPopout PRIVATE
imgui
d3d11
dxgi
d3dcompiler
dwmapi # DwmSetWindowAttribute (dark title bar, rounded corners)
shell32 # ExtractIconExW (EXE icon loading)
)
set_target_properties(RRPopout PROPERTIES
OUTPUT_NAME "RRPopout"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
if(MSVC)
target_compile_options(RRPopout PRIVATE /W3 /WX- /GR- /EHsc)
target_compile_options(RRPopout PRIVATE $<$<CONFIG:Release>:/Zi>)
target_link_options(RRPopout PRIVATE $<$<CONFIG:Release>:/DEBUG /OPT:REF /OPT:ICF>)
endif()