Skip to content

Commit

Permalink
Updated build script for Qt version 6
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Sep 19, 2024
1 parent e4477a7 commit 7f166be
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 160 deletions.
8 changes: 4 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"taskName": "build",
"type": "shell",
"command": "cd build; make -j4 -Wall",
"command": "cd build; make -j8 -Wall",
"args": [],
"group": "build",
"problemMatcher": "$gcc",
Expand Down Expand Up @@ -47,7 +47,7 @@
{
"taskName": "Clean & build all 5.15.2",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j4 -Wall",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j8 -Wall",
"args": [],
"group": {
"kind": "build",
Expand All @@ -72,7 +72,7 @@
{
"taskName": "Clean & build all 6.6.2",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.6.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j4",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.6.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j8",
"args": [],
"group": "build",
"problemMatcher": {
Expand All @@ -95,7 +95,7 @@
{
"taskName": "Clean & build all 6.7.2",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.7.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j4",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.7.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j8",
"args": [],
"group": "build",
"problemMatcher": {
Expand Down
217 changes: 111 additions & 106 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)

# qt
#find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED Core Network Quick Sql Qml SerialPort)
#find_package(Qt5 5.15 COMPONENTS Widgets LinguistTools REQUIRED Core Network Sql Charts Quick SerialBus SerialPort QmlImportScanner)
find_package(Qt5 5.15 COMPONENTS Widgets LinguistTools REQUIRED Core Network Sql Charts Quick SerialBus SerialPort)
#xxxfind_package(Qt5 5.15 COMPONENTS Widgets LinguistTools REQUIRED Core Network Sql Charts Quick SerialBus SerialPort)
find_package(Qt6 REQUIRED COMPONENTS Widgets Qml Core Network Sql Charts Quick SerialBus SerialPort)
qt_standard_project_setup()


# pthreads
set (THREADS_PREFER_PTHREAD_FLAG ON)
Expand Down Expand Up @@ -196,103 +197,103 @@ if(NOT SSL_VER_POS EQUAL -1)
endif()

# set(UI )
qt5_wrap_ui(UI src/mainwindow.ui
src/cdlgmainsettings.ui
src/cdlgconnsettingscanal.ui
src/cdlgconnsettingstcpip.ui
src/cdlgconnsettingssocketcan.ui
src/cdlgconnsettingsmqtt.ui
src/cdlgconnsettingsws1.ui
src/cdlgconnsettingsws2.ui
src/cdlgconnsettingsudp.ui
src/cdlgconnsettingsmulticast.ui
src/cdlgnewconnection.ui
src/cdlglevel1filter.ui
src/cdlglevel1filterwizard.ui
src/cdlglevel2filter.ui
src/cdlgsocketcanflags.ui
src/cdlgmqttpublish.ui
src/cdlgmqttsubscribe.ui
src/cdlgknownguid.ui
src/cdlgeditguid.ui
src/cdlgcanfilter.ui
src/cdlgtls.ui
src/cdlglog.ui
src/cdlgsensorindex.ui
src/cdlgeditsensorindex.ui
src/cdlgtxedit.ui
src/cdlgsessionfilter.ui
src/cdlgeditsessionfilter.ui
src/cdlgselectclass.ui
src/cdlgselectguid.ui
src/cdlgselectobid.ui
src/cdlgselectdata.ui
src/cdlgselectdatasize.ui
src/cdlgselectmeasurementvalue.ui
src/cdlgselectpriority.ui
src/cdlgselectmeasurementvalue.ui
src/cdlgselecttimestamp.ui
src/cdlgselectunit.ui
src/cdlgselectsensorindex.ui
src/cdlgselectdatacoding.ui
src/cdlgselectdate.ui
src/cdlgselectconstraint.ui
src/cfrmnodeconfig.ui
src/cfrmnodescan.ui
src/cdlgactionparam.ui
src/cdlgdatepicker.ui
src/cfrmmdf.ui
src/cdlgmdfmodule.ui
src/cdlgmdffilepicture.ui
src/cdlgmdfmodule.ui
src/cdlgmdfevent.ui
src/cdlgmdffilesetup.ui
src/cdlgmdfregister.ui
src/cdlgmdfbootloader.ui
src/cdlgmdffiledriver.ui
src/cdlgmdffile.ui
src/cdlgmdfremotevar.ui
src/cdlgmdfdescription.ui
src/cdlgmdfinfourl.ui
src/cdlgmdffilefirmware.ui
src/cdlgmdffilevideo.ui
src/cdlgmdffilemanual.ui
src/cdlgmdfvaluelist.ui
src/cdlgeditmap.ui
src/cdlgmdfmanufacturer.ui
src/cdlgmdfcontact.ui
src/cdlgmdfcontactlist.ui

src/cdlgmdfregister.ui
src/cdlgmdfregisterlist.ui

src/cdlgmdfbit.ui
src/cdlgmdfbitlist.ui
src/cdlgmdfvalue.ui
src/cdlgmdfvaluelist.ui

src/cdlgmdfregistermapping.ui

src/cdlgmdfremotevar.ui
src/cdlgmdfremotevarlist.ui

src/cdlgmdfdm.ui
src/cdlgmdfdmaction.ui
str/cdlgmdfdmactionparam.ui

src/cdlgmdfevents.ui
src/cdlgmdfeventdata.ui

src/cdlgtxtsearch.ui

src/cdlgselectmqtttopics.ui

src/cdlgbootfirmware.ui
#qt5_wrap_ui(UI src/mainwindow.ui
# src/cdlgmainsettings.ui
# src/cdlgconnsettingscanal.ui
# src/cdlgconnsettingstcpip.ui
# src/cdlgconnsettingssocketcan.ui
# src/cdlgconnsettingsmqtt.ui
# src/cdlgconnsettingsws1.ui
# src/cdlgconnsettingsws2.ui
# src/cdlgconnsettingsudp.ui
# src/cdlgconnsettingsmulticast.ui
# src/cdlgnewconnection.ui
# src/cdlglevel1filter.ui
# src/cdlglevel1filterwizard.ui
# src/cdlglevel2filter.ui
# src/cdlgsocketcanflags.ui
# src/cdlgmqttpublish.ui
# src/cdlgmqttsubscribe.ui
# src/cdlgknownguid.ui
# src/cdlgeditguid.ui
# src/cdlgcanfilter.ui
# src/cdlgtls.ui
# src/cdlglog.ui
# src/cdlgsensorindex.ui
# src/cdlgeditsensorindex.ui
# src/cdlgtxedit.ui
# src/cdlgsessionfilter.ui
# src/cdlgeditsessionfilter.ui
# src/cdlgselectclass.ui
# src/cdlgselectguid.ui
# src/cdlgselectobid.ui
# src/cdlgselectdata.ui
# src/cdlgselectdatasize.ui
# src/cdlgselectmeasurementvalue.ui
# src/cdlgselectpriority.ui
# src/cdlgselectmeasurementvalue.ui
# src/cdlgselecttimestamp.ui
# src/cdlgselectunit.ui
# src/cdlgselectsensorindex.ui
# src/cdlgselectdatacoding.ui
# src/cdlgselectdate.ui
# src/cdlgselectconstraint.ui
# src/cfrmnodeconfig.ui
# src/cfrmnodescan.ui
# src/cdlgactionparam.ui
# src/cdlgdatepicker.ui
# src/cfrmmdf.ui
# src/cdlgmdfmodule.ui
# src/cdlgmdffilepicture.ui
# src/cdlgmdfmodule.ui
# src/cdlgmdfevent.ui
# src/cdlgmdffilesetup.ui
# src/cdlgmdfregister.ui
# src/cdlgmdfbootloader.ui
# src/cdlgmdffiledriver.ui
# src/cdlgmdffile.ui
# src/cdlgmdfremotevar.ui
# src/cdlgmdfdescription.ui
# src/cdlgmdfinfourl.ui
# src/cdlgmdffilefirmware.ui
# src/cdlgmdffilevideo.ui
# src/cdlgmdffilemanual.ui
# src/cdlgmdfvaluelist.ui
# src/cdlgeditmap.ui
# src/cdlgmdfmanufacturer.ui
# src/cdlgmdfcontact.ui
# src/cdlgmdfcontactlist.ui

# src/cdlgmdfregister.ui
# src/cdlgmdfregisterlist.ui

# src/cdlgmdfbit.ui
# src/cdlgmdfbitlist.ui
# src/cdlgmdfvalue.ui
# src/cdlgmdfvaluelist.ui

# src/cdlgmdfregistermapping.ui

# src/cdlgmdfremotevar.ui
# src/cdlgmdfremotevarlist.ui

# src/cdlgmdfdm.ui
# src/cdlgmdfdmaction.ui
# str/cdlgmdfdmactionparam.ui

# src/cdlgmdfevents.ui
# src/cdlgmdfeventdata.ui

# src/cdlgtxtsearch.ui

# src/cdlgselectmqtttopics.ui

# src/cdlgbootfirmware.ui

src/cdlgselectbootalgorithm.ui
)
# src/cdlgselectbootalgorithm.ui
#)

add_executable(${PROJECT_NAME}
qt_add_executable(${PROJECT_NAME}
src/vscpworks.qrc
src/main.cpp
src/mainwindow.cpp
Expand Down Expand Up @@ -790,12 +791,16 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE
${Qt5Widgets_LIBRARIES}
${Qt5Core_LIBRARIES}
Qt5::Network
Qt5::Quick
Qt5::Sql
Qt5::Charts
Qt6::Widgets
Qt6::Qml
Qt6::Sql
Qt6::Charts
# ${Qt5Widgets_LIBRARIES}
# ${Qt5Core_LIBRARIES}
# Qt5::Network
# Qt5::Quick
# Qt5::Sql
# Qt5::Charts
m
dl
Threads::Threads
Expand All @@ -811,8 +816,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
endif()

# https://www3.sra.co.jp/qt/relation/doc/qtdoc/cmake-manual.html
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
qt5_add_resources(src/vscpworks.qrc qdarkstyle/theme/style.qrc)
#qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
#qt5_add_resources(src/vscpworks.qrc qdarkstyle/theme/style.qrc)


if(MSVC)
Expand Down
6 changes: 2 additions & 4 deletions src/bootloaderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,7 @@ CBootLoadWizard::initBootLoaderWizard(void)
QApplication::processEvents();

if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QString str = tr("Bootloader wizard: Unable to connect to the CANAL driver. rv=");
str += rv;
QString str = tr("Bootloader wizard: Unable to connect to the CANAL driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand Down Expand Up @@ -1481,8 +1480,7 @@ CBootLoadWizard::initBootLoaderWizard(void)
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::processEvents();
if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QString str = tr("Bootloader wizard: Unable to connect to the SOCKETCAN driver. rv=");
str += rv;
QString str = tr("Bootloader wizard: Unable to connect to the SOCKETCAN driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand Down
12 changes: 4 additions & 8 deletions src/cfrmnodeconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,7 @@ CFrmNodeConfig::doConnectToRemoteHost(void)
QApplication::processEvents();
if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QApplication::beep();
QString str = tr("Session: Unable to connect to the CANAL driver. rv=");
str += rv;
QString str = tr("Session: Unable to connect to the CANAL driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand All @@ -998,8 +997,7 @@ CFrmNodeConfig::doConnectToRemoteHost(void)
QApplication::processEvents();
if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QApplication::beep();
QString str = tr("Session: Unable to connect to the SOCKETCAN driver. rv=");
str += rv;
QString str = tr("Session: Unable to connect to the SOCKETCAN driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand Down Expand Up @@ -1082,8 +1080,7 @@ CFrmNodeConfig::doDisconnectFromRemoteHost(void)

if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->disconnect())) {
QApplication::beep();
QString str = tr("Session: Unable to disconnect from the CANAL driver. rv=");
str += rv;
QString str = tr("Session: Unable to disconnect from the CANAL driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand All @@ -1102,8 +1099,7 @@ CFrmNodeConfig::doDisconnectFromRemoteHost(void)

if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->disconnect())) {
QApplication::beep();
QString str = tr("Session: Unable to disconnect from the SOCKETCAN driver. rv=");
str += rv;
QString str = tr("Session: Unable to disconnect from the SOCKETCAN driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(
this,
Expand Down
12 changes: 4 additions & 8 deletions src/cfrmnodescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,7 @@ CFrmNodeScan::doConnectToRemoteHost(void)
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::processEvents();
if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QString str = tr("Node Scan: Unable to connect to the CANAL driver. rv=");
str += rv;
QString str = tr("Node Scan: Unable to connect to the CANAL driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand All @@ -437,8 +436,7 @@ CFrmNodeScan::doConnectToRemoteHost(void)
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::processEvents();
if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->connect())) {
QString str = tr("Node Scan: Unable to connect to the SOCKETCAN driver. rv=");
str += rv;
QString str = tr("Node Scan: Unable to connect to the SOCKETCAN driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand Down Expand Up @@ -514,8 +512,7 @@ CFrmNodeScan::doDisconnectFromRemoteHost(void)
QApplication::processEvents();

if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->disconnect())) {
QString str = tr("Node Scan: Unable to disconnect from the CANAL driver. rv=");
str += rv;
QString str = tr("Node Scan: Unable to disconnect from the CANAL driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand All @@ -535,8 +532,7 @@ CFrmNodeScan::doDisconnectFromRemoteHost(void)

if (VSCP_ERROR_SUCCESS != (rv = m_vscpClient->disconnect())) {
QString str = tr("Node Scan: Unable to disconnect from the "
"SOCKETCAN driver. rv=");
str += rv;
"SOCKETCAN driver. rv={}").arg(rv);
spdlog::error(str.toStdString());
QMessageBox::information(this,
tr(APPNAME),
Expand Down
Loading

0 comments on commit 7f166be

Please sign in to comment.