Files
yaze/src/cli/z3ed.cmake
scawful 0b72b56594 refactor(cmake): enhance Protobuf target handling for MSVC
- Introduced YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS to streamline linking of Protobuf targets, excluding "lite" variants.
- Updated CMake configurations across various components (yaze, yaze_core_lib, yaze_editor, yaze_net, yaze_agent, z3ed) to utilize the new whole-archive targets for MSVC builds.
- Improved test suite linking to ensure all Protobuf symbols are included during the build process.

Benefits:
- Enhances compatibility and maintainability of Protobuf linking, leading to a more robust build configuration.
2025-10-14 22:22:00 -04:00

52 lines
1.5 KiB
CMake

# This file defines the z3ed command-line tool.
add_executable(z3ed
cli/cli_main.cc
cli/cli.cc
cli/tui/tui.cc
cli/tui/unified_layout.cc
cli/tui/chat_tui.cc
cli/tui/autocomplete_ui.cc
cli/util/autocomplete.cc
# ... (source files)
)
target_compile_definitions(z3ed PRIVATE YAZE_ASSETS_PATH="${CMAKE_SOURCE_DIR}/assets")
# Copy agent assets for z3ed
if(EXISTS ${CMAKE_SOURCE_DIR}/assets/agent)
file(COPY ${CMAKE_SOURCE_DIR}/assets/agent/ DESTINATION "${CMAKE_BINARY_DIR}/assets/agent/")
add_custom_command(TARGET z3ed POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets/agent $<TARGET_FILE_DIR:z3ed>/assets/agent
COMMENT "Copying agent assets for z3ed"
)
endif()
target_include_directories(z3ed PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/tui"
)
target_link_libraries(z3ed PRIVATE
yaze_core
yaze_agent
ftxui::component
)
if(Z3ED_AI)
target_link_libraries(z3ed PRIVATE yaml-cpp)
endif()
if(YAZE_WITH_GRPC)
message(STATUS "Adding gRPC support to z3ed CLI")
target_link_libraries(z3ed PRIVATE grpc++ grpc++_reflection)
if(YAZE_PROTOBUF_TARGETS)
target_link_libraries(z3ed PRIVATE ${YAZE_PROTOBUF_TARGETS})
if(MSVC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
target_link_options(z3ed PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
endforeach()
endif()
endif()
endif()