-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from Ross-Robotics/feature/cmake_support
CMake Support [breaking change Ctor API]
- Loading branch information
Showing
14 changed files
with
124 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Smoke Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
smoke-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install CMake | ||
uses: lukka/get-cmake@latest | ||
with: | ||
cmakeVersion: "~3.28.0" | ||
|
||
- name: Configure the build | ||
run: mkdir build && cmake -B build/ ./ | ||
|
||
- name: Build library | ||
run: cmake --build build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
########################################################################## | ||
cmake_minimum_required(VERSION 3.28) | ||
########################################################################## | ||
project("libmcp2515") | ||
########################################################################## | ||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 11) | ||
message(WARNING "GNU C compiler version ${CMAKE_C_COMPILER_VERSION} is too old and is unsupported. Version 11+ is required.") | ||
endif() | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) | ||
message(WARNING "GNU C++ compiler version ${CMAKE_CXX_COMPILER_VERSION} is too old and is unsupported. Version 11+ is required.") | ||
endif() | ||
########################################################################## | ||
set(CMAKE_VERBOSE_MAKEFILE OFF) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
########################################################################## | ||
add_library(${PROJECT_NAME} STATIC | ||
"src/ArduinoMCP2515.cpp" | ||
"src/MCP2515/MCP2515_Config.cpp" | ||
"src/MCP2515/MCP2515_Const.cpp" | ||
"src/MCP2515/MCP2515_Control.cpp" | ||
"src/MCP2515/MCP2515_Io.cpp" | ||
) | ||
########################################################################## | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) | ||
########################################################################## | ||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
"src" | ||
) | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) | ||
########################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* This software is distributed under the terms of the MIT License. | ||
* Copyright (c) 2020 LXRobotics. | ||
* Author: Alexander Entinger <[email protected]> | ||
* Contributors: https://github.com/107-systems/107-Arduino-MCP2515/graphs/contributors. | ||
*/ | ||
|
||
#ifndef ARDUINO_MCP2515_TYPES_H_ | ||
#define ARDUINO_MCP2515_TYPES_H_ | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <functional> | ||
#include <cstdint> | ||
|
||
#include "MCP2515/MCP2515_Const.h" | ||
|
||
/************************************************************************************** | ||
* TYPEDEF | ||
**************************************************************************************/ | ||
|
||
typedef std::function<unsigned long()> MicroSecondFunc; | ||
typedef std::function<unsigned long()> MilliSecondFunc; | ||
#if LIBCANARD | ||
typedef std::function<void(CanardFrame const & frame)> OnReceiveBufferFullFunc; | ||
#else | ||
typedef std::function<void(uint32_t const, uint32_t const, uint8_t const *, uint8_t const)> OnReceiveBufferFullFunc; | ||
#endif | ||
class ArduinoMCP2515; | ||
typedef std::function<void(ArduinoMCP2515 *)> OnTransmitBufferEmptyFunc; | ||
typedef std::function<void(MCP2515::EFLG const)> OnCanErrorFunc; | ||
typedef std::function<void(MCP2515::EFLG const)> OnCanWarningFunc; | ||
|
||
#endif /* ARDUINO_MCP2515_TYPES_H_ */ |