Add bt_log macro for logging AI actions

This commit is contained in:
Nikita Lisitsa 2024-11-18 16:37:30 +03:00
parent 6971b8545a
commit daa2b9c49a
3 changed files with 14 additions and 0 deletions

View file

@ -45,6 +45,8 @@ option(PSEMEK_LEGACY_UI "Use legacy UI library" OFF)
message(STATUS "Using backend ${PSEMEK_BACKEND}") message(STATUS "Using backend ${PSEMEK_BACKEND}")
option(PSEMEK_BT_LOG "Add logging for behavior tree actions" OFF)
if(PSEMEK_BACKEND STREQUAL "ANDROID") if(PSEMEK_BACKEND STREQUAL "ANDROID")
set(PSEMEK_GL_API gles32) set(PSEMEK_GL_API gles32)
set(PSEMEK_GL_LIBRARIES GLESv3 EGL) set(PSEMEK_GL_LIBRARIES GLESv3 EGL)

View file

@ -4,3 +4,6 @@ file(GLOB_RECURSE PSEMEK_BT_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "sour
psemek_add_library(psemek-bt ${PSEMEK_BT_HEADERS} ${PSEMEK_BT_SOURCES}) psemek_add_library(psemek-bt ${PSEMEK_BT_HEADERS} ${PSEMEK_BT_SOURCES})
target_include_directories(psemek-bt PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories(psemek-bt PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(psemek-bt PUBLIC psemek-util psemek-log) target_link_libraries(psemek-bt PUBLIC psemek-util psemek-log)
if(PSEMEK_BT_LOG)
target_compile_definitions(psemek-bt PUBLIC -DPSEMEK_BT_LOG=1)
endif()

View file

@ -0,0 +1,9 @@
#pragma once
#ifdef PSEMEK_BT_LOG
#include <psemek/log/log.hpp>
#define bt_log ::psemek::log::debug
#else
#include <psemek/util/null_ostream.hpp>
#define bt_log ::psemek::util::null_ostream
#endif