]> sigrok.org Git - libsigrokflow.git/commitdiff
Check for the (optional) libsigrokcxx dependency.
authorUwe Hermann <redacted>
Tue, 8 Jan 2019 21:18:11 +0000 (22:18 +0100)
committerUwe Hermann <redacted>
Tue, 8 Jan 2019 23:09:36 +0000 (00:09 +0100)
configure.ac
include/libsigrokflow/libsigrokflow.hpp
libsigrokflow.pc.in
src/main.cpp

index 3ebe563785ac8cd84bd5327bf54bd3805dadfe9e..bafb3ba34eea764351b265b4e3112dec17d4864f 100644 (file)
@@ -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
index 5e8f48346793209a1ad32b61bdaffb71d0d08d9a..ee71487cf3d1c638b7e9d4b4a64a95bc7921336d 100644 (file)
@@ -24,7 +24,9 @@
 #include <gstreamermm.h>
 #include <gstreamermm/private/element_p.h>
 #include <gstreamermm/private/basesink_p.h>
+#ifdef HAVE_LIBSIGROKCXX
 #include <libsigrokcxx/libsigrokcxx.hpp>
+#endif
 #include <libsigrokdecode/libsigrokdecode.h>
 
 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<sigrok::Output> _libsigrok_output;
         map<string, Glib::VariantBase> _options;
 };
+#endif
 
 class LegacyDecoder :
         public Sink
index 6ed0582fbda3b8e85492b441e685cb72b232e5ac..b30a458236537649dffcd27ad2ee5f975f413fcc 100644 (file)
@@ -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}
index db3de8fad347ba9cc16eb339c1ef8db19944579e..080ef64376e5fe69d66dcbfc5402f909cb6debc1 100644 (file)
@@ -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<LegacyCaptureDevice> *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<LegacyDecoder> *klass)
 {