Split new_editor compat sources into static library

This commit is contained in:
2026-04-05 15:37:35 +08:00
parent 050502cf78
commit f6da4d0eb6
2 changed files with 52 additions and 7 deletions

View File

@@ -44,17 +44,10 @@ endif()
set(NEW_EDITOR_SOURCES
src/main.cpp
src/Application.cpp
src/ApplicationLegacyImGui.cpp
src/panels/Panel.cpp
src/panels/XCUIDemoPanel.cpp
src/panels/XCUILayoutLabPanel.cpp
src/Rendering/MainWindowBackdropPass.cpp
src/Rendering/MainWindowNativeBackdropRenderer.cpp
src/XCUIBackend/ImGuiXCUIInputAdapter.cpp
src/XCUIBackend/LegacyImGuiHostInterop.cpp
src/XCUIBackend/ImGuiHostCompositor.cpp
src/XCUIBackend/NativeWindowUICompositor.cpp
src/XCUIBackend/XCUIEditorFontSetup.cpp
src/XCUIBackend/XCUIAssetDocumentSource.cpp
src/XCUIBackend/XCUIEditorCommandRouter.cpp
src/XCUIBackend/XCUIInputBridge.cpp
@@ -64,6 +57,16 @@ set(NEW_EDITOR_SOURCES
src/XCUIBackend/XCUIStandaloneTextAtlasProvider.cpp
src/XCUIBackend/XCUIDemoRuntime.cpp
src/XCUIBackend/XCUILayoutLabRuntime.cpp
)
set(NEW_EDITOR_IMGUI_COMPAT_SOURCES
src/ApplicationLegacyImGui.cpp
src/panels/XCUIDemoPanel.cpp
src/panels/XCUILayoutLabPanel.cpp
src/XCUIBackend/ImGuiXCUIInputAdapter.cpp
src/XCUIBackend/LegacyImGuiHostInterop.cpp
src/XCUIBackend/ImGuiHostCompositor.cpp
src/XCUIBackend/XCUIEditorFontSetup.cpp
${IMGUI_SOURCE_DIR}/imgui.cpp
${IMGUI_SOURCE_DIR}/imgui_demo.cpp
${IMGUI_SOURCE_DIR}/imgui_draw.cpp
@@ -73,8 +76,17 @@ set(NEW_EDITOR_SOURCES
${IMGUI_SOURCE_DIR}/backends/imgui_impl_dx12.cpp
)
add_library(XCNewEditorImGuiCompat STATIC ${NEW_EDITOR_IMGUI_COMPAT_SOURCES})
add_executable(${PROJECT_NAME} WIN32 ${NEW_EDITOR_SOURCES})
target_include_directories(XCNewEditorImGuiCompat PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${XCENGINE_ROOT_DIR}/engine/include
${XCENGINE_ROOT_DIR}/editor/src
${IMGUI_SOURCE_DIR}
${IMGUI_SOURCE_DIR}/backends
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${XCENGINE_ROOT_DIR}/engine/include
@@ -85,6 +97,13 @@ target_include_directories(${PROJECT_NAME} PRIVATE
file(TO_CMAKE_PATH "${XCENGINE_ROOT_DIR}" XCENGINE_ROOT_DIR_CMAKE)
target_compile_definitions(XCNewEditorImGuiCompat PRIVATE
UNICODE
_UNICODE
XCENGINE_NEW_EDITOR_REPO_ROOT="${XCENGINE_ROOT_DIR_CMAKE}"
)
target_compile_options(XCNewEditorImGuiCompat PRIVATE /utf-8)
target_compile_definitions(${PROJECT_NAME} PRIVATE
UNICODE
_UNICODE
@@ -93,7 +112,18 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
target_compile_options(${PROJECT_NAME} PRIVATE /utf-8)
if(MSVC)
target_compile_options(XCNewEditorImGuiCompat PRIVATE /FS)
target_compile_options(${PROJECT_NAME} PRIVATE /FS)
set_property(TARGET XCNewEditorImGuiCompat PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_target_properties(XCNewEditorImGuiCompat PROPERTIES
MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>"
COMPILE_PDB_NAME "XCNewEditorImGuiCompat-compile"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/new_editor/compile-pdb-compat"
COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/new_editor/compile-pdb-compat/Debug"
COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/new_editor/compile-pdb-compat/Release"
COMPILE_PDB_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/new_editor/compile-pdb-compat/MinSizeRel"
COMPILE_PDB_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/new_editor/compile-pdb-compat/RelWithDebInfo")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug,RelWithDebInfo>:/INCREMENTAL:NO>)
set_property(TARGET ${PROJECT_NAME} PROPERTY
@@ -110,8 +140,17 @@ if(MSVC)
)
endif()
target_link_libraries(XCNewEditorImGuiCompat PRIVATE
XCEngine
d3d12.lib
dxgi.lib
user32
gdi32
)
target_link_libraries(${PROJECT_NAME} PRIVATE
XCEngine
XCNewEditorImGuiCompat
d3d12.lib
dxgi.lib
user32