railroader-setons-special-s.../native/CMakeLists.txt
seton a4d3cd1621 feat(map): S3 v0.2.1 - in-game overlay, M/F10, popout restore
Replace the bare-bones stock map with a full Dear ImGui in-game overlay
(M key). The overlay shares the same toolbar and compass as the OS popout
window: Follow, Pop Out, Gear, rotation compass.

Pop Out button is now in the bottom toolbar where it is actually visible.
Pressing it (or F10) closes the overlay, waits 0.5 s for the camera to
release, then opens the OS popout window. Closing the popout restores the
overlay if it was running when the launch was triggered. Pressing M while
the popout is open closes the popout and reopens the overlay.

Harmony patches intercept MapWindow.Toggle and Show so base-game "Show on
map" links and the map hotkey both route through the S3 overlay. MapBypass
lets internal S3 calls through without triggering the patch recursively.

Camera ownership is enforced in LateUpdate so no base-game script can reset
targetTexture before the camera renders. Object.Destroy replaces Release()
on both RT teardown paths so the D3D address stays live until end-of-frame
and cannot be recycled into a new RT mid-frame.
2026-06-17 22:25:48 -04:00

72 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.21)
project(S3Native 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()
# ---------------------------------------------------------------------------
# S3Native native plugin DLL
# ---------------------------------------------------------------------------
add_library(S3Native SHARED
src/dllmain.cpp
src/exports.cpp
src/popout_windows.cpp
src/d3d11_renderer.cpp
)
target_include_directories(S3Native PRIVATE
include
external
)
target_link_libraries(S3Native PRIVATE
imgui
d3d11
dxgi
d3dcompiler
dwmapi # DwmSetWindowAttribute (dark title bar, rounded corners)
shell32 # ExtractIconExW (EXE icon loading)
)
set_target_properties(S3Native PROPERTIES
OUTPUT_NAME "S3Native"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
if(MSVC)
target_compile_options(S3Native PRIVATE /W3 /WX- /GR- /EHsc)
target_compile_options(S3Native PRIVATE $<$<CONFIG:Release>:/Zi>)
target_link_options(S3Native PRIVATE $<$<CONFIG:Release>:/DEBUG /OPT:REF /OPT:ICF>)
endif()