Files
HelloVulkan/Engine/CMakeLists.txt
T
atdunbg 3ec96acc0f feat: Editor Gizmo——ImGuizmo 平移/旋转/缩放操纵杆
- ImGuizmo 接入:Lib/ImGuizmo(src/ 布局)静态库,IMGUI_DEFINE_MATH_OPERATORS
- ViewportPanel:Vulkan→GL 投影转换(Y 翻回 + 深度 [-1,1])、
  SetDrawlist/SetRect 叠加绘制、decompose 写回 TransformComponent
- W/E/R 切换(UE 语义);拖拽中 BlockingMouse 门控(输入归 Gizmo)
- Dynamic 刚体选中提示:物理每帧写回,编辑被覆盖
- 修复:GizmoState.op 初值 0 无轴位(ImGuizmo::TRANSLATE=7)导致杆不绘制
- 点击拾取门控:抓杆时(IsOver/IsUsing)不发 pick 请求
2026-10-02 23:16:52 +08:00

81 lines
3.1 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============ 第三方库目标(Engine 的依赖) ============
# ImGui(docking 分支,vendored submodule)
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/Lib/imgui)
add_library(imgui STATIC
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
# ${IMGUI_DIR}/imgui_demo.cpp # ShowDemoWindow 的实现(调试期保留)
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp
)
target_include_directories(imgui PUBLIC
${IMGUI_DIR}
${IMGUI_DIR}/backends)
# 两个 backend 头文件分别依赖 GLFW / Vulkan 头
target_link_libraries(imgui PUBLIC glfw Vulkan::Vulkan)
# ImGuizmo(视口操纵杆,vendored submodule;新版仓库源码在 src/,
# 只编译 ImGuizmo.cpp,GraphEditor/ImCurveEdit 等示例模块不用)
# IMGUI_DEFINE_MATH_OPERATORS 必须 PUBLIC:ImGuizmo.cpp 与任何
# include 其头文件的 TU 都要在 imgui.h 之前看到该宏(ImVec2 运算符)
set(IMGUIZMO_DIR ${CMAKE_SOURCE_DIR}/Lib/ImGuizmo/src)
add_library(ImGuizmo STATIC ${IMGUIZMO_DIR}/ImGuizmo.cpp)
target_include_directories(ImGuizmo PUBLIC ${IMGUIZMO_DIR})
target_compile_definitions(ImGuizmo PUBLIC IMGUI_DEFINE_MATH_OPERATORS)
target_link_libraries(ImGuizmo PUBLIC imgui)
# Tracy(CPU/GPU 帧分析)
add_library(tracy STATIC ${CMAKE_SOURCE_DIR}/Lib/tracy/public/TracyClient.cpp)
target_include_directories(tracy PUBLIC ${CMAKE_SOURCE_DIR}/Lib/tracy/public)
target_compile_definitions(tracy PUBLIC
TRACY_ENABLE
# 按需剖析:GPU context 宣告(GpuNewContext)与连接绑定——GUI 永远晚于
# 程序启动连接,没有这个宏宣告消息被丢弃,GPU 时间线永远空白
TRACY_ON_DEMAND)
find_package(Threads REQUIRED)
if(WIN32)
target_link_libraries(tracy PUBLIC
Threads::Threads
ws2_32
dbghelp
secur32)
else()
target_link_libraries(tracy PUBLIC Threads::Threads)
endif()
# ============ Engine ============
file(GLOB_RECURSE ENGINE_SOURCES CONFIGURE_DEPENDS src/*.cpp)
add_library(Engine STATIC ${ENGINE_SOURCES})
# PhysicsDebugDraw 派生 Jolt::DebugRendererSimple:Jolt 以 -fno-rtti 编译
#(有 key function 的基类 typeinfo 符号不存在),该 TU 必须同步关闭 RTTI,
# 否则派生类 typeinfo 引用悬空符号(链接期 undefined reference)
set_source_files_properties(src/Physics/PhysicsDebugDraw.cpp PROPERTIES
COMPILE_OPTIONS "-fno-rtti")
target_include_directories(Engine PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
# header-only 库:纯 include 路径
${CMAKE_SOURCE_DIR}/Lib/entt/src
${CMAKE_SOURCE_DIR}/Lib/VulkanMemoryAllocator/include)
target_link_libraries(Engine PUBLIC
glfw
glm::glm
Vulkan::Vulkan
spdlog::spdlog
stb
assimp::assimp
meshoptimizer
Jolt::Jolt
imgui
ImGuizmo
tracy)
target_compile_definitions(Engine PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)