Files
HelloVulkan/Engine/CMakeLists.txt
T
atdunbg cc837bc605 Add animation controller system, material assets and skeleton visualization
- .animctrl state machine asset (params/transitions/blend trees, 1D+2D
  directional blending) with Unity Animator-style editor panel: state
  list, transitions, params, directional pad preview driving live
  CrossFade on the selected entity
- Split animation evaluation out of SceneRenderer into
  AnimationSystem/AnimationEvaluator; skin palettes with rest-pose
  fallback and blend-weight epsilon filtering
- MaterialAsset (.material) with reload-safe preview tile pool
  (DropMaterial clears dirty refs before instance destruction)
- EditorGizmoPass skeleton wires + viewport joint overlay; camera
  projection rework (baked Vulkan Y-flip, ortho support)
- Editor/game build split via HELLOVULKAN_EDITOR option
2026-10-07 01:50:04 +08:00

97 lines
3.8 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)
# game 构建(HELLOVULKAN_EDITOR=OFF):editor 专属 pass 整 TU 不进产物
#(材质球预览 / Editor gizmo——对应头文件只含声明,无符号产出)
if(NOT HELLOVULKAN_EDITOR)
list(REMOVE_ITEM ENGINE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer/Passes/MaterialPreviewPass.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer/Passes/EditorGizmoPass.cpp)
endif()
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
yaml-cpp::yaml-cpp
imgui
ImGuizmo
tracy)
target_compile_definitions(Engine PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)
# editor/game 编译期分离:HELLO_EDITOR=1 时预览子系统 + 编辑器消费端编译
#(PUBLIC——App 层 main.cpp 的编辑器装配同样按此宏裁剪)
if(HELLOVULKAN_EDITOR)
target_compile_definitions(Engine PUBLIC HELLO_EDITOR=1)
endif()