option(DISABLE_WERROR "Build without -Werror" FALSE)
option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
+option(ENABLE_DECODE "Build with libsigrokdecode" FALSE)
option(ENABLE_TESTS "Enable unit tests" FALSE)
option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE)
list(APPEND PKGDEPS
libsigrok>=0.2.0
- libsigrokdecode>=0.2.0
)
+if(ENABLE_DECODE)
+ list(APPEND PKGDEPS libsigrokdecode>=0.2.0)
+endif()
+
find_package(PkgConfig)
pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
pv/sigsession.cpp
pv/data/analog.cpp
pv/data/analogsnapshot.cpp
- pv/data/decoderstack.cpp
pv/data/logic.cpp
pv/data/logicsnapshot.cpp
pv/data/signaldata.cpp
pv/data/snapshot.cpp
- pv/data/decode/annotation.cpp
- pv/data/decode/decoder.cpp
pv/dialogs/about.cpp
pv/dialogs/connect.cpp
pv/popups/deviceoptions.cpp
pv/prop/property.cpp
pv/prop/string.cpp
pv/prop/binding/binding.cpp
- pv/prop/binding/decoderoptions.cpp
pv/prop/binding/deviceoptions.cpp
pv/toolbars/samplingbar.cpp
pv/view/analogsignal.cpp
pv/view/cursor.cpp
pv/view/cursorpair.cpp
- pv/view/decodetrace.cpp
pv/view/header.cpp
pv/view/marginwidget.cpp
pv/view/logicsignal.cpp
pv/view/viewport.cpp
pv/widgets/colourbutton.cpp
pv/widgets/colourpopup.cpp
- pv/widgets/decodergroupbox.cpp
- pv/widgets/decodermenu.cpp
pv/widgets/popup.cpp
pv/widgets/popuptoolbutton.cpp
pv/widgets/wellarray.cpp
set(pulseview_HEADERS
pv/mainwindow.h
pv/sigsession.h
- pv/data/decoderstack.h
pv/dialogs/about.h
pv/dialogs/connect.h
- pv/popups/deviceoptions.h
pv/popups/probes.h
+ pv/popups/deviceoptions.h
pv/prop/bool.h
pv/prop/double.h
pv/prop/enum.h
pv/prop/string.h
pv/toolbars/samplingbar.h
pv/view/cursor.h
- pv/view/decodetrace.h
pv/view/header.h
pv/view/logicsignal.h
pv/view/marginwidget.h
pv/view/viewport.h
pv/widgets/colourbutton.h
pv/widgets/colourpopup.h
- pv/widgets/decodergroupbox.h
- pv/widgets/decodermenu.h
pv/widgets/popup.h
pv/widgets/popuptoolbutton.h
pv/widgets/wellarray.h
list(APPEND pulseview_HEADERS signalhandler.h)
endif()
+if(ENABLE_DECODE)
+ list(APPEND pulseview_SOURCES
+ pv/data/decoderstack.cpp
+ pv/data/decode/annotation.cpp
+ pv/data/decode/decoder.cpp
+ pv/prop/binding/decoderoptions.cpp
+ pv/view/decodetrace.cpp
+ pv/widgets/decodergroupbox.cpp
+ pv/widgets/decodermenu.cpp
+ pv/widgets/wellarray.cpp
+ )
+
+ list(APPEND pulseview_HEADERS
+ pv/data/decoderstack.h
+ pv/view/decodetrace.h
+ pv/widgets/decodergroupbox.h
+ pv/widgets/decodermenu.h
+ )
+endif()
+
qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS})
qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
add_definitions(${QT_DEFINITIONS})
add_definitions(-Wall -Wextra)
+if(ENABLE_DECODE)
+ add_definitions(-DENABLE_DECODE)
+endif()
+
if(NOT DISABLE_WERROR)
add_definitions(-Werror)
endif()
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.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_DECODE
srd_log_loglevel_set(loglevel);
+#endif
break;
}
do {
+#ifdef ENABLE_DECODE
// Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) {
qDebug() << "ERROR: libsigrokdecode init failed.";
// Load the protocol decoders
srd_decoder_load_all();
+#endif
try {
// Create the device manager, initialise the drivers
qDebug() << e.what();
}
+#ifdef ENABLE_DECODE
// Destroy libsigrokdecode
srd_exit();
+#endif
} while (0);
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h>
+#endif
#include <QTextDocument>
struct sr_input_format **inputs;
struct sr_output_format **outputs;
+#ifdef ENABLE_DECODE
struct srd_decoder *dec;
+#endif
QString s;
.arg(QString::fromUtf8(outputs[i]->description)));
}
+#ifdef ENABLE_DECODE
s.append("<tr><td colspan=\"2\"><b>" +
tr("Supported protocol decoders:") +
"</b></td></tr>");
.arg(QString::fromUtf8(dec->id))
.arg(QString::fromUtf8(dec->longname)));
}
+#endif
s.append("</table>");
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h>
+#endif
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include "toolbars/samplingbar.h"
#include "view/logicsignal.h"
#include "view/view.h"
+#ifdef ENABLE_DECODE
#include "widgets/decodermenu.h"
+#endif
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#define __STDC_FORMAT_MACROS
menu_view->addAction(action_view_show_cursors);
// Decoders Menu
+#ifdef ENABLE_DECODE
QMenu *const menu_decoders = new QMenu;
menu_decoders->setTitle(QApplication::translate(
"MainWindow", "&Decoders", 0, QApplication::UnicodeUTF8));
this, SLOT(add_decoder(srd_decoder*)));
menu_decoders->addMenu(menu_decoders_add);
+#endif
// Help Menu
QMenu *const menu_help = new QMenu;
menu_bar->addAction(menu_file->menuAction());
menu_bar->addAction(menu_view->menuAction());
+#ifdef ENABLE_DECODE
menu_bar->addAction(menu_decoders->menuAction());
+#endif
menu_bar->addAction(menu_help->menuAction());
setMenuBar(menu_bar);
void MainWindow::add_decoder(srd_decoder *decoder)
{
+#ifdef ENABLE_DECODE
assert(decoder);
_session.add_decoder(decoder);
+#else
+ (void)decoder;
+#endif
}
void MainWindow::run_stop()
#include "sigsession.h"
+struct srd_decoder;
+
class QVBoxLayout;
namespace pv {
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h>
+#endif
#include "sigsession.h"
return _logic_data;
}
+#ifdef ENABLE_DECODE
bool SigSession::add_decoder(srd_decoder *const dec)
{
map<const srd_probe*, shared_ptr<view::LogicSignal> > probes;
return;
}
}
+#endif
void SigSession::set_capture_state(capture_state state)
{
boost::shared_ptr<data::Logic> get_data();
+#ifdef ENABLE_DECODE
bool add_decoder(srd_decoder *const dec);
std::vector< boost::shared_ptr<view::DecodeTrace> >
get_decode_signals() const;
void remove_decode_signal(view::DecodeTrace *signal);
+#endif
private:
void set_capture_state(capture_state state);
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h>
+#endif
#include <assert.h>
#include <limits.h>
{
const vector< shared_ptr<Signal> > sigs(
session().get_signals());
+#ifdef ENABLE_DECODE
const vector< shared_ptr<DecodeTrace> > decode_sigs(
session().get_decode_signals());
vector< shared_ptr<Trace> > traces(
sigs.size() + decode_sigs.size());
+#else
+ vector< shared_ptr<Trace> > traces(sigs.size());
+#endif
vector< shared_ptr<Trace> >::iterator i = traces.begin();
i = copy(sigs.begin(), sigs.end(), i);
+#ifdef ENABLE_DECODE
i = copy(decode_sigs.begin(), decode_sigs.end(), i);
+#endif
stable_sort(traces.begin(), traces.end(), compare_trace_v_offsets);
return traces;
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
-list(APPEND PKGDEPS
- libsigrok>=0.2.0
- libsigrokdecode>=0.2.0
-)
+option(ENABLE_DECODE "Build with libsigrokdecode" FALSE)
+
+list(APPEND PKGDEPS libsigrok>=0.2.0)
+
+if(ENABLE_DECODE)
+ list(APPEND PKGDEPS libsigrokdecode>=0.2.0)
+endif()
find_package(PkgConfig)
pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
${PROJECT_SOURCE_DIR}/pv/data/analogsnapshot.cpp
- ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp
${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp
${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
- ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
- ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
${PROJECT_SOURCE_DIR}/pv/prop/binding/binding.cpp
- ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
- ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
${PROJECT_SOURCE_DIR}/pv/view/header.cpp
${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
- ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
- ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/popup.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.cpp
data/analogsnapshot.cpp
- data/decoderstack.cpp
data/logicsnapshot.cpp
test.cpp
)
# This list includes only QObject derrived class headers
set(pulseview_TEST_HEADERS
${PROJECT_SOURCE_DIR}/pv/sigsession.h
- ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.h
${PROJECT_SOURCE_DIR}/pv/prop/int.h
${PROJECT_SOURCE_DIR}/pv/prop/property.h
${PROJECT_SOURCE_DIR}/pv/prop/string.h
${PROJECT_SOURCE_DIR}/pv/view/cursor.h
- ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
${PROJECT_SOURCE_DIR}/pv/view/header.h
${PROJECT_SOURCE_DIR}/pv/view/logicsignal.h
${PROJECT_SOURCE_DIR}/pv/view/marginwidget.h
${PROJECT_SOURCE_DIR}/pv/view/viewport.h
${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.h
${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.h
- ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.h
- ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.h
${PROJECT_SOURCE_DIR}/pv/widgets/popup.h
${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.h
)
+if(ENABLE_DECODE)
+ list(APPEND pulseview_TEST_SOURCES
+ ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
+ ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
+ ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
+ ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
+ ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
+ ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
+ ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
+ data/decoderstack.cpp
+ )
+
+ list(APPEND pulseview_TEST_HEADERS
+ ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.h
+ ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
+ ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.h
+ ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.h
+ )
+endif()
+
qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
+if(ENABLE_DECODE)
+ add_definitions(-DENABLE_DECODE)
+endif()
+
add_definitions(-DBOOST_TEST_DYN_LINK)
add_definitions(${QT_DEFINITIONS})