Skip to content

Commit 4d54a2f

Browse files
committed
Guard core UI response helpers when UI is disabled
1 parent 3024bdc commit 4d54a2f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ endif()
362362
# --------------------------------------------------------------------
363363
# ui dependency
364364
# --------------------------------------------------------------------
365-
if (NOT TARGET vix::ui AND NOT TARGET vix_ui AND NOT TARGET ui)
365+
if (NOT VIX_CORE_WITH_UI STREQUAL "OFF" AND NOT TARGET vix::ui AND NOT TARGET vix_ui AND NOT TARGET ui)
366366
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/../ui/CMakeLists.txt")
367367
message(STATUS "[core] Adding ui from sibling: ../ui")
368368
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../ui" "ui")

include/vix/http/ResponseWrapper.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
#include <nlohmann/json.hpp>
3434
#include <vix/template/Context.hpp>
3535
#include <vix/view/TemplateView.hpp>
36+
#ifndef VIX_CORE_NO_UI
3637
#include <vix/ui/core/View.hpp>
3738
#include <vix/ui/html/HtmlResponse.hpp>
39+
#endif
3840

3941
namespace vix::http
4042
{
@@ -449,6 +451,7 @@ namespace vix::http
449451
return *this;
450452
}
451453

454+
#ifndef VIX_CORE_NO_UI
452455
/** @brief Send a Vix UI HTML response. */
453456
ResponseWrapper &ui(const vix::ui::HtmlResponse &response)
454457
{
@@ -492,6 +495,7 @@ namespace vix::http
492495
return ui(vix::ui::HtmlResponse::from_view_result(result, s));
493496
}
494497

498+
#endif
495499
/** @brief Send JSON using nlohmann::json with an auto Content-Type if missing. */
496500
ResponseWrapper &json(const vix::json::Json &j)
497501
{

0 commit comments

Comments
 (0)