mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 14:27:59 -05:00
Make nlohmann_json optional
This commit is contained in:
@@ -591,7 +591,13 @@ if(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
set(ZM_PCRE 1)
|
||||
endif()
|
||||
|
||||
find_package(nlohmann_json)
|
||||
find_package(nlohmann_json CONFIG)
|
||||
if(nlohmann_json_FOUND)
|
||||
set(ZM_HAS_NLOHMANN_JSON 1)
|
||||
else()
|
||||
set(ZM_HAS_NLOHMANN_JSON 0)
|
||||
message(AUTHOR_WARNING "nlohmann_json headers weren't found - AI results will not be available")
|
||||
endif()
|
||||
|
||||
# Check for mmap and enable in all components
|
||||
set(ZM_MEM_MAPPED 0)
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#if HAS_NLOHMANN_JSON
|
||||
#include <nlohmann/json.hpp>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
@@ -61,7 +63,9 @@ class ZMPacket {
|
||||
bool decoded;
|
||||
std::vector<ZoneStats> zone_stats;
|
||||
std::string alarm_cause;
|
||||
#if HAS_NLOHMANN_JSON
|
||||
nlohmann::json detections;
|
||||
#endif
|
||||
|
||||
public:
|
||||
AVPacket *av_packet() { return packet.get(); }
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
/* Few ZM options that are needed by the source code */
|
||||
#cmakedefine ZM_MEM_MAPPED 1
|
||||
#cmakedefine ZM_HAS_V4L2 1
|
||||
#cmakedefine ZM_HAS_NLOHMANN_JSON 1
|
||||
|
||||
/* Its safe to assume that signal return type is void. This is a fix for zm_signal.h */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
Reference in New Issue
Block a user