Commit 0c70bde3 authored by Jeff Niu's avatar Jeff Niu

Added cmake NO_DEBUG flag

parent 9f098d01
......@@ -16,7 +16,7 @@ before_install:
install:
- sudo apt-get install qt5-default qtmultimedia5-dev -y -qq
- sudo apt-get install libfontconfig1 mesa-common-dev libglu1-mesa-dev libudev-dev libxi6 libsm6 libxrender1 libegl1-mesa -y -qq
- sudo apt-get install libfontconfig1 mesa-common-dev libglu1-mesa-dev libudev-dev libxi6 libsm6 libxrender1 libegl1-mesa libxine2 -y -qq
script:
- mkdir build
......
......@@ -82,7 +82,14 @@ get_target_property(QtCore_location Qt5::Core LOCATION)
add_executable(minotaur-cpp ${SOURCE_FILES} ${HEADER_FILES} ${FORM_FILES} ${THIRD_PARTY} ${THIRD_PARTY_COMMON})
# Uncomment this line to compile in debug mode
target_compile_definitions(minotaur-cpp PRIVATE NDEBUG)
option(NO_DEBUG "Build minotaur without debugging output" OFF)
if (NO_DEBUG)
log("Building without debugging")
target_compile_definitions(minotaur-cpp PRIVATE QT_NO_DEBUG)
target_compile_definitions(minotaur-cpp PRIVATE NDEBUG)
else ()
log("Building with debugging on")
endif ()
# Attempt to find GOTURN files
include(Goturn)
......
#include "camera.h"
#include "../uwnrg.h"
#include <QCamera>
#include <QPainter>
......@@ -90,7 +89,9 @@ void Converter::process(cv::Mat frame) {
}
void Converter::imageKeyEvent(int key) {
WHEN_DEBUG(qDebug() << "Key pressed: " << key);
#ifndef NDEBUG
qDebug() << "Key pressed: " << key;
#endif
if (m_modifier) {
m_modifier->forwardKeyEvent(key);
}
......@@ -140,7 +141,9 @@ CameraDisplay::CameraDisplay(QWidget *parent, int camera_index)
m_image_viewer = new ImageViewer(this);
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
WHEN_DEBUG(qDebug() << "Found " << QCameraInfo::availableCameras().count() << "cameras" << endl);
#ifndef NDEBUG
qDebug() << "Found " << QCameraInfo::availableCameras().count() << "cameras" << endl;
#endif
m_camera_list = new QComboBox(this);
m_camera_list->setMinimumSize(150, 30);
for (int i = 0; i < cameras.size(); ++i) {
......
#ifndef MINOTAUR_CPP_UWNRG_H
#define MINOTAUR_CPP_UWNRG_H
#ifndef NDEBUG
#include <QDebug>
#define WHEN_DEBUG(S) S
#else
#define WHEN_DEBUG(S)
#endif
#endif //MINOTAUR_CPP_UWNRG_H
#include <opencv2/opencv.hpp>
#include "tracker.h"
#include "../uwnrg.h"
#ifndef NDEBUG
#include <QDebug>
#endif
// CMake will try to find goturn.caffemodel and goturn.prototxt, which need
// to be added separtaely. If these are found, the GOTURN tracker model
......@@ -33,7 +35,9 @@ TrackerModifier::TrackerModifier()
m_tracker = cv::TrackerMedianFlow::create();
break;
case Type::GOTURN:
WHEN_DEBUG(qDebug() << "Using GOTURN tracker");
#ifndef NDEBUG
qDebug() << "Using GOTURN tracker";
#endif
m_tracker = cv::TrackerGOTURN::create();
break;
default:
......@@ -44,12 +48,18 @@ TrackerModifier::TrackerModifier()
TrackerModifier::~TrackerModifier() = default;
void TrackerModifier::forwardKeyEvent(int key) {
WHEN_DEBUG(qDebug() << "Key event received");
#ifndef NDEBUG
qDebug() << "Key event received";
#endif
if (key == Qt::Key_A) {
WHEN_DEBUG(qDebug() << "Switching to First Scan");
#ifndef NDEBUG
qDebug() << "Switching to First Scan";
#endif
m_state = State::FIRST_SCAN;
} else if (key == Qt::Key_S) {
WHEN_DEBUG(qDebug() << "Resetting tracker");
#ifndef NDEBUG
qDebug() << "Resetting tracker";
#endif
m_state = State::UNINITIALIZED;
m_bounding_box = {};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment