]> sigrok.org Git - pulseview.git/commitdiff
Added ENABLE_SIGROKDECODE option, disabled for now
authorJoel Holdsworth <redacted>
Tue, 16 Apr 2013 18:45:04 +0000 (19:45 +0100)
committerJoel Holdsworth <redacted>
Thu, 18 Apr 2013 19:26:51 +0000 (20:26 +0100)
CMakeLists.txt
main.cpp
pv/dialogs/about.cpp
pv/mainwindow.cpp

index 7d46b25ee5359b171f93216ffec1924ab7cf260d..8566adf04a8509294c0625f6f9521c4f76da8970 100644 (file)
@@ -28,6 +28,7 @@ project(pulseview)
 #-------------------------------------------------------------------------------
 
 option(DISABLE_WERROR "Build without -Werror" FALSE)
+option(ENABLE_SIGROKDECODE "Build with libsigrokdecode" FALSE)
 option(ENABLE_TESTS "Enable unit tests" FALSE)
 option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE)
 
@@ -45,12 +46,17 @@ endif()
 #= Dependencies
 #-------------------------------------------------------------------------------
 
-find_package(PkgConfig)
-pkg_check_modules(PKGDEPS REQUIRED
-       libsigrokdecode>=0.1.0
+list(APPEND PKGDEPS
        libsigrok>=0.2.0
 )
 
+if(ENABLE_SIGROKDECODE)
+       list(APPEND PKGDEPS libsigrokdecode>=0.1.0)
+endif()
+
+find_package(PkgConfig)
+pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
+
 find_package(Qt4 REQUIRED)
 
 # Find the platform's thread library (needed for boost-thread).
@@ -158,6 +164,10 @@ include(${QT_USE_FILE})
 add_definitions(${QT_DEFINITIONS})
 add_definitions(-Wall -Wextra)
 
+if(ENABLE_SIGROKDECODE)
+       add_definitions(-DENABLE_SIGROKDECODE)
+endif()
+
 if(NOT DISABLE_WERROR)
        add_definitions(-Werror)
 endif()
index 42e4a7c17062f863e987a4d68d81c313663d062f..b72fc70c46b38320b25179b593ef0b5afc05f762 100644 (file)
--- a/main.cpp
+++ b/main.cpp
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#ifdef ENABLE_SIGROKDECODE
 #include <sigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#endif
+
 #include <stdint.h>
 #include <libsigrok/libsigrok.h>
 
@@ -77,7 +80,11 @@ int main(int argc, char *argv[])
                {
                        const int loglevel = atoi(optarg);
                        sr_log_loglevel_set(loglevel);
+
+#ifdef ENABLE_SIGROKDECODE
                        srd_log_loglevel_set(loglevel);
+#endif
+
                        break;
                }
 
@@ -105,11 +112,18 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       // Initialise libsigrokdecode
-       if (srd_init(NULL) == SRD_OK) {
+       do {
+
+#ifdef ENABLE_SIGROKDECODE
+               // Initialise libsigrokdecode
+               if (srd_init(NULL) != SRD_OK) {
+                       qDebug() << "ERROR: libsigrokdecode init failed.";
+                       break;
+               }
 
                // Load the protocol decoders
                srd_decoder_load_all();
+#endif
 
                // Initialize all libsigrok drivers
                sr_dev_driver **const drivers = sr_driver_list();
@@ -145,13 +159,14 @@ int main(int argc, char *argv[])
                        ret = a.exec();
                }
 
-               // Destroy libsigrokdecode and libsigrok
+#ifdef ENABLE_SIGROKDECODE
+               // Destroy libsigrokdecode
                srd_exit();
+#endif
 
-       } else {
-               qDebug() << "ERROR: libsigrokdecode init failed.";
-       }
+       } while (0);
 
+       // Destroy libsigrok
        if (sr_ctx)
                sr_exit(sr_ctx);
 
index c14a8fea7d0f487cb376882d18baa595b384fee3..4065de554b2e6bedf92f26855184dee0245b7dc1 100644 (file)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#ifdef ENABLE_SIGROKDECODE
 #include <sigrokdecode.h>
+#endif
 
 #include <QTextDocument>
 
@@ -41,7 +43,11 @@ About::About(QWidget *parent) :
        struct sr_dev_driver **drivers;
        struct sr_input_format **inputs;
        struct sr_output_format **outputs;
+
+#ifdef ENABLE_SIGROKDECODE
        struct srd_decoder *dec;
+#endif
+
        QString s;
 
        ui->setupUi(this);
@@ -87,6 +93,7 @@ About::About(QWidget *parent) :
                        .arg(QString(outputs[i]->description)));
        }
 
+#ifdef ENABLE_SIGROKDECODE
        s.append("<tr><td colspan=\"2\"><b>" +
                tr("Supported protocol decoders:") +
                "</b></td></tr>");
@@ -96,6 +103,7 @@ About::About(QWidget *parent) :
                         .arg(QString(dec->id))
                         .arg(QString(dec->longname)));
        }
+#endif
 
        s.append("</table>");
 
index 3aeb1227edcc1fb00247767002ee3087bb78494a..66bed74896ae4f8edf7e3327999dd6b0f6de97bb 100644 (file)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#ifdef ENABLE_SIGROKDECODE
 #include <sigrokdecode.h>
+#endif
 
 #include <boost/bind.hpp>