Use preprocessors to ensure libvnc monitor is only built when libvnc is found

This commit is contained in:
hax0kartik 2020-03-26 00:08:00 -07:00
parent 5b1409d8df
commit 156728c9b6
4 changed files with 14 additions and 2 deletions

View File

@ -2,6 +2,8 @@
#include "zm_signal.h" #include "zm_signal.h"
#include "zm_libvnc_camera.h" #include "zm_libvnc_camera.h"
#if HAVE_LIBVNC
static int TAG_0; static int TAG_0;
static int TAG_1; static int TAG_1;
static int TAG_2; static int TAG_2;
@ -125,4 +127,5 @@ int VncCamera::CaptureAndRecord(Image &image, timeval recording, char* event_dir
int VncCamera::Close() { int VncCamera::Close() {
rfbClientCleanup(mRfb); rfbClientCleanup(mRfb);
return 0; return 0;
} }
#endif

View File

@ -6,6 +6,7 @@
#include "zm_camera.h" #include "zm_camera.h"
#include "zm_thread.h" #include "zm_thread.h"
#if HAVE_LIBVNC
#include <rfb/rfbclient.h> #include <rfb/rfbclient.h>
// Used by vnc callbacks // Used by vnc callbacks
@ -61,4 +62,4 @@ public:
int Close(); int Close();
}; };
#endif #endif // HAVE_LIBVNC

View File

@ -51,7 +51,9 @@
#if HAVE_LIBCURL #if HAVE_LIBCURL
#include "zm_curl_camera.h" #include "zm_curl_camera.h"
#endif // HAVE_LIBCURL #endif // HAVE_LIBCURL
#if HAVE_LIBVNC
#include "zm_libvnc_camera.h" #include "zm_libvnc_camera.h"
#endif // HAVE_LIBVNC
#if ZM_MEM_MAPPED #if ZM_MEM_MAPPED
#include <sys/mman.h> #include <sys/mman.h>
@ -2335,6 +2337,7 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) {
Fatal("You must have libcurl installed to use ffmpeg cameras for monitor %d", id); Fatal("You must have libcurl installed to use ffmpeg cameras for monitor %d", id);
#endif // HAVE_LIBCURL #endif // HAVE_LIBCURL
} else if ( type == "VNC" ) { } else if ( type == "VNC" ) {
#if HAVE_LIBVNC
camera = new VncCamera( camera = new VncCamera(
id, id,
host.c_str(), host.c_str(),
@ -2351,6 +2354,9 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) {
purpose==CAPTURE, purpose==CAPTURE,
record_audio record_audio
); );
#else // HAVE_LIBVNC
Fatal("You must have libvnc installed to use VNC cameras for monitor id %d", id);
#endif // HAVE_LIBVNC
} else { } else {
Fatal("Bogus monitor type '%s' for monitor %d", type.c_str(), id); Fatal("Bogus monitor type '%s' for monitor %d", type.c_str(), id);
} // end if type } // end if type

View File

@ -59,6 +59,8 @@
#cmakedefine HAVE_LIBAVRESAMPLE_AVRESAMPLE_H 1 #cmakedefine HAVE_LIBAVRESAMPLE_AVRESAMPLE_H 1
#cmakedefine HAVE_LIBVLC 1 #cmakedefine HAVE_LIBVLC 1
#cmakedefine HAVE_VLC_VLC_H 1 #cmakedefine HAVE_VLC_VLC_H 1
#cmakedefine HAVE_LIBVNC 1
#cmakedefine HAVE_RFB_RFB_H 1
#cmakedefine HAVE_LIBX264 1 #cmakedefine HAVE_LIBX264 1
#cmakedefine HAVE_X264_H 1 #cmakedefine HAVE_X264_H 1
#cmakedefine HAVE_LIBMP4V2 1 #cmakedefine HAVE_LIBMP4V2 1