#-------------------------------------------------------------------------------
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)
#= 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).
add_definitions(${QT_DEFINITIONS})
add_definitions(-Wall -Wextra)
+if(ENABLE_SIGROKDECODE)
+ add_definitions(-DENABLE_SIGROKDECODE)
+endif()
+
if(NOT DISABLE_WERROR)
add_definitions(-Werror)
endif()
* 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>
{
const int loglevel = atoi(optarg);
sr_log_loglevel_set(loglevel);
+
+#ifdef ENABLE_SIGROKDECODE
srd_log_loglevel_set(loglevel);
+#endif
+
break;
}
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();
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);
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_SIGROKDECODE
#include <sigrokdecode.h>
+#endif
#include <QTextDocument>
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);
.arg(QString(outputs[i]->description)));
}
+#ifdef ENABLE_SIGROKDECODE
s.append("<tr><td colspan=\"2\"><b>" +
tr("Supported protocol decoders:") +
"</b></td></tr>");
.arg(QString(dec->id))
.arg(QString(dec->longname)));
}
+#endif
s.append("</table>");
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_SIGROKDECODE
#include <sigrokdecode.h>
+#endif
#include <boost/bind.hpp>