Skip to content

Commit

Permalink
[HW]: Fix some issues when compiling with MinGW
Browse files Browse the repository at this point in the history
Fixed some compilation issues which happen on Windows when compiling
with MinGW. Specifically, the innomaker driver is not compatible with it
seemingly due to how it was compiled, and also std::this_thread was
not getting defined in the sys_tec plugin.
  • Loading branch information
ad3154 committed Nov 6, 2024
1 parent 65a90db commit 1d3ef78
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
37 changes: 22 additions & 15 deletions hardware_integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,31 @@ if("WindowsInnoMakerUSB2CAN" IN_LIST CAN_DRIVER)
set(CMAKE_SYSTEM_PROCESSOR ${MSVC_CXX_ARCHITECTURE_ID})
endif()

message(STATUS "Target Arch: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL
"x64")
message(STATUS "Detected AMD64, linking to INNOMAKER USB2CAN x64 Library")
target_link_libraries(
HardwareIntegration
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/lib/Windows/InnoMakerUsb2CanLib64.lib)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR
STREQUAL "X86")
message(STATUS "Detected x86, linking to INNOMAKER USB2CAN x86 Library")
target_link_libraries(
HardwareIntegration
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/lib/Windows/InnoMakerUsb2CanLib32.lib)
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND MINGW)
message(
FATAL_ERROR
"Windows InnoMaker USB2CAN Selected but no supported processor arch was detected. Only x64 and x86 are supported."
"The InnoMaker driver is compatible only with MSVC, and won't work with mingw"
)
else()
message(STATUS "Target Arch: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" OR CMAKE_SYSTEM_PROCESSOR
STREQUAL "x64")
message(STATUS "Detected AMD64, linking to INNOMAKER USB2CAN x64 Library")
target_link_libraries(
HardwareIntegration
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/lib/Windows/InnoMakerUsb2CanLib64.lib)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR
STREQUAL "X86")
message(STATUS "Detected x86, linking to INNOMAKER USB2CAN x86 Library")
target_link_libraries(
HardwareIntegration
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/lib/Windows/InnoMakerUsb2CanLib32.lib)
else()
message(
FATAL_ERROR
"Windows InnoMaker USB2CAN Selected but no supported processor arch was detected. Only x64 and x86 are supported."
)
endif()
endif()
endif()

Expand Down
2 changes: 2 additions & 0 deletions hardware_integration/src/sys_tec_windows_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "isobus/hardware_integration/sys_tec_windows_plugin.hpp"
#include "isobus/isobus/can_stack_logger.hpp"

#include <thread>

namespace isobus
{
SysTecWindowsPlugin::SysTecWindowsPlugin(std::uint8_t channel, std::uint32_t baudrate) :
Expand Down

0 comments on commit 1d3ef78

Please sign in to comment.