From: Uwe Hermann Date: Tue, 8 Jan 2019 21:18:11 +0000 (+0100) Subject: Check for the (optional) libsigrokcxx dependency. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1060e9b5f80cde2c6b6cb18ded1fdbe0862c7796;p=libsigrokflow.git Check for the (optional) libsigrokcxx dependency. --- diff --git a/configure.ac b/configure.ac index 3ebe563..bafb3ba 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,16 @@ SR_LIB_VERSION_SET([SRF_LIB_VERSION], [0:0:0]) # We require at least 0.22, as "Requires.private" behaviour changed there. PKG_PROG_PKG_CONFIG([0.22]) +# Keep track of all checked modules so we can list them at the end. +SR_PKG_CHECK_SUMMARY([srf_pkglibs_summary]) + +# Collect the pkg-config module names of all dependencies in SRF_PKGLIBS. +# These are used to derive the compiler flags and for the "Requires.private" +# field in the generated libsigrokflow.pc file. +SR_VAR_OPT_PKG([SRF_PKGLIBS], [srf_deps_avail]) + +SR_ARG_OPT_PKG([libsigrokcxx], [LIBSIGROKCXX], , [libsigrokcxx >= 0.5.1]) + AC_LANG([C++]) SR_ARG_ENABLE_WARNINGS([SRF_WXXFLAGS], [-Wall], [-Wall -Wextra]) @@ -106,4 +116,7 @@ Compile configuration: Detected libraries (required): - gstreamermm >= 1.8.0 ........... $srf_gstreamermm_version +Detected libraries (optional): +$srf_pkglibs_summary + _EOF diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index 5e8f483..ee71487 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -24,7 +24,9 @@ #include #include #include +#ifdef HAVE_LIBSIGROKCXX #include +#endif #include namespace Srf @@ -62,6 +64,7 @@ protected: explicit CaptureDevice(GstElement *gobj); }; +#ifdef HAVE_LIBSIGROKCXX class LegacyCaptureDevice : public CaptureDevice { @@ -168,6 +171,7 @@ private: shared_ptr _libsigrok_output; map _options; }; +#endif class LegacyDecoder : public Sink diff --git a/libsigrokflow.pc.in b/libsigrokflow.pc.in index 6ed0582..b30a458 100644 --- a/libsigrokflow.pc.in +++ b/libsigrokflow.pc.in @@ -7,6 +7,7 @@ Name: libsigrokflow Description: sigrok flow graph library URL: http://www.sigrok.org Requires: gstreamermm-1.0 >= 1.8.0 +Requires.private: @SRF_PKGLIBS@ Version: @SRF_PACKAGE_VERSION@ Libs: -L${libdir} -lsigrokflow Cflags: -I${includedir} diff --git a/src/main.cpp b/src/main.cpp index db3de8f..080ef64 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ using namespace std::placeholders; void init() { +#ifdef HAVE_LIBSIGROKCXX Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "sigrok_legacy_capture_device", "Wrapper for capture devices using legacy libsigrok APIs", @@ -48,6 +49,7 @@ void init() "Wrapper for outputs using legacy libsigrok APIs", sigc::ptr_fun(&LegacyOutput::register_element), "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org"); +#endif Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "sigrok_legacy_decoder", "Wrapper for protocol decoders using legacy libsigrokdecode APIs", @@ -70,6 +72,7 @@ CaptureDevice::CaptureDevice(GstElement *gobj) : { } +#ifdef HAVE_LIBSIGROKCXX void LegacyCaptureDevice::class_init(Gst::ElementClass *klass) { klass->set_metadata("sigrok legacy capture device", @@ -345,6 +348,7 @@ bool LegacyOutput::stop_vfunc() cout << result; return true; } +#endif void LegacyDecoder::class_init(Gst::ElementClass *klass) {