Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CMake and Hardware selector to allow building with MinGW #44

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ set(BUILD_TESTING OFF)
if(WIN32)
set(CAN_DRIVER "WindowsPCANBasic")
list(APPEND CAN_DRIVER "TouCAN")
list(APPEND CAN_DRIVER "WindowsInnoMakerUSB2CAN")

if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND MINGW))
list(APPEND CAN_DRIVER "WindowsInnoMakerUSB2CAN")
else()
message(STATUS "InnoMaker hardware will not be supported in this build because you are using mingw")
endif()
list(APPEND CAN_DRIVER "SYS_TEC")
elseif(APPLE)
set(CAN_DRIVER "MacCANPCAN")
Expand Down Expand Up @@ -91,7 +96,7 @@ target_link_libraries(
isobus::Utility
PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags)

if(MSVC)
if(WIN32)
add_custom_command(
TARGET AgISOVirtualTerminal POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/lib/PCANBasic.dll "$<TARGET_FILE_DIR:AgISOVirtualTerminal>"
Expand Down
9 changes: 7 additions & 2 deletions src/ConfigureHardwareComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ ConfigureHardwareComponent::ConfigureHardwareComponent(ConfigureHardwareWindow &
#ifdef JUCE_WINDOWS
hardwareInterfaceSelector.setName("Hardware Interface");
hardwareInterfaceSelector.setTextWhenNothingSelected("Select Hardware Interface");
hardwareInterfaceSelector.addItemList({ "PEAK PCAN USB", "Innomaker2CAN", "TouCAN", "SysTec" }, 1);

#ifdef ISOBUS_WINDOWSINNOMAKERUSB2CAN_AVAILABLE
hardwareInterfaceSelector.addItemList({ "PEAK PCAN USB", "Innomaker2CAN", "TouCAN", "SysTec" }, 1);
#else
hardwareInterfaceSelector.addItemList({ "PEAK PCAN USB", "Innomaker2CAN (not supported with mingw)", "TouCAN", "SysTec" }, 1);
#endif
int selectedID = 1;

for (std::uint8_t i = 0; i < parentCANDrivers.size(); i++)
{
if (parentCANDrivers.at(i) == isobus::CANHardwareInterface::get_assigned_can_channel_frame_handler(0))
if ((nullptr != parentCANDrivers.at(i)) &&
(parentCANDrivers.at(i) == isobus::CANHardwareInterface::get_assigned_can_channel_frame_handler(0)))
{
selectedID = i + 1;
break;
Expand Down
4 changes: 4 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ class AgISOVirtualTerminalApplication : public juce::JUCEApplication
{
#ifdef JUCE_WINDOWS
canDrivers.push_back(std::make_shared<isobus::PCANBasicWindowsPlugin>(static_cast<WORD>(PCAN_USBBUS1)));
#ifdef ISOBUS_WINDOWSINNOMAKERUSB2CAN_AVAILABLE
canDrivers.push_back(std::make_shared<isobus::InnoMakerUSB2CANWindowsPlugin>(0));
#else
canDrivers.push_back(nullptr);
#endif
canDrivers.push_back(std::make_shared<isobus::TouCANPlugin>(static_cast<std::int16_t>(0), 0));
canDrivers.push_back(std::make_shared<isobus::SysTecWindowsPlugin>());
#elif defined(JUCE_MAC)
Expand Down