diff --git a/CMakeLists.txt b/CMakeLists.txt index b9885446..6d2f91c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,9 @@ endif() enable_testing() option(XCENGINE_ENABLE_MONO_SCRIPTING "Build the Mono-based C# scripting runtime" ON) +option(XCENGINE_BUILD_XCUI_EDITOR_CORE "Build the XCUI editor product core library" ON) option(XCENGINE_BUILD_XCUI_EDITOR_APP "Build the XCUI editor shell app" ON) -if(XCENGINE_BUILD_XCUI_EDITOR_APP) +if(XCENGINE_BUILD_XCUI_EDITOR_CORE OR XCENGINE_BUILD_XCUI_EDITOR_APP) set(XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT_DEFAULT ON) else() set(XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT_DEFAULT OFF) diff --git a/docs/plan/editor-core-refactor-plan.md b/docs/plan/editor-core-refactor-plan.md index 952cdc72..3d151973 100644 --- a/docs/plan/editor-core-refactor-plan.md +++ b/docs/plan/editor-core-refactor-plan.md @@ -105,6 +105,10 @@ Completed boundary cuts: explicit app module include roots. It restores project panel, scene viewport, viewport render-plan, viewport object-id picker, and app input-routing tests without widening the include surface. +- `XCEditorCore` is now controlled by `XCENGINE_BUILD_XCUI_EDITOR_CORE` + instead of the executable-host switch. `XCENGINE_BUILD_XCUI_EDITOR_APP=OFF` + can still build the product core and the app-facing test targets when + renderer editor support is enabled. - The old Win32 tab-drag-drop target test now covers the current reusable `XCEditor/Docking/UIEditorDockHostTransfer.h` API through `editor_windowing_phase1_tests`. @@ -280,6 +284,8 @@ Completed follow-up: ## Phase 2: Introduce XCEditorCore +Status: completed and build-graph enforced. + Create: ```cmake @@ -316,6 +322,19 @@ Important: do not hide Win32/D3D12 in `XCEditorCore` just to make the first CMake edit easier. If a source file needs `windows.h`, it belongs in the host side until a neutral interface exists. +Completed target-graph cut: + +- `XCENGINE_BUILD_XCUI_EDITOR_CORE` controls `XCEditorCore` and defaults to + `ON`. +- `XCENGINE_BUILD_XCUI_EDITOR_APP` controls only the concrete executable host + target `XCEditor`. +- `XCEditor` requires `XCENGINE_BUILD_XCUI_EDITOR_CORE=ON`. +- When either the core library or executable host is enabled, the root build + defaults `XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON` because editor core + owns viewport services that link renderer editor support. +- The host-off validation shape is: + `-DXCENGINE_BUILD_XCUI_EDITOR_APP=OFF -DXCENGINE_BUILD_XCUI_EDITOR_CORE=ON -DXCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON`. + ## Phase 3: Restore App-Core And App Feature Tests Status: completed for the initial app-core and app feature/viewport suites. @@ -512,6 +531,16 @@ cmake --build build --config Debug --target editor_app_feature_tests cmake --build build --config Debug --target editor_windowing_phase1_tests ``` +To prove the product core boundary without the executable host, configure a +separate build directory with: + +```powershell +cmake -S . -B build/editor_core_hostoff -DXCENGINE_BUILD_XCUI_EDITOR_APP=OFF -DXCENGINE_BUILD_XCUI_EDITOR_CORE=ON -DXCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON +cmake --build build/editor_core_hostoff --config Debug --target XCEditorCore +cmake --build build/editor_core_hostoff --config Debug --target editor_app_core_tests +cmake --build build/editor_core_hostoff --config Debug --target editor_app_feature_tests +``` + When app smoke is available: ```powershell diff --git a/editor/AGENTS.md b/editor/AGENTS.md index 6ec55f83..b2d9260e 100644 --- a/editor/AGENTS.md +++ b/editor/AGENTS.md @@ -20,6 +20,11 @@ change. should be buildable without the concrete Win32/D3D12 executable host: composition, commands, state, project and scene services, feature panels, utility-window descriptors, viewport services, and editor window core. +- `XCEditorCore` is controlled by `XCENGINE_BUILD_XCUI_EDITOR_CORE`, which + defaults to `ON` and is independent of `XCENGINE_BUILD_XCUI_EDITOR_APP`. + App-off core validation must configure with + `XCENGINE_BUILD_XCUI_EDITOR_APP=OFF` while keeping + `XCENGINE_BUILD_XCUI_EDITOR_CORE=ON`. - `editor_app_core_tests` links `XCEditorCore` directly and is the build gate that proves the product-core boundary outside the executable host. - `editor_app_feature_tests` also links `XCEditorCore` directly. It restores @@ -33,9 +38,12 @@ change. Its implementation include paths enumerate concrete app module roots such as `app/Composition`, `app/Features`, `app/Windowing`, `app/Rendering`, `app/Scene`, `app/Services`, and `app/Support`. +- `XCEditorCore` and `XCEditor` require + `XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON`; the root build defaults that + support on when either the core library or app executable is enabled. - `XCEditor` is built when `XCENGINE_BUILD_XCUI_EDITOR_APP=ON`; that mode - requires `XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON`. The executable target - is named `XCEditor`, but its output name is `XCEngine`. + also requires `XCENGINE_BUILD_XCUI_EDITOR_CORE=ON`. The executable target is + named `XCEditor`, but its output name is `XCEngine`. - The executable target owns process startup, Win32 hosting, D3D12 window rendering, native resources, and the final composition-root wiring. - Keep the CMake target named `XCEditor` so it does not collide with the engine @@ -325,6 +333,10 @@ inside pure shell/widget code. - `XCEditorCore` is the app/product-core target. It exists to make the app boundary build-visible before finer-grained directories are cleaned up. +- `XCEditorCore` is not gated by the executable-host option. Keep + `XCENGINE_BUILD_XCUI_EDITOR_CORE` as the switch for product-core builds and + `XCENGINE_BUILD_XCUI_EDITOR_APP` as the switch for the concrete executable + host. - `XCEditorCore` does not use `editor/app` as a private implementation include root. Its public usage requirements expose only `app/Core`, `app/Commands`, `app/State`, `app/Host/Interfaces`, `include`, and engine headers; @@ -363,6 +375,11 @@ inside pure shell/widget code. - Build product editor core after app composition, service, feature, windowing, or host-contract changes: `cmake --build --config Debug --target XCEditorCore`. +- Validate the product-core boundary without the executable host by configuring + a separate build with + `-DXCENGINE_BUILD_XCUI_EDITOR_APP=OFF -DXCENGINE_BUILD_XCUI_EDITOR_CORE=ON -DXCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON`, + then building `XCEditorCore`, `editor_app_core_tests`, and + `editor_app_feature_tests`. - Build app-core tests after product editor core or app-facing test changes: `cmake --build --config Debug --target editor_app_core_tests`. - Build app feature/viewport tests after feature panel, scene viewport, @@ -506,3 +523,7 @@ ownership rule. tests use `Viewport/ViewportObjectIdPicker.h`, and the old Win32 tab-drop test now covers `XCEditor/Docking/UIEditorDockHostTransfer.h` through `editor_windowing_phase1_tests`. +- `XCEditorCore` is now controlled by `XCENGINE_BUILD_XCUI_EDITOR_CORE` + instead of `XCENGINE_BUILD_XCUI_EDITOR_APP`. The executable host option only + creates `XCEditor`, and app-off builds can still compile `XCEditorCore`, + `editor_app_core_tests`, and `editor_app_feature_tests`. diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 5f4ee135..4ae60c44 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -20,9 +20,15 @@ function(xcui_editor_apply_common_target_settings target visibility) endfunction() if(XCENGINE_BUILD_XCUI_EDITOR_APP AND + NOT XCENGINE_BUILD_XCUI_EDITOR_CORE) + message(FATAL_ERROR + "XCEditor requires XCEditorCore; set XCENGINE_BUILD_XCUI_EDITOR_CORE=ON") +endif() + +if((XCENGINE_BUILD_XCUI_EDITOR_CORE OR XCENGINE_BUILD_XCUI_EDITOR_APP) AND NOT XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT) message(FATAL_ERROR - "XCEditor requires XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON") + "XCEditorCore requires XCENGINE_ENABLE_RENDERING_EDITOR_SUPPORT=ON") endif() set(XCUI_EDITOR_FOUNDATION_SOURCES @@ -209,13 +215,7 @@ set(XCUI_EDITOR_HOST_RENDERING_SOURCES app/Host/D3D12/D3D12WindowRenderLoop.cpp ) -if(XCENGINE_BUILD_XCUI_EDITOR_APP) - set(XCUI_EDITOR_APP_BOOTSTRAP_SOURCES - app/Bootstrap/EditorApp.rc - app/main.cpp - app/Bootstrap/Application.cpp - ) - +if(XCENGINE_BUILD_XCUI_EDITOR_CORE) set(XCUI_EDITOR_APP_CORE_CONTRACT_SOURCES app/Core/UtilityWindows/EditorUtilityWindowRegistry.cpp ) @@ -284,19 +284,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP) app/Scene/EditorSceneBridge.cpp ) - set(XCUI_EDITOR_APP_PLATFORM_SOURCES - app/Host/Win32/Diagnostics/Win32CrashTrace.cpp - app/Host/Win32/Windowing/EditorWindow.cpp - app/Host/Win32/Windowing/EditorFloatingWindowPlacement.cpp - app/Host/Win32/Windowing/EditorWindowSession.cpp - app/Host/Win32/Chrome/EditorWindowChromeController.cpp - app/Host/Win32/Resources/Win32EditorResourceService.cpp - app/Host/Win32/Runtime/EditorWindowInputController.cpp - app/Host/Win32/System/Win32SystemInteractionHost.cpp - app/Host/Win32/Windowing/EditorWindowHostRuntime.cpp - app/Host/Win32/Windowing/EditorWindowMessageDispatcher.cpp - ) - set(XCUI_EDITOR_APP_CORE_SOURCES ${XCUI_EDITOR_APP_CORE_CONTRACT_SOURCES} ${XCUI_EDITOR_APP_STATE_SOURCES} @@ -347,6 +334,28 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP) XCEngineRenderingEditorSupport ) +endif() + +if(XCENGINE_BUILD_XCUI_EDITOR_APP) + set(XCUI_EDITOR_APP_BOOTSTRAP_SOURCES + app/Bootstrap/EditorApp.rc + app/main.cpp + app/Bootstrap/Application.cpp + ) + + set(XCUI_EDITOR_APP_PLATFORM_SOURCES + app/Host/Win32/Diagnostics/Win32CrashTrace.cpp + app/Host/Win32/Windowing/EditorWindow.cpp + app/Host/Win32/Windowing/EditorFloatingWindowPlacement.cpp + app/Host/Win32/Windowing/EditorWindowSession.cpp + app/Host/Win32/Chrome/EditorWindowChromeController.cpp + app/Host/Win32/Resources/Win32EditorResourceService.cpp + app/Host/Win32/Runtime/EditorWindowInputController.cpp + app/Host/Win32/System/Win32SystemInteractionHost.cpp + app/Host/Win32/Windowing/EditorWindowHostRuntime.cpp + app/Host/Win32/Windowing/EditorWindowMessageDispatcher.cpp + ) + set(XCUI_EDITOR_APP_HOST_SOURCES ${XCUI_EDITOR_HOST_PLATFORM_SOURCES} ${XCUI_EDITOR_HOST_RENDERING_SOURCES} @@ -412,8 +421,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP) if(WIN32 AND XCENGINE_ENABLE_PHYSX) xcengine_copy_physx_runtime_dlls(XCEditor) endif() - endif() -