Skip to content

Commit

Permalink
qt: enable building with MinGW
Browse files Browse the repository at this point in the history
Fix various compiler warnings along the way.
  • Loading branch information
jgressmann committed Jun 17, 2024
1 parent cbb0751 commit 84a9eb9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Boards
Submodule Boards updated 1013 files
12 changes: 6 additions & 6 deletions Windows/qtsupercanbus/supercan.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ TARGET = qtsupercanbus
QT = core serialbus

HEADERS += \
supercanbackend.h


supercanbackend.h \
supercan_srv.tlh.h

SOURCES += \
main.cpp \
supercanbackend.cpp \
../../src/can_bit_timing.c

INCLUDEPATH += ../inc ../../src


DEFINES += SC_STATIC
*-g++ {
LIBS += -lole32 -loleaut32 -static
}

DISTFILES = plugin.json


PLUGIN_TYPE = canbus
PLUGIN_EXTENDS = serialbus
PLUGIN_CLASS_NAME = SuperCanBusPlugin
Expand Down
20 changes: 8 additions & 12 deletions Windows/qtsupercanbus/supercanbackend.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020-2022 Jean Gressmann <[email protected]>
* Copyright (c) 2020-2024 Jean Gressmann <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -83,9 +83,6 @@ inline uint8_t len_to_dlc(uint8_t len)

bool SuperCanBackend::canCreate(QString *errorReason)
{
// *errorReason = tr("SuperCAN COM server not registered");
// return false;

ComScope cs;

if (cs) {
Expand Down Expand Up @@ -116,8 +113,7 @@ QList<QCanBusDeviceInfo> SuperCanBackend::interfaces()

hr = sc->DeviceScan(&count);
if (SUCCEEDED(hr)) {

for ( unsigned long i = 0; i < count; ++i) {
for (unsigned long i = 0; i < count; ++i) {

SuperCAN::ISuperCANDevicePtr dev;
SuperCAN::SuperCANDeviceData devData;
Expand Down Expand Up @@ -150,10 +146,10 @@ QList<QCanBusDeviceInfo> SuperCanBackend::interfaces()
result << devInfo;

} else {
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "Failed to get device data for device index %zu (hr=%lx).", i, hr);
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "Failed to get device data for device index %lu (hr=%lx).", i, hr);
}
} else {
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "Failed to open device index %zu (hr=%lx).", i, hr);
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "Failed to open device index %lu (hr=%lx).", i, hr);
}
}
} else {
Expand Down Expand Up @@ -509,13 +505,13 @@ void SuperCanBackend::expired()
}

if (log_data.level < SC_DLL_LOG_LEVEL_WARNING) {
qCCritical(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", log_data.data);
qCCritical(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", src, log_data.data);
} else if (log_data.level < SC_DLL_LOG_LEVEL_INFO) {
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", log_data.data);
qCWarning(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", src, log_data.data);
} else if (log_data.level < SC_DLL_LOG_LEVEL_DEBUG) {
qCInfo(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", log_data.data);
qCInfo(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", src, log_data.data);
} else {
qCDebug(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", log_data.data);
qCDebug(QT_CANBUS_PLUGINS_SUPERCAN, "%s: %s\n", src, log_data.data);
}
} break;
default:
Expand Down
16 changes: 7 additions & 9 deletions Windows/qtsupercanbus/supercanbackend.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020-2021 Jean Gressmann <[email protected]>
* Copyright (c) 2020-2024 Jean Gressmann <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,14 +34,12 @@
#include <QtCore/qlist.h>
#include <QtCore/qtimer.h>

#ifndef _MSC_VER
#error Please use a Microsoft compiler to build this project
#endif

#include <qt_windows.h>
#include <supercan_srv.h>
#include <supercan_winapi.h>
#import <supercan_srv.tlb> raw_interfaces_only
#include "supercan_srv.tlh.h"



QT_BEGIN_NAMESPACE
Expand Down Expand Up @@ -107,10 +105,10 @@ class SuperCanBackend : public QCanBusDevice
public:
enum SuperCanConfigKey {
DontConfigureKey = UserKey, // Don't attempt to configure the bus
NominalSamplePoint, // defaults to CiA recommendataion
DataSamplePoint, // defaults to CiA recommendataion
NominalSjw, // defaults to CiA recommendataion
DataSjw, // defaults to CiA recommendataion
NominalSamplePoint, // defaults to CiA recommendation
DataSamplePoint, // defaults to CiA recommendation
NominalSjw, // defaults to CiA recommendation
DataSjw, // defaults to CiA recommendation
};
Q_ENUM(SuperCanConfigKey)

Expand Down

0 comments on commit 84a9eb9

Please sign in to comment.