From 434dee0a39c66e7d98fd3edcf1928b65100a0af9 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Tue, 13 May 2025 11:14:48 -0400 Subject: [PATCH 01/33] init commit From 6ed7e4f9cd05ae484882352700ae2b930d53c1fd Mon Sep 17 00:00:00 2001 From: Yuchen Lin Date: Tue, 13 May 2025 20:42:22 -0400 Subject: [PATCH 02/33] [CMD] Define Movement Command --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 08fd58b..243091a 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,24 @@ In short term, this project is aimed to support ODrive family. In long term, thi Anyone using this library still need to integrate application/ simulation on top of this static library. + + +# Interface + +## Set Command + +```c++ +enum class MvCmd { + Vel, + Pos +}; + +typedef struct { + MvCmd type; + VecComp val[2]; +}; +``` + + + # Acknowledgements From ca5f1a48f6d0da5f6ba09c89a934ef7ef4ca1650 Mon Sep 17 00:00:00 2001 From: Yuchen Lin Date: Tue, 13 May 2025 21:02:56 -0400 Subject: [PATCH 03/33] [docs] define get command --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 243091a..25fd565 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Anyone using this library still need to integrate application/ simulation on top # Interface -## Set Command +## Movement Command ```c++ enum class MvCmd { @@ -40,10 +40,49 @@ enum class MvCmd { Pos }; -typedef struct { - MvCmd type; - VecComp val[2]; -}; +class MvCmd { + MvCmd mode; + uint16_t id; + float32 value[2]; //X, Y component for vel or pos +} +``` + +Note: Vel_FF, Torque_FF is preconfigured variable. + +## Get Command + +```cpp +class InsOut { + float fet_temp; + float bus_volt; + float bus_curr; + float pos_est; + float vel_est; + float torque_est; +} + +class Logging { + float fet_temp; + float bus_volt; + float bus_curr; + float pos_est; + float vel_est; + float torque_est; + float motor_temp; + float phase_current_setpoint; + float phase_current_measured; + float torque_tar; + float elec_power; + float mech_power; +} +``` + + + +## Set Command + +```c++ +//todo ``` From 67b39785b3d4d3aed837fe0ed3e0c10581a55140 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Wed, 14 May 2025 11:03:05 -0400 Subject: [PATCH 04/33] [cmd] Enum cmd ID Support --- inc/utils.hpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 inc/utils.hpp diff --git a/inc/utils.hpp b/inc/utils.hpp new file mode 100644 index 0000000..f7d4bbc --- /dev/null +++ b/inc/utils.hpp @@ -0,0 +1,51 @@ +#pragma once +#include + +/** + * TODO: + * - support unit testing + * - compile using cmake + * - support odrive config + * reference: https://github.com/odriverobotics/ODriveResources/blob/master/examples/can_restore_config.py + */ + +constexpr uint8_t broadcast_node_id = 0x3f; +constexpr bool auto_buad = false; //support send beacon message + +enum class cmd_map : uint8_t { + Get_Version = 0x000, + Heartbeat = 0x001, + Estop = 0x002, + Get_Error = 0x003, + RxSdo = 0x004, + TxSdo = 0x005, + Address = 0x006, + Set_Axis_State = 0x007, + Get_Encoder_Estimates = 0x009, + Set_Controller_Mode = 0x00b, + Set_Input_Pos = 0x00c, + Set_Input_Vel = 0x00d, + Set_Input_Torque = 0x00e, + Set_Limits = 0x00f, + Set_Traj_Vel_Limit = 0x011, + Set_Traj_Accel_Limits = 0x012, + Set_Traj_Inertia = 0x013, + Get_Iq = 0x014, + Get_Temperature = 0x015, + Reboot = 0x016, + Get_Bus_Voltage_Current = 0x017, + Clear_Errors = 0x018, + Set_Absolute_Position = 0x019, + Set_Pos_Gain = 0x01a, + Set_Vel_Gains = 0x01b, + Get_Torques = 0x01c, + Get_Powers = 0x01d, + Enter_DFU_Mode = 0x01f +}; + + +inline uint16_t arbitration_id(uint8_t node_id, cmd_map cmd) { + return (static_cast(node_id) << 5) | static_cast(cmd); +} + +// output is 8 byte and then parse it into a struct? \ No newline at end of file From 41a23dc432769e76572a1d0883789e19b432e2fd Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 11:10:30 -0400 Subject: [PATCH 05/33] [Encode] Support Can Header --- CMakeLists.txt | 54 ++++++++++++++++++++++++++++++-------------------- inc/utils.hpp | 25 +++++++++++++++++++---- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c0a6c3..5316dda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,32 @@ -cmake_minimum_required(VERSION 3.2) - -project(cmake-project-template) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3") - -set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}) - -set(DIVISIBLE_INSTALL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) -set(DIVISIBLE_INSTALL_BIN_DIR ${PROJECT_SOURCE_DIR}/bin) -set(DIVISIBLE_INSTALL_LIB_DIR ${PROJECT_SOURCE_DIR}/lib) - -set(DIVISION_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/division) - -include_directories(${DIVISIBLE_INSTALL_INCLUDE_DIR}) -include_directories(${DIVISION_HEADERS_DIR}) - -add_subdirectory(src) -add_subdirectory(test) - - +cmake_minimum_required(VERSION 3.14) +project(my_project) + +# GoogleTest requires at least C++17 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include(FetchContent) +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip +) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest) + +enable_testing() + +add_executable( + utils_test + test/test_utils.cpp +) + +target_include_directories(utils_test PRIVATE ${CMAKE_SOURCE_DIR}/inc) + +target_link_libraries( + utils_test + GTest::gtest_main +) + +include(GoogleTest) +gtest_discover_tests(utils_test) diff --git a/inc/utils.hpp b/inc/utils.hpp index f7d4bbc..615d393 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -5,13 +5,17 @@ * TODO: * - support unit testing * - compile using cmake + * - Support Error handling * - support odrive config * reference: https://github.com/odriverobotics/ODriveResources/blob/master/examples/can_restore_config.py */ -constexpr uint8_t broadcast_node_id = 0x3f; -constexpr bool auto_buad = false; //support send beacon message +constexpr uint8_t broadcastNodeId = 0x3f; +constexpr bool autoBuad = false; //support send beacon message +constexpr uint16_t errCode = static_cast(-1); + +/// @brief support if not defined command then use undefined enum class cmd_map : uint8_t { Get_Version = 0x000, Heartbeat = 0x001, @@ -40,11 +44,24 @@ enum class cmd_map : uint8_t { Set_Vel_Gains = 0x01b, Get_Torques = 0x01c, Get_Powers = 0x01d, - Enter_DFU_Mode = 0x01f + Enter_DFU_Mode = 0x01f, + UNDEFINE = 0x0FF, }; -inline uint16_t arbitration_id(uint8_t node_id, cmd_map cmd) { +inline uint16_t set_arbitration_id(uint8_t node_id, cmd_map cmd) { + // Boundary Check + if(node_id > broadcastNodeId) { + return errCode; + } + return (static_cast(node_id) << 5) | static_cast(cmd); +} + +inline uint16_t get_arbitration_id(uint8_t node_id, cmd_map cmd) { + // Boundary Check + if(node_id > broadcastNodeId) { + return errCode; + } return (static_cast(node_id) << 5) | static_cast(cmd); } From c6083c738c143486251163cd0ceed2bbfa296f8b Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 11:50:29 -0400 Subject: [PATCH 06/33] [Header] Support CanSimple Header ID Encode and Decode --- inc/utils.hpp | 115 +++++++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 49 deletions(-) diff --git a/inc/utils.hpp b/inc/utils.hpp index 615d393..c36f5dd 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -3,66 +3,83 @@ /** * TODO: - * - support unit testing - * - compile using cmake + * - compile to library using cmake * - Support Error handling * - support odrive config * reference: https://github.com/odriverobotics/ODriveResources/blob/master/examples/can_restore_config.py */ -constexpr uint8_t broadcastNodeId = 0x3f; -constexpr bool autoBuad = false; //support send beacon message +namespace CanHeader { + constexpr uint8_t broadcastNodeId = 0x3f; + constexpr bool autoBuad = false; //support send beacon message + constexpr uint16_t headerBound = 0x7ff; + constexpr uint8_t cmdBound = 0x1f; + constexpr uint8_t errorCode8 = static_cast(-1); + constexpr uint16_t errCode16 = static_cast(-1); -constexpr uint16_t errCode = static_cast(-1); + /// @todo: Support cmd decode and if not in enum assign UNDEFINE + enum class cmd_map : uint8_t { + Get_Version = 0x000, + Heartbeat = 0x001, + Estop = 0x002, + Get_Error = 0x003, + RxSdo = 0x004, + TxSdo = 0x005, + Address = 0x006, + Set_Axis_State = 0x007, + Get_Encoder_Estimates = 0x009, + Set_Controller_Mode = 0x00b, + Set_Input_Pos = 0x00c, + Set_Input_Vel = 0x00d, + Set_Input_Torque = 0x00e, + Set_Limits = 0x00f, + Set_Traj_Vel_Limit = 0x011, + Set_Traj_Accel_Limits = 0x012, + Set_Traj_Inertia = 0x013, + Get_Iq = 0x014, + Get_Temperature = 0x015, + Reboot = 0x016, + Get_Bus_Voltage_Current = 0x017, + Clear_Errors = 0x018, + Set_Absolute_Position = 0x019, + Set_Pos_Gain = 0x01a, + Set_Vel_Gains = 0x01b, + Get_Torques = 0x01c, + Get_Powers = 0x01d, + Enter_DFU_Mode = 0x01f, + UNDEFINED = 0x0FF, + }; -/// @brief support if not defined command then use undefined -enum class cmd_map : uint8_t { - Get_Version = 0x000, - Heartbeat = 0x001, - Estop = 0x002, - Get_Error = 0x003, - RxSdo = 0x004, - TxSdo = 0x005, - Address = 0x006, - Set_Axis_State = 0x007, - Get_Encoder_Estimates = 0x009, - Set_Controller_Mode = 0x00b, - Set_Input_Pos = 0x00c, - Set_Input_Vel = 0x00d, - Set_Input_Torque = 0x00e, - Set_Limits = 0x00f, - Set_Traj_Vel_Limit = 0x011, - Set_Traj_Accel_Limits = 0x012, - Set_Traj_Inertia = 0x013, - Get_Iq = 0x014, - Get_Temperature = 0x015, - Reboot = 0x016, - Get_Bus_Voltage_Current = 0x017, - Clear_Errors = 0x018, - Set_Absolute_Position = 0x019, - Set_Pos_Gain = 0x01a, - Set_Vel_Gains = 0x01b, - Get_Torques = 0x01c, - Get_Powers = 0x01d, - Enter_DFU_Mode = 0x01f, - UNDEFINE = 0x0FF, -}; + struct HeaderInfo{ + uint8_t id; + cmd_map cmd; + HeaderInfo(uint8_t id_val, cmd_map cmd_val) + : id(id_val), cmd(cmd_val) {} + }; -inline uint16_t set_arbitration_id(uint8_t node_id, cmd_map cmd) { - // Boundary Check - if(node_id > broadcastNodeId) { - return errCode; + + inline uint16_t encode(HeaderInfo header) { + // Boundary Check + if(header.id > broadcastNodeId) { + return errCode16; + } + return (static_cast(header.id) << 5) | static_cast(header.cmd); } - return (static_cast(node_id) << 5) | static_cast(cmd); -} -inline uint16_t get_arbitration_id(uint8_t node_id, cmd_map cmd) { - // Boundary Check - if(node_id > broadcastNodeId) { - return errCode; + inline HeaderInfo decode(uint16_t buf) { + // Boundary Check + if(buf > headerBound) { + return HeaderInfo(errorCode8, static_cast(errorCode8)); + } + return HeaderInfo(buf>>5 & broadcastNodeId, static_cast(buf & cmdBound)); + } + + inline bool operator==(const HeaderInfo& lhs, const HeaderInfo& rhs) { + return lhs.id == rhs.id && lhs.cmd == rhs.cmd; } - return (static_cast(node_id) << 5) | static_cast(cmd); } -// output is 8 byte and then parse it into a struct? \ No newline at end of file +namespace CanPayload { + +} \ No newline at end of file From a23287c31401ea145330d784d232769cdc5f39a1 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 11:57:24 -0400 Subject: [PATCH 07/33] f --- test/test_utils.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 test/test_utils.cpp diff --git a/test/test_utils.cpp b/test/test_utils.cpp new file mode 100644 index 0000000..98564dd --- /dev/null +++ b/test/test_utils.cpp @@ -0,0 +1,66 @@ +#include +#include "utils.hpp" + +using namespace CanHeader; + +class CanHeaderEncode : public ::testing::Test { + protected: + void SetUp() override { + // Runs before each TEST_F + } + + void TearDown() override { + // Runs after each TEST_F + } + + const uint8_t testNodeId = 0x15; + const uint16_t testNodeHeader = 0x2a0; + const uint16_t testBroadNodeHeader = 0x7e0; + const uint8_t testOutBoundNodeId = 0x4a; +}; + +TEST_F(CanHeaderEncode, NormalIdNoCmd) { + uint16_t header = encode(HeaderInfo(testNodeId, cmd_map::Get_Version)); + ASSERT_EQ(header, testNodeHeader) << "[Error] Incorrect Node ID Shifting\n"; +} + +TEST_F(CanHeaderEncode, BroadCastIdNoCmd) { + uint16_t header = encode(HeaderInfo(broadcastNodeId, cmd_map::Get_Version)); + ASSERT_EQ(header, testBroadNodeHeader) << "[Error] Incorrect Broad Cast Node ID Shifting\n"; +} + +TEST_F(CanHeaderEncode, OutBoundIdNoCmd) { + uint16_t header = encode(HeaderInfo(testOutBoundNodeId, cmd_map::Get_Version)); + ASSERT_EQ(header, errCode16) << "[Error] Out-of-bound Node ID should return error\n"; +} + +class CanHeaderDecode : public ::testing::Test { + protected: + void SetUp() override { + // Runs before each TEST_F + } + + void TearDown() override { + // Runs after each TEST_F + } + + const uint8_t testNodeId = 0x15; + const uint16_t testNodeHeader = 0x2a0; + const uint16_t testBroadNodeHeader = 0x7e0; + const uint16_t testOutBoundNodeHeader = 0x940; +}; + +TEST_F(CanHeaderDecode, NormalIdNoCmd) { + HeaderInfo header = decode(testNodeHeader); + ASSERT_EQ(header, HeaderInfo(testNodeId, cmd_map::Get_Version)) << "[Error] Incorrect decode"; +} + +TEST_F(CanHeaderDecode, BroadCastIdNoCmd) { + HeaderInfo header = decode(testBroadNodeHeader); + ASSERT_EQ(header, HeaderInfo(broadcastNodeId, cmd_map::Get_Version)) << "[Error] Incorrect decode"; +} + +TEST_F(CanHeaderDecode, OutBoundIdNoCmd) { + HeaderInfo header = decode(testOutBoundNodeHeader); + ASSERT_EQ(header, HeaderInfo(errorCode8, static_cast(errorCode8))) << "[Error] Incorrect decode"; +} \ No newline at end of file From a5d78a6e2f68c41fcb7e812bc6415174db1bbc15 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 11:59:26 -0400 Subject: [PATCH 08/33] f --- test/{test_utils.cpp => test_can_header.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{test_utils.cpp => test_can_header.cpp} (100%) diff --git a/test/test_utils.cpp b/test/test_can_header.cpp similarity index 100% rename from test/test_utils.cpp rename to test/test_can_header.cpp From 302b9c939ecf9090189c4fc2dfcd89b40530ccf2 Mon Sep 17 00:00:00 2001 From: Yuchen Lin Date: Thu, 15 May 2025 12:28:24 -0400 Subject: [PATCH 09/33] f --- CMake.gitignore | 1 + CMakeLists.txt | 2 +- README.md | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMake.gitignore b/CMake.gitignore index 11c7643..c00409d 100644 --- a/CMake.gitignore +++ b/CMake.gitignore @@ -10,3 +10,4 @@ compile_commands.json CTestTestfile.cmake _deps CMakeUserPresets.json +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 5316dda..6fd9fb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ enable_testing() add_executable( utils_test - test/test_utils.cpp + test/test_can_header.cpp ) target_include_directories(utils_test PRIVATE ${CMAKE_SOURCE_DIR}/inc) diff --git a/README.md b/README.md index 25fd565..158ce27 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,17 @@ class Logging { //todo ``` +# Testing and Validation +```bash +# Create build folder based on CMakeLists.txt +cmake -S . -b build + +# Compile the project +cmake --build build + +# Execute test +cd build && ctest && cd .. +``` # Acknowledgements From dbc2c2f10383ba631e697de85215dc570dca5374 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 15:03:17 -0400 Subject: [PATCH 10/33] [Cmd] Complete Test Fixture" --- inc/utils.hpp | 56 +++++++++++++++++++++++++++++++++++----- test/test_can_header.cpp | 41 ++++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 13 deletions(-) diff --git a/inc/utils.hpp b/inc/utils.hpp index c36f5dd..6e14e0a 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -1,5 +1,7 @@ #pragma once #include +#include +#include /** * TODO: @@ -9,6 +11,12 @@ * reference: https://github.com/odriverobotics/ODriveResources/blob/master/examples/can_restore_config.py */ +template +bool IsDefined(uint8_t value, const std::array& allowed) { + Enum candidate = static_cast(value); + return std::find(allowed.begin(), allowed.end(), candidate) != allowed.end(); +} + namespace CanHeader { constexpr uint8_t broadcastNodeId = 0x3f; constexpr bool autoBuad = false; //support send beacon message @@ -18,7 +26,7 @@ namespace CanHeader { constexpr uint16_t errCode16 = static_cast(-1); /// @todo: Support cmd decode and if not in enum assign UNDEFINE - enum class cmd_map : uint8_t { + enum class CmdMap : uint8_t { Get_Version = 0x000, Heartbeat = 0x001, Estop = 0x002, @@ -46,15 +54,45 @@ namespace CanHeader { Set_Vel_Gains = 0x01b, Get_Torques = 0x01c, Get_Powers = 0x01d, - Enter_DFU_Mode = 0x01f, - UNDEFINED = 0x0FF, + Enter_DFU_Mode = 0x01f + }; + + constexpr std::array valid_cmds = { + CmdMap::Get_Version, + CmdMap::Heartbeat, + CmdMap::Estop, + CmdMap::Get_Error, + CmdMap::RxSdo, + CmdMap::TxSdo, + CmdMap::Address, + CmdMap::Set_Axis_State, + CmdMap::Get_Encoder_Estimates, + CmdMap::Set_Controller_Mode, + CmdMap::Set_Input_Pos, + CmdMap::Set_Input_Vel, + CmdMap::Set_Input_Torque, + CmdMap::Set_Limits, + CmdMap::Set_Traj_Vel_Limit, + CmdMap::Set_Traj_Accel_Limits, + CmdMap::Set_Traj_Inertia, + CmdMap::Get_Iq, + CmdMap::Get_Temperature, + CmdMap::Reboot, + CmdMap::Get_Bus_Voltage_Current, + CmdMap::Clear_Errors, + CmdMap::Set_Absolute_Position, + CmdMap::Set_Pos_Gain, + CmdMap::Set_Vel_Gains, + CmdMap::Get_Torques, + CmdMap::Get_Powers, + CmdMap::Enter_DFU_Mode }; struct HeaderInfo{ uint8_t id; - cmd_map cmd; + CmdMap cmd; - HeaderInfo(uint8_t id_val, cmd_map cmd_val) + HeaderInfo(uint8_t id_val, CmdMap cmd_val) : id(id_val), cmd(cmd_val) {} }; @@ -70,14 +108,18 @@ namespace CanHeader { inline HeaderInfo decode(uint16_t buf) { // Boundary Check if(buf > headerBound) { - return HeaderInfo(errorCode8, static_cast(errorCode8)); + return HeaderInfo(errorCode8, static_cast(errorCode8)); } - return HeaderInfo(buf>>5 & broadcastNodeId, static_cast(buf & cmdBound)); + return HeaderInfo(buf>>5 & broadcastNodeId, static_cast(buf & cmdBound)); } inline bool operator==(const HeaderInfo& lhs, const HeaderInfo& rhs) { return lhs.id == rhs.id && lhs.cmd == rhs.cmd; } + + inline bool is_defined(uint8_t cmd) { + return IsDefined(cmd, valid_cmds); + } } namespace CanPayload { diff --git a/test/test_can_header.cpp b/test/test_can_header.cpp index 98564dd..0d2da1f 100644 --- a/test/test_can_header.cpp +++ b/test/test_can_header.cpp @@ -20,17 +20,17 @@ class CanHeaderEncode : public ::testing::Test { }; TEST_F(CanHeaderEncode, NormalIdNoCmd) { - uint16_t header = encode(HeaderInfo(testNodeId, cmd_map::Get_Version)); + uint16_t header = encode(HeaderInfo(testNodeId, CmdMap::Get_Version)); ASSERT_EQ(header, testNodeHeader) << "[Error] Incorrect Node ID Shifting\n"; } TEST_F(CanHeaderEncode, BroadCastIdNoCmd) { - uint16_t header = encode(HeaderInfo(broadcastNodeId, cmd_map::Get_Version)); + uint16_t header = encode(HeaderInfo(broadcastNodeId, CmdMap::Get_Version)); ASSERT_EQ(header, testBroadNodeHeader) << "[Error] Incorrect Broad Cast Node ID Shifting\n"; } TEST_F(CanHeaderEncode, OutBoundIdNoCmd) { - uint16_t header = encode(HeaderInfo(testOutBoundNodeId, cmd_map::Get_Version)); + uint16_t header = encode(HeaderInfo(testOutBoundNodeId, CmdMap::Get_Version)); ASSERT_EQ(header, errCode16) << "[Error] Out-of-bound Node ID should return error\n"; } @@ -52,15 +52,44 @@ class CanHeaderDecode : public ::testing::Test { TEST_F(CanHeaderDecode, NormalIdNoCmd) { HeaderInfo header = decode(testNodeHeader); - ASSERT_EQ(header, HeaderInfo(testNodeId, cmd_map::Get_Version)) << "[Error] Incorrect decode"; + ASSERT_EQ(header, HeaderInfo(testNodeId, CmdMap::Get_Version)) << "[Error] Incorrect decode"; } TEST_F(CanHeaderDecode, BroadCastIdNoCmd) { HeaderInfo header = decode(testBroadNodeHeader); - ASSERT_EQ(header, HeaderInfo(broadcastNodeId, cmd_map::Get_Version)) << "[Error] Incorrect decode"; + ASSERT_EQ(header, HeaderInfo(broadcastNodeId, CmdMap::Get_Version)) << "[Error] Incorrect decode"; } TEST_F(CanHeaderDecode, OutBoundIdNoCmd) { HeaderInfo header = decode(testOutBoundNodeHeader); - ASSERT_EQ(header, HeaderInfo(errorCode8, static_cast(errorCode8))) << "[Error] Incorrect decode"; + ASSERT_EQ(header, HeaderInfo(errorCode8, static_cast(errorCode8))) << "[Error] Incorrect decode"; +} + +class CanCmdDecode : public ::testing::Test { + protected: + void SetUp() override { + // Runs before each TEST_F + } + + void TearDown() override { + // Runs after each TEST_F + } + + const uint8_t test_cmd = static_cast(CmdMap::Clear_Errors); + const uint8_t test_outbound_cmd = 0x20; + const uint8_t test_inbound_invalid_cmd = 0x08; +}; + +TEST_F(CanCmdDecode, ValidCmd) { + bool valid_cmd = is_defined(test_cmd); + ASSERT_EQ(valid_cmd, true) << "[Error] Incorrect Cmd Identification"; +} + +TEST_F(CanCmdDecode, InvalidCmd) { + bool valid_cmd = is_defined(test_outbound_cmd); + ASSERT_EQ(valid_cmd, false) << "[Error] Incorrect Cmd Identification"; +} +TEST_F(CanCmdDecode, InvalidInboundCmd) { + bool valid_cmd = is_defined(test_inbound_invalid_cmd); + ASSERT_EQ(valid_cmd, false) << "[Error] Incorrect Cmd Identification"; } \ No newline at end of file From a438729346348cea39fa4371514d6700a9fc706a Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 16:21:45 -0400 Subject: [PATCH 11/33] f --- inc/can_simple.hpp | 259 +++++++++++++++++++++++++++++++++++++++++++++ inc/utils.hpp | 75 +------------ 2 files changed, 261 insertions(+), 73 deletions(-) create mode 100644 inc/can_simple.hpp diff --git a/inc/can_simple.hpp b/inc/can_simple.hpp new file mode 100644 index 0000000..62ede00 --- /dev/null +++ b/inc/can_simple.hpp @@ -0,0 +1,259 @@ +#pragma once +#include + +namespace CanHeader { + constexpr uint8_t broadcastNodeId = 0x3f; + constexpr bool autoBuad = false; //support send beacon message + constexpr uint16_t headerBound = 0x7ff; + constexpr uint8_t cmdBound = 0x1f; + constexpr uint8_t errorCode8 = static_cast(-1); + constexpr uint16_t errCode16 = static_cast(-1); + + /// @todo: Support cmd decode and if not in enum assign UNDEFINE + enum class CmdMap : uint8_t { + Get_Version = 0x000, + Heartbeat = 0x001, + Estop = 0x002, + Get_Error = 0x003, + RxSdo = 0x004, + TxSdo = 0x005, + Address = 0x006, + Set_Axis_State = 0x007, + Get_Encoder_Estimates = 0x009, + Set_Controller_Mode = 0x00b, + Set_Input_Pos = 0x00c, + Set_Input_Vel = 0x00d, + Set_Input_Torque = 0x00e, + Set_Limits = 0x00f, + Set_Traj_Vel_Limit = 0x011, + Set_Traj_Accel_Limits = 0x012, + Set_Traj_Inertia = 0x013, + Get_Iq = 0x014, + Get_Temperature = 0x015, + Reboot = 0x016, + Get_Bus_Voltage_Current = 0x017, + Clear_Errors = 0x018, + Set_Absolute_Position = 0x019, + Set_Pos_Gain = 0x01a, + Set_Vel_Gains = 0x01b, + Get_Torques = 0x01c, + Get_Powers = 0x01d, + Enter_DFU_Mode = 0x01f + }; + + constexpr std::array valid_cmds = { + CmdMap::Get_Version, + CmdMap::Heartbeat, + CmdMap::Estop, + CmdMap::Get_Error, + CmdMap::RxSdo, + CmdMap::TxSdo, + CmdMap::Address, + CmdMap::Set_Axis_State, + CmdMap::Get_Encoder_Estimates, + CmdMap::Set_Controller_Mode, + CmdMap::Set_Input_Pos, + CmdMap::Set_Input_Vel, + CmdMap::Set_Input_Torque, + CmdMap::Set_Limits, + CmdMap::Set_Traj_Vel_Limit, + CmdMap::Set_Traj_Accel_Limits, + CmdMap::Set_Traj_Inertia, + CmdMap::Get_Iq, + CmdMap::Get_Temperature, + CmdMap::Reboot, + CmdMap::Get_Bus_Voltage_Current, + CmdMap::Clear_Errors, + CmdMap::Set_Absolute_Position, + CmdMap::Set_Pos_Gain, + CmdMap::Set_Vel_Gains, + CmdMap::Get_Torques, + CmdMap::Get_Powers, + CmdMap::Enter_DFU_Mode + }; +} + + + +namespace CanPayload { + #pragma pack(push, 1) + struct GetVersionPayload { + uint8_t protocol_version; + uint8_t hw_version_major; + uint8_t hw_version_minor; + uint8_t hw_version_variant; + uint8_t fw_version_major; + uint8_t fw_version_minor; + uint8_t fw_version_revision; + uint8_t fw_version_unreleased; + }; + + struct HeartbeatPayload { + uint32_t axis_error; + uint8_t axis_state; + uint8_t procedure_result; + uint8_t trajectory_done; + uint8_t reserved; + }; + + struct GetErrorPayload { + uint32_t active_errors; + uint32_t disarm_reason; + }; + + struct RxSdoPayload { + uint8_t opcode; + uint16_t endpoint_id; + uint8_t reserved; + uint32_t value; + }; + + struct TxSdoPayload { + uint8_t reserved0; + uint16_t endpoint_id; + uint8_t reserved1; + uint32_t value; + }; + + struct AddressPayload { + uint8_t node_id; + uint32_t serial_number_start; + uint16_t serial_number_end; + uint8_t connection_id; + }; + + struct EncoderEstimatesPayload { + float pos_estimate; + float vel_estimate; + }; + + struct GetIqPayload { + float iq_setpoint; + float iq_measured; + }; + + struct GetTemperaturePayload { + float fet_temperature; + float motor_temperature; + }; + + struct BusVoltageCurrentPayload { + float bus_voltage; + float bus_current; + }; + + struct GetTorquesPayload { + float torque_target; + float torque_estimate; + }; + + struct GetPowersPayload { + float electrical_power; + float mechanical_power; + }; + + struct SetAxisStatePayload { + uint32_t axis_requested_state; + uint32_t reserved; + }; + + struct SetControllerModePayload { + uint8_t control_mode; + uint8_t input_mode; + uint16_t reserved0; + uint32_t reserved1; + }; + + struct SetInputPosPayload { + float input_pos; + int16_t vel_ff; + int16_t torque_ff; + }; + + struct SetInputVelPayload { + float input_vel; + float input_torque_ff; + }; + + struct SetInputTorquePayload { + float input_torque; + uint32_t reserved; + }; + + struct SetLimitsPayload { + float velocity_limit; + float current_limit; + }; + + struct SetTrajVelLimitPayload { + float traj_vel_limit; + uint32_t reserved; + }; + + struct SetTrajAccelLimitsPayload { + float traj_accel_limit; + float traj_decel_limit; + }; + + struct SetTrajInertiaPayload { + float traj_inertia; + uint32_t reserved; + }; + + struct RebootPayload { + uint8_t action; + uint8_t reserved1; + uint16_t reserved2; + uint32_t reserved3; + }; + + struct ClearErrorsPayload { + uint32_t identify; + uint32_t reserved; + }; + + struct SetAbsolutePositionPayload { + float position; + uint32_t reserved; + }; + + struct SetPosGainPayload { + float pos_gain; + uint32_t reserved; + }; + + struct SetVelGainsPayload { + float vel_gain; + float vel_integrator_gain; + }; + #pragma pack(pop) + + // Compile-time check that all CAN payloads are == 8 bytes + static_assert(sizeof(GetVersionPayload) == 8, "GetVersionPayload too large"); + static_assert(sizeof(HeartbeatPayload) == 8, "HeartbeatPayload too large"); + static_assert(sizeof(GetErrorPayload) == 8, "GetErrorPayload too large"); + static_assert(sizeof(RxSdoPayload) == 8, "RxSdoPayload too large"); + static_assert(sizeof(TxSdoPayload) == 8, "TxSdoPayload too large"); + static_assert(sizeof(AddressPayload) == 8, "AddressPayload too large"); + static_assert(sizeof(EncoderEstimatesPayload) == 8, "EncoderEstimatesPayload too large"); + static_assert(sizeof(GetIqPayload) == 8, "GetIqPayload too large"); + static_assert(sizeof(GetTemperaturePayload) == 8, "GetTemperaturePayload too large"); + static_assert(sizeof(BusVoltageCurrentPayload) == 8, "BusVoltageCurrentPayload too large"); + static_assert(sizeof(GetTorquesPayload) == 8, "GetTorquesPayload too large"); + static_assert(sizeof(GetPowersPayload) == 8, "GetPowersPayload too large"); + + static_assert(sizeof(SetAxisStatePayload) == 8, "SetAxisStatePayload too large"); + static_assert(sizeof(SetControllerModePayload) == 8, "SetControllerModePayload too large"); + static_assert(sizeof(SetInputPosPayload) == 8, "SetInputPosPayload too large"); + static_assert(sizeof(SetInputVelPayload) == 8, "SetInputVelPayload too large"); + static_assert(sizeof(SetInputTorquePayload) == 8, "SetInputTorquePayload too large"); + static_assert(sizeof(SetLimitsPayload) == 8, "SetLimitsPayload too large"); + static_assert(sizeof(SetTrajVelLimitPayload) == 8, "SetTrajVelLimitPayload too large"); + static_assert(sizeof(SetTrajAccelLimitsPayload) == 8, "SetTrajAccelLimitsPayload too large"); + static_assert(sizeof(SetTrajInertiaPayload) == 8, "SetTrajInertiaPayload too large"); + static_assert(sizeof(RebootPayload) == 8, "RebootPayload too large"); + static_assert(sizeof(ClearErrorsPayload) == 8, "ClearErrorsPayload too large"); + static_assert(sizeof(SetAbsolutePositionPayload) == 8, "SetAbsolutePositionPayload too large"); + static_assert(sizeof(SetPosGainPayload) == 8, "SetPosGainPayload too large"); + static_assert(sizeof(SetVelGainsPayload) == 8, "SetVelGainsPayload too large"); +} \ No newline at end of file diff --git a/inc/utils.hpp b/inc/utils.hpp index 6e14e0a..7d70a9a 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -3,6 +3,8 @@ #include #include +#include "can_simple.hpp" + /** * TODO: * - compile to library using cmake @@ -18,76 +20,6 @@ bool IsDefined(uint8_t value, const std::array& allowed) { } namespace CanHeader { - constexpr uint8_t broadcastNodeId = 0x3f; - constexpr bool autoBuad = false; //support send beacon message - constexpr uint16_t headerBound = 0x7ff; - constexpr uint8_t cmdBound = 0x1f; - constexpr uint8_t errorCode8 = static_cast(-1); - constexpr uint16_t errCode16 = static_cast(-1); - - /// @todo: Support cmd decode and if not in enum assign UNDEFINE - enum class CmdMap : uint8_t { - Get_Version = 0x000, - Heartbeat = 0x001, - Estop = 0x002, - Get_Error = 0x003, - RxSdo = 0x004, - TxSdo = 0x005, - Address = 0x006, - Set_Axis_State = 0x007, - Get_Encoder_Estimates = 0x009, - Set_Controller_Mode = 0x00b, - Set_Input_Pos = 0x00c, - Set_Input_Vel = 0x00d, - Set_Input_Torque = 0x00e, - Set_Limits = 0x00f, - Set_Traj_Vel_Limit = 0x011, - Set_Traj_Accel_Limits = 0x012, - Set_Traj_Inertia = 0x013, - Get_Iq = 0x014, - Get_Temperature = 0x015, - Reboot = 0x016, - Get_Bus_Voltage_Current = 0x017, - Clear_Errors = 0x018, - Set_Absolute_Position = 0x019, - Set_Pos_Gain = 0x01a, - Set_Vel_Gains = 0x01b, - Get_Torques = 0x01c, - Get_Powers = 0x01d, - Enter_DFU_Mode = 0x01f - }; - - constexpr std::array valid_cmds = { - CmdMap::Get_Version, - CmdMap::Heartbeat, - CmdMap::Estop, - CmdMap::Get_Error, - CmdMap::RxSdo, - CmdMap::TxSdo, - CmdMap::Address, - CmdMap::Set_Axis_State, - CmdMap::Get_Encoder_Estimates, - CmdMap::Set_Controller_Mode, - CmdMap::Set_Input_Pos, - CmdMap::Set_Input_Vel, - CmdMap::Set_Input_Torque, - CmdMap::Set_Limits, - CmdMap::Set_Traj_Vel_Limit, - CmdMap::Set_Traj_Accel_Limits, - CmdMap::Set_Traj_Inertia, - CmdMap::Get_Iq, - CmdMap::Get_Temperature, - CmdMap::Reboot, - CmdMap::Get_Bus_Voltage_Current, - CmdMap::Clear_Errors, - CmdMap::Set_Absolute_Position, - CmdMap::Set_Pos_Gain, - CmdMap::Set_Vel_Gains, - CmdMap::Get_Torques, - CmdMap::Get_Powers, - CmdMap::Enter_DFU_Mode - }; - struct HeaderInfo{ uint8_t id; CmdMap cmd; @@ -122,6 +54,3 @@ namespace CanHeader { } } -namespace CanPayload { - -} \ No newline at end of file From 3421d766896f4f2e1af2e62af37fbbb07ead96ba Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 16:22:34 -0400 Subject: [PATCH 12/33] f --- inc/can_simple.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/can_simple.hpp b/inc/can_simple.hpp index 62ede00..8d3df43 100644 --- a/inc/can_simple.hpp +++ b/inc/can_simple.hpp @@ -228,6 +228,8 @@ namespace CanPayload { }; #pragma pack(pop) + + // Compile-time check that all CAN payloads are == 8 bytes static_assert(sizeof(GetVersionPayload) == 8, "GetVersionPayload too large"); static_assert(sizeof(HeartbeatPayload) == 8, "HeartbeatPayload too large"); @@ -241,7 +243,6 @@ namespace CanPayload { static_assert(sizeof(BusVoltageCurrentPayload) == 8, "BusVoltageCurrentPayload too large"); static_assert(sizeof(GetTorquesPayload) == 8, "GetTorquesPayload too large"); static_assert(sizeof(GetPowersPayload) == 8, "GetPowersPayload too large"); - static_assert(sizeof(SetAxisStatePayload) == 8, "SetAxisStatePayload too large"); static_assert(sizeof(SetControllerModePayload) == 8, "SetControllerModePayload too large"); static_assert(sizeof(SetInputPosPayload) == 8, "SetInputPosPayload too large"); From f979234df4c1a2c269b924d0a42f12339e654470 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Thu, 15 May 2025 16:27:15 -0400 Subject: [PATCH 13/33] f --- inc/utils.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inc/utils.hpp b/inc/utils.hpp index 7d70a9a..324a2f7 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -54,3 +54,8 @@ namespace CanHeader { } } +namespace CanPayload { + inline uint64_t align_int48_t(uint32_t upper, uint16_t lower) { + return static_cast (upper << 16) & lower; + } +} \ No newline at end of file From 53ddd4eaedf912033832177090c6e8259ebc241e Mon Sep 17 00:00:00 2001 From: billylin609 Date: Fri, 16 May 2025 14:02:53 -0400 Subject: [PATCH 14/33] f --- CMakeLists.txt | 1 + inc/can_simple.hpp | 267 ++++++++++++++++++++++++++++-------------- inc/utils.hpp | 227 ++++++++++++++++++++++++++++++++++- test/test_can_msg.cpp | 187 +++++++++++++++++++++++++++++ 4 files changed, 592 insertions(+), 90 deletions(-) create mode 100644 test/test_can_msg.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd9fb5..666236c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ enable_testing() add_executable( utils_test test/test_can_header.cpp + test/test_can_msg.cpp ) target_include_directories(utils_test PRIVATE ${CMAKE_SOURCE_DIR}/inc) diff --git a/inc/can_simple.hpp b/inc/can_simple.hpp index 8d3df43..224babf 100644 --- a/inc/can_simple.hpp +++ b/inc/can_simple.hpp @@ -86,145 +86,234 @@ namespace CanPayload { uint8_t fw_version_minor; uint8_t fw_version_revision; uint8_t fw_version_unreleased; + + GetVersionPayload() = default; + GetVersionPayload(uint8_t proto, uint8_t hw_maj, uint8_t hw_min, uint8_t hw_var, + uint8_t fw_maj, uint8_t fw_min, uint8_t fw_rev, uint8_t fw_unrel) + : protocol_version(proto), hw_version_major(hw_maj), hw_version_minor(hw_min), + hw_version_variant(hw_var), fw_version_major(fw_maj), fw_version_minor(fw_min), + fw_version_revision(fw_rev), fw_version_unreleased(fw_unrel) {} }; - + struct HeartbeatPayload { - uint32_t axis_error; - uint8_t axis_state; - uint8_t procedure_result; - uint8_t trajectory_done; - uint8_t reserved; + uint32_t axis_error{}; + uint8_t axis_state{}; + uint8_t procedure_result{}; + uint8_t trajectory_done{}; + uint8_t reserved{}; + + HeartbeatPayload() = default; + HeartbeatPayload(uint32_t err, uint8_t state, uint8_t result, uint8_t done, uint8_t res) + : axis_error(err), axis_state(state), procedure_result(result), trajectory_done(done), reserved(res) {} }; - + struct GetErrorPayload { - uint32_t active_errors; - uint32_t disarm_reason; + uint32_t active_errors{}; + uint32_t disarm_reason{}; + + GetErrorPayload() = default; + GetErrorPayload(uint32_t errors, uint32_t reason) + : active_errors(errors), disarm_reason(reason) {} }; - + struct RxSdoPayload { - uint8_t opcode; - uint16_t endpoint_id; - uint8_t reserved; - uint32_t value; + uint8_t opcode{}; + uint16_t endpoint_id{}; + uint8_t reserved{}; + uint32_t value{}; + + RxSdoPayload() = default; + RxSdoPayload(uint8_t op, uint16_t ep, uint8_t res, uint32_t val) + : opcode(op), endpoint_id(ep), reserved(res), value(val) {} }; - + struct TxSdoPayload { - uint8_t reserved0; - uint16_t endpoint_id; - uint8_t reserved1; - uint32_t value; + uint8_t reserved0{}; + uint16_t endpoint_id{}; + uint8_t reserved1{}; + uint32_t value{}; + + TxSdoPayload() = default; + TxSdoPayload(uint8_t res0, uint16_t ep, uint8_t res1, uint32_t val) + : reserved0(res0), endpoint_id(ep), reserved1(res1), value(val) {} }; - + struct AddressPayload { - uint8_t node_id; - uint32_t serial_number_start; - uint16_t serial_number_end; - uint8_t connection_id; + uint8_t node_id{}; + uint32_t serial_number_start{}; + uint16_t serial_number_end{}; + uint8_t connection_id{}; + + AddressPayload() = default; + AddressPayload(uint8_t nid, uint32_t sn_start, uint16_t sn_end, uint8_t conn_id) + : node_id(nid), serial_number_start(sn_start), serial_number_end(sn_end), connection_id(conn_id) {} }; - + struct EncoderEstimatesPayload { - float pos_estimate; - float vel_estimate; + float pos_estimate{}; + float vel_estimate{}; + + EncoderEstimatesPayload() = default; + EncoderEstimatesPayload(float pos, float vel) : pos_estimate(pos), vel_estimate(vel) {} }; - + struct GetIqPayload { - float iq_setpoint; - float iq_measured; + float iq_setpoint{}; + float iq_measured{}; + + GetIqPayload() = default; + GetIqPayload(float set, float meas) : iq_setpoint(set), iq_measured(meas) {} }; - + struct GetTemperaturePayload { - float fet_temperature; - float motor_temperature; + float fet_temperature{}; + float motor_temperature{}; + + GetTemperaturePayload() = default; + GetTemperaturePayload(float fet, float motor) : fet_temperature(fet), motor_temperature(motor) {} }; - + struct BusVoltageCurrentPayload { - float bus_voltage; - float bus_current; + float bus_voltage{}; + float bus_current{}; + + BusVoltageCurrentPayload() = default; + BusVoltageCurrentPayload(float volt, float curr) : bus_voltage(volt), bus_current(curr) {} }; - + struct GetTorquesPayload { - float torque_target; - float torque_estimate; + float torque_target{}; + float torque_estimate{}; + + GetTorquesPayload() = default; + GetTorquesPayload(float tgt, float est) : torque_target(tgt), torque_estimate(est) {} }; - + struct GetPowersPayload { - float electrical_power; - float mechanical_power; + float electrical_power{}; + float mechanical_power{}; + + GetPowersPayload() = default; + GetPowersPayload(float elec, float mech) : electrical_power(elec), mechanical_power(mech) {} }; - + struct SetAxisStatePayload { - uint32_t axis_requested_state; - uint32_t reserved; + uint32_t axis_requested_state{}; + uint32_t reserved{}; + + SetAxisStatePayload() = default; + SetAxisStatePayload(uint32_t req, uint32_t res) : axis_requested_state(req), reserved(res) {} }; - + struct SetControllerModePayload { - uint8_t control_mode; - uint8_t input_mode; - uint16_t reserved0; - uint32_t reserved1; + uint8_t control_mode{}; + uint8_t input_mode{}; + uint16_t reserved0{}; + uint32_t reserved1{}; + + SetControllerModePayload() = default; + SetControllerModePayload(uint8_t ctrl, uint8_t input, uint16_t res0, uint32_t res1) + : control_mode(ctrl), input_mode(input), reserved0(res0), reserved1(res1) {} }; - + struct SetInputPosPayload { - float input_pos; - int16_t vel_ff; - int16_t torque_ff; + float input_pos{}; + int16_t vel_ff{}; + int16_t torque_ff{}; + + SetInputPosPayload() = default; + SetInputPosPayload(float pos, int16_t vff, int16_t tff) : input_pos(pos), vel_ff(vff), torque_ff(tff) {} }; - + struct SetInputVelPayload { - float input_vel; - float input_torque_ff; + float input_vel{}; + float input_torque_ff{}; + + SetInputVelPayload() = default; + SetInputVelPayload(float vel, float torque_ff) : input_vel(vel), input_torque_ff(torque_ff) {} }; - + struct SetInputTorquePayload { - float input_torque; - uint32_t reserved; + float input_torque{}; + uint32_t reserved{}; + + SetInputTorquePayload() = default; + SetInputTorquePayload(float torque, uint32_t res) : input_torque(torque), reserved(res) {} }; - + struct SetLimitsPayload { - float velocity_limit; - float current_limit; + float velocity_limit{}; + float current_limit{}; + + SetLimitsPayload() = default; + SetLimitsPayload(float vel, float curr) : velocity_limit(vel), current_limit(curr) {} }; - + struct SetTrajVelLimitPayload { - float traj_vel_limit; - uint32_t reserved; + float traj_vel_limit{}; + uint32_t reserved{}; + + SetTrajVelLimitPayload() = default; + SetTrajVelLimitPayload(float vel, uint32_t res) : traj_vel_limit(vel), reserved(res) {} }; - + struct SetTrajAccelLimitsPayload { - float traj_accel_limit; - float traj_decel_limit; + float traj_accel_limit{}; + float traj_decel_limit{}; + + SetTrajAccelLimitsPayload() = default; + SetTrajAccelLimitsPayload(float accel, float decel) : traj_accel_limit(accel), traj_decel_limit(decel) {} }; - + struct SetTrajInertiaPayload { - float traj_inertia; - uint32_t reserved; + float traj_inertia{}; + uint32_t reserved{}; + + SetTrajInertiaPayload() = default; + SetTrajInertiaPayload(float inertia, uint32_t res) : traj_inertia(inertia), reserved(res) {} }; - + struct RebootPayload { - uint8_t action; - uint8_t reserved1; - uint16_t reserved2; - uint32_t reserved3; + uint8_t action{}; + uint8_t reserved1{}; + uint16_t reserved2{}; + uint32_t reserved3{}; + + RebootPayload() = default; + RebootPayload(uint8_t act, uint8_t r1, uint16_t r2, uint32_t r3) + : action(act), reserved1(r1), reserved2(r2), reserved3(r3) {} }; - + struct ClearErrorsPayload { - uint32_t identify; - uint32_t reserved; + uint32_t identify{}; + uint32_t reserved{}; + + ClearErrorsPayload() = default; + ClearErrorsPayload(uint32_t id, uint32_t res) : identify(id), reserved(res) {} }; - + struct SetAbsolutePositionPayload { - float position; - uint32_t reserved; + float position{}; + uint32_t reserved{}; + + SetAbsolutePositionPayload() = default; + SetAbsolutePositionPayload(float pos, uint32_t res) : position(pos), reserved(res) {} }; - + struct SetPosGainPayload { - float pos_gain; - uint32_t reserved; + float pos_gain{}; + uint32_t reserved{}; + + SetPosGainPayload() = default; + SetPosGainPayload(float gain, uint32_t res) : pos_gain(gain), reserved(res) {} }; - + struct SetVelGainsPayload { - float vel_gain; - float vel_integrator_gain; + float vel_gain{}; + float vel_integrator_gain{}; + + SetVelGainsPayload() = default; + SetVelGainsPayload(float gain, float igain) : vel_gain(gain), vel_integrator_gain(igain) {} }; #pragma pack(pop) diff --git a/inc/utils.hpp b/inc/utils.hpp index 324a2f7..11b75da 100644 --- a/inc/utils.hpp +++ b/inc/utils.hpp @@ -14,11 +14,27 @@ */ template -bool IsDefined(uint8_t value, const std::array& allowed) { +inline bool IsDefined(uint8_t value, const std::array& allowed) { Enum candidate = static_cast(value); return std::find(allowed.begin(), allowed.end(), candidate) != allowed.end(); } +template +inline uint64_t pack_struct_to_u64(const T& src) { + static_assert(sizeof(T) <= sizeof(uint64_t), "Struct too large to fit in uint64_t"); + uint64_t buf = 0; + memcpy(&buf, &src, sizeof(T)); + return buf; +} + +template +inline T unpack_u64_to_struct(uint64_t data) { + static_assert(sizeof(T) <= sizeof(uint64_t), "Struct too large to unpack from uint64_t"); + T result; + memcpy(&result, &data, sizeof(T)); + return result; +} + namespace CanHeader { struct HeaderInfo{ uint8_t id; @@ -58,4 +74,213 @@ namespace CanPayload { inline uint64_t align_int48_t(uint32_t upper, uint16_t lower) { return static_cast (upper << 16) & lower; } + + inline uint64_t pack_GetVersionPayload(uint8_t proto, uint8_t hw_maj, uint8_t hw_min, uint8_t hw_var, + uint8_t fw_maj, uint8_t fw_min, uint8_t fw_rev, uint8_t fw_unrel) { + return pack_struct_to_u64(GetVersionPayload(proto, hw_maj, hw_min, hw_var, fw_maj, fw_min, fw_rev, fw_unrel)); + } + + inline uint64_t pack_HeartbeatPayload(uint32_t err, uint8_t state, uint8_t result, uint8_t done, uint8_t res) { + return pack_struct_to_u64(HeartbeatPayload(err, state, result, done, res)); + } + + inline uint64_t pack_GetErrorPayload(uint32_t errors, uint32_t reason) { + return pack_struct_to_u64(GetErrorPayload(errors, reason)); + } + + inline uint64_t pack_RxSdoPayload(uint8_t op, uint16_t ep, uint8_t res, uint32_t val) { + return pack_struct_to_u64(RxSdoPayload(op, ep, res, val)); + } + + inline uint64_t pack_TxSdoPayload(uint8_t res0, uint16_t ep, uint8_t res1, uint32_t val) { + return pack_struct_to_u64(TxSdoPayload(res0, ep, res1, val)); + } + + inline uint64_t pack_AddressPayload(uint8_t nid, uint32_t sn_start, uint16_t sn_end, uint8_t conn_id) { + return pack_struct_to_u64(AddressPayload(nid, sn_start, sn_end, conn_id)); + } + + inline uint64_t pack_EncoderEstimatesPayload(float pos, float vel) { + return pack_struct_to_u64(EncoderEstimatesPayload(pos, vel)); + } + + inline uint64_t pack_GetIqPayload(float set, float meas) { + return pack_struct_to_u64(GetIqPayload(set, meas)); + } + + inline uint64_t pack_GetTemperaturePayload(float fet, float motor) { + return pack_struct_to_u64(GetTemperaturePayload(fet, motor)); + } + + inline uint64_t pack_BusVoltageCurrentPayload(float volt, float curr) { + return pack_struct_to_u64(BusVoltageCurrentPayload(volt, curr)); + } + + inline uint64_t pack_GetTorquesPayload(float tgt, float est) { + return pack_struct_to_u64(GetTorquesPayload(tgt, est)); + } + + inline uint64_t pack_GetPowersPayload(float elec, float mech) { + return pack_struct_to_u64(GetPowersPayload(elec, mech)); + } + + inline uint64_t pack_SetAxisStatePayload(uint32_t req, uint32_t res) { + return pack_struct_to_u64(SetAxisStatePayload(req, res)); + } + + inline uint64_t pack_SetControllerModePayload(uint8_t ctrl, uint8_t input, uint16_t res0, uint32_t res1) { + return pack_struct_to_u64(SetControllerModePayload(ctrl, input, res0, res1)); + } + + inline uint64_t pack_SetInputPosPayload(float pos, int16_t vff, int16_t tff) { + return pack_struct_to_u64(SetInputPosPayload(pos, vff, tff)); + } + + inline uint64_t pack_SetInputVelPayload(float vel, float torque_ff) { + return pack_struct_to_u64(SetInputVelPayload(vel, torque_ff)); + } + + inline uint64_t pack_SetInputTorquePayload(float torque, uint32_t res) { + return pack_struct_to_u64(SetInputTorquePayload(torque, res)); + } + + inline uint64_t pack_SetLimitsPayload(float vel, float curr) { + return pack_struct_to_u64(SetLimitsPayload(vel, curr)); + } + + inline uint64_t pack_SetTrajVelLimitPayload(float vel, uint32_t res) { + return pack_struct_to_u64(SetTrajVelLimitPayload(vel, res)); + } + + inline uint64_t pack_SetTrajAccelLimitsPayload(float accel, float decel) { + return pack_struct_to_u64(SetTrajAccelLimitsPayload(accel, decel)); + } + + inline uint64_t pack_SetTrajInertiaPayload(float inertia, uint32_t res) { + return pack_struct_to_u64(SetTrajInertiaPayload(inertia, res)); + } + + inline uint64_t pack_RebootPayload(uint8_t act, uint8_t r1, uint16_t r2, uint32_t r3) { + return pack_struct_to_u64(RebootPayload(act, r1, r2, r3)); + } + + inline uint64_t pack_ClearErrorsPayload(uint32_t id, uint32_t res) { + return pack_struct_to_u64(ClearErrorsPayload(id, res)); + } + + inline uint64_t pack_SetAbsolutePositionPayload(float pos, uint32_t res) { + return pack_struct_to_u64(SetAbsolutePositionPayload(pos, res)); + } + + inline uint64_t pack_SetPosGainPayload(float gain, uint32_t res) { + return pack_struct_to_u64(SetPosGainPayload(gain, res)); + } + + inline uint64_t pack_SetVelGainsPayload(float gain, float igain) { + return pack_struct_to_u64(SetVelGainsPayload(gain, igain)); + } + + inline GetVersionPayload unpack_GetVersionPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline HeartbeatPayload unpack_HeartbeatPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline GetErrorPayload unpack_GetErrorPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline RxSdoPayload unpack_RxSdoPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline TxSdoPayload unpack_TxSdoPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline AddressPayload unpack_AddressPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline EncoderEstimatesPayload unpack_EncoderEstimatesPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline GetIqPayload unpack_GetIqPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline GetTemperaturePayload unpack_GetTemperaturePayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline BusVoltageCurrentPayload unpack_BusVoltageCurrentPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline GetTorquesPayload unpack_GetTorquesPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline GetPowersPayload unpack_GetPowersPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetAxisStatePayload unpack_SetAxisStatePayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetControllerModePayload unpack_SetControllerModePayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetInputPosPayload unpack_SetInputPosPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetInputVelPayload unpack_SetInputVelPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetInputTorquePayload unpack_SetInputTorquePayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetLimitsPayload unpack_SetLimitsPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetTrajVelLimitPayload unpack_SetTrajVelLimitPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetTrajAccelLimitsPayload unpack_SetTrajAccelLimitsPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetTrajInertiaPayload unpack_SetTrajInertiaPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline RebootPayload unpack_RebootPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline ClearErrorsPayload unpack_ClearErrorsPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetAbsolutePositionPayload unpack_SetAbsolutePositionPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetPosGainPayload unpack_SetPosGainPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } + + inline SetVelGainsPayload unpack_SetVelGainsPayload(uint64_t data) { + return unpack_u64_to_struct(data); + } } \ No newline at end of file diff --git a/test/test_can_msg.cpp b/test/test_can_msg.cpp new file mode 100644 index 0000000..4fadd20 --- /dev/null +++ b/test/test_can_msg.cpp @@ -0,0 +1,187 @@ +#include +#include "utils.hpp" + +using namespace CanPayload; + +class PackFixture : public ::testing::Test { +protected: + void SetUp() override {} + void TearDown() override {} +}; + +TEST_F(PackFixture, Pack_GetVersionPayload) { + auto val = pack_GetVersionPayload(207, 0, 188, 173, 34, 61, 203, 186); + auto result = unpack_GetVersionPayload(val); + EXPECT_EQ(result.protocol_version, 207); + EXPECT_EQ(result.hw_version_major, 0); + EXPECT_EQ(result.hw_version_minor, 188); + EXPECT_EQ(result.hw_version_variant, 173); + EXPECT_EQ(result.fw_version_major, 34); + EXPECT_EQ(result.fw_version_minor, 61); + EXPECT_EQ(result.fw_version_revision, 203); + EXPECT_EQ(result.fw_version_unreleased, 186); +} +TEST_F(PackFixture, Pack_HeartbeatPayload) { + auto val = pack_HeartbeatPayload(4106194757, 240, 176, 144, 232); + auto result = unpack_HeartbeatPayload(val); + EXPECT_EQ(result.axis_error, 4106194757); + EXPECT_EQ(result.axis_state, 240); + EXPECT_EQ(result.procedure_result, 176); + EXPECT_EQ(result.trajectory_done, 144); + EXPECT_EQ(result.reserved, 232); +} +TEST_F(PackFixture, Pack_GetErrorPayload) { + auto val = pack_GetErrorPayload(1126843295, 779179158); + auto result = unpack_GetErrorPayload(val); + EXPECT_EQ(result.active_errors, 1126843295); + EXPECT_EQ(result.disarm_reason, 779179158); +} +TEST_F(PackFixture, Pack_RxSdoPayload) { + auto val = pack_RxSdoPayload(82, 17176, 63, 2471323060); + auto result = unpack_RxSdoPayload(val); + EXPECT_EQ(result.opcode, 82); + EXPECT_EQ(result.endpoint_id, 17176); + EXPECT_EQ(result.reserved, 63); + EXPECT_EQ(result.value, 2471323060); +} +TEST_F(PackFixture, Pack_TxSdoPayload) { + auto val = pack_TxSdoPayload(181, 14034, 199, 1726867364); + auto result = unpack_TxSdoPayload(val); + EXPECT_EQ(result.reserved0, 181); + EXPECT_EQ(result.endpoint_id, 14034); + EXPECT_EQ(result.reserved1, 199); + EXPECT_EQ(result.value, 1726867364); +} +TEST_F(PackFixture, Pack_AddressPayload) { + auto val = pack_AddressPayload(158, 1687132453, 13548, 83); + auto result = unpack_AddressPayload(val); + EXPECT_EQ(result.node_id, 158); + EXPECT_EQ(result.serial_number_start, 1687132453); + EXPECT_EQ(result.serial_number_end, 13548); + EXPECT_EQ(result.connection_id, 83); +} +TEST_F(PackFixture, Pack_EncoderEstimatesPayload) { + auto val = pack_EncoderEstimatesPayload(939.9461059570312, -343.69403076171875); + auto result = unpack_EncoderEstimatesPayload(val); + EXPECT_EQ(result.pos_estimate, 939.9461059570312); + EXPECT_EQ(result.vel_estimate, -343.69403076171875); +} +TEST_F(PackFixture, Pack_GetIqPayload) { + auto val = pack_GetIqPayload(-753.4401245117188, -583.8773193359375); + auto result = unpack_GetIqPayload(val); + EXPECT_EQ(result.iq_setpoint, -753.4401245117188); + EXPECT_EQ(result.iq_measured, -583.8773193359375); +} +TEST_F(PackFixture, Pack_GetTemperaturePayload) { + auto val = pack_GetTemperaturePayload(179.77752685546875, 706.0946044921875); + auto result = unpack_GetTemperaturePayload(val); + EXPECT_EQ(result.fet_temperature, 179.77752685546875); + EXPECT_EQ(result.motor_temperature, 706.0946044921875); +} +TEST_F(PackFixture, Pack_BusVoltageCurrentPayload) { + auto val = pack_BusVoltageCurrentPayload(934.9306640625, 522.6814575195312); + auto result = unpack_BusVoltageCurrentPayload(val); + EXPECT_EQ(result.bus_voltage, 934.9306640625); + EXPECT_EQ(result.bus_current, 522.6814575195312); +} +TEST_F(PackFixture, Pack_GetTorquesPayload) { + auto val = pack_GetTorquesPayload(754.4702758789062, 615.1375732421875); + auto result = unpack_GetTorquesPayload(val); + EXPECT_EQ(result.torque_target, 754.4702758789062); + EXPECT_EQ(result.torque_estimate, 615.1375732421875); +} +TEST_F(PackFixture, Pack_GetPowersPayload) { + auto val = pack_GetPowersPayload(-879.1647338867188, 625.155029296875); + auto result = unpack_GetPowersPayload(val); + EXPECT_EQ(result.electrical_power, -879.1647338867188); + EXPECT_EQ(result.mechanical_power, 625.155029296875); +} +TEST_F(PackFixture, Pack_SetAxisStatePayload) { + auto val = pack_SetAxisStatePayload(3711643247, 3299453749); + auto result = unpack_SetAxisStatePayload(val); + EXPECT_EQ(result.axis_requested_state, 3711643247); + EXPECT_EQ(result.reserved, 3299453749); +} +TEST_F(PackFixture, Pack_SetControllerModePayload) { + auto val = pack_SetControllerModePayload(93, 193, 55955, 1026479264); + auto result = unpack_SetControllerModePayload(val); + EXPECT_EQ(result.control_mode, 93); + EXPECT_EQ(result.input_mode, 193); + EXPECT_EQ(result.reserved0, 55955); + EXPECT_EQ(result.reserved1, 1026479264); +} +TEST_F(PackFixture, Pack_SetInputPosPayload) { + auto val = pack_SetInputPosPayload(751.236572265625, -7048, -2865); + auto result = unpack_SetInputPosPayload(val); + EXPECT_EQ(result.input_pos, 751.236572265625); + EXPECT_EQ(result.vel_ff, -7048); + EXPECT_EQ(result.torque_ff, -2865); +} +TEST_F(PackFixture, Pack_SetInputVelPayload) { + auto val = pack_SetInputVelPayload(500.6752624511719, -409.4150390625); + auto result = unpack_SetInputVelPayload(val); + EXPECT_EQ(result.input_vel, 500.6752624511719); + EXPECT_EQ(result.input_torque_ff, -409.4150390625); +} +TEST_F(PackFixture, Pack_SetInputTorquePayload) { + auto val = pack_SetInputTorquePayload(979.186767578125, 1885310099); + auto result = unpack_SetInputTorquePayload(val); + EXPECT_EQ(result.input_torque, 979.186767578125); + EXPECT_EQ(result.reserved, 1885310099); +} +TEST_F(PackFixture, Pack_SetLimitsPayload) { + auto val = pack_SetLimitsPayload(-633.29638671875, 108.10169982910156); + auto result = unpack_SetLimitsPayload(val); + EXPECT_EQ(result.velocity_limit, -633.29638671875); + EXPECT_EQ(result.current_limit, 108.10169982910156); +} +TEST_F(PackFixture, Pack_SetTrajVelLimitPayload) { + auto val = pack_SetTrajVelLimitPayload(-996.68505859375, 4074180013); + auto result = unpack_SetTrajVelLimitPayload(val); + EXPECT_EQ(result.traj_vel_limit, -996.68505859375); + EXPECT_EQ(result.reserved, 4074180013); +} +TEST_F(PackFixture, Pack_SetTrajAccelLimitsPayload) { + auto val = pack_SetTrajAccelLimitsPayload(-635.3016357421875, -715.0675659179688); + auto result = unpack_SetTrajAccelLimitsPayload(val); + EXPECT_EQ(result.traj_accel_limit, -635.3016357421875); + EXPECT_EQ(result.traj_decel_limit, -715.0675659179688); +} +TEST_F(PackFixture, Pack_SetTrajInertiaPayload) { + auto val = pack_SetTrajInertiaPayload(255.33192443847656, 1464517241); + auto result = unpack_SetTrajInertiaPayload(val); + EXPECT_EQ(result.traj_inertia, 255.33192443847656); + EXPECT_EQ(result.reserved, 1464517241); +} +TEST_F(PackFixture, Pack_RebootPayload) { + auto val = pack_RebootPayload(98, 113, 53258, 1229868823); + auto result = unpack_RebootPayload(val); + EXPECT_EQ(result.action, 98); + EXPECT_EQ(result.reserved1, 113); + EXPECT_EQ(result.reserved2, 53258); + EXPECT_EQ(result.reserved3, 1229868823); +} +TEST_F(PackFixture, Pack_ClearErrorsPayload) { + auto val = pack_ClearErrorsPayload(3748010892, 1473327532); + auto result = unpack_ClearErrorsPayload(val); + EXPECT_EQ(result.identify, 3748010892); + EXPECT_EQ(result.reserved, 1473327532); +} +TEST_F(PackFixture, Pack_SetAbsolutePositionPayload) { + auto val = pack_SetAbsolutePositionPayload(-565.8623046875, 33672196); + auto result = unpack_SetAbsolutePositionPayload(val); + EXPECT_EQ(result.position, -565.8623046875); + EXPECT_EQ(result.reserved, 33672196); +} +TEST_F(PackFixture, Pack_SetPosGainPayload) { + auto val = pack_SetPosGainPayload(-497.8382263183594, 2656791018); + auto result = unpack_SetPosGainPayload(val); + EXPECT_EQ(result.pos_gain, -497.8382263183594); + EXPECT_EQ(result.reserved, 2656791018); +} +TEST_F(PackFixture, Pack_SetVelGainsPayload) { + auto val = pack_SetVelGainsPayload(-323.467041015625, 368.3490295410156); + auto result = unpack_SetVelGainsPayload(val); + EXPECT_EQ(result.vel_gain, -323.467041015625); + EXPECT_EQ(result.vel_integrator_gain, 368.3490295410156); +} \ No newline at end of file From 8c541715963e2e66a0547c04061f9c73c4f0538a Mon Sep 17 00:00:00 2001 From: billylin609 Date: Fri, 16 May 2025 14:10:19 -0400 Subject: [PATCH 15/33] f --- inc/can_simple.hpp | 139 --------------------------------------------- 1 file changed, 139 deletions(-) diff --git a/inc/can_simple.hpp b/inc/can_simple.hpp index 8abb9b7..224babf 100644 --- a/inc/can_simple.hpp +++ b/inc/can_simple.hpp @@ -315,145 +315,6 @@ namespace CanPayload { SetVelGainsPayload() = default; SetVelGainsPayload(float gain, float igain) : vel_gain(gain), vel_integrator_gain(igain) {} }; - - struct HeartbeatPayload { - uint32_t axis_error; - uint8_t axis_state; - uint8_t procedure_result; - uint8_t trajectory_done; - uint8_t reserved; - }; - - struct GetErrorPayload { - uint32_t active_errors; - uint32_t disarm_reason; - }; - - struct RxSdoPayload { - uint8_t opcode; - uint16_t endpoint_id; - uint8_t reserved; - uint32_t value; - }; - - struct TxSdoPayload { - uint8_t reserved0; - uint16_t endpoint_id; - uint8_t reserved1; - uint32_t value; - }; - - struct AddressPayload { - uint8_t node_id; - uint32_t serial_number_start; - uint16_t serial_number_end; - uint8_t connection_id; - }; - - struct EncoderEstimatesPayload { - float pos_estimate; - float vel_estimate; - }; - - struct GetIqPayload { - float iq_setpoint; - float iq_measured; - }; - - struct GetTemperaturePayload { - float fet_temperature; - float motor_temperature; - }; - - struct BusVoltageCurrentPayload { - float bus_voltage; - float bus_current; - }; - - struct GetTorquesPayload { - float torque_target; - float torque_estimate; - }; - - struct GetPowersPayload { - float electrical_power; - float mechanical_power; - }; - - struct SetAxisStatePayload { - uint32_t axis_requested_state; - uint32_t reserved; - }; - - struct SetControllerModePayload { - uint8_t control_mode; - uint8_t input_mode; - uint16_t reserved0; - uint32_t reserved1; - }; - - struct SetInputPosPayload { - float input_pos; - int16_t vel_ff; - int16_t torque_ff; - }; - - struct SetInputVelPayload { - float input_vel; - float input_torque_ff; - }; - - struct SetInputTorquePayload { - float input_torque; - uint32_t reserved; - }; - - struct SetLimitsPayload { - float velocity_limit; - float current_limit; - }; - - struct SetTrajVelLimitPayload { - float traj_vel_limit; - uint32_t reserved; - }; - - struct SetTrajAccelLimitsPayload { - float traj_accel_limit; - float traj_decel_limit; - }; - - struct SetTrajInertiaPayload { - float traj_inertia; - uint32_t reserved; - }; - - struct RebootPayload { - uint8_t action; - uint8_t reserved1; - uint16_t reserved2; - uint32_t reserved3; - }; - - struct ClearErrorsPayload { - uint32_t identify; - uint32_t reserved; - }; - - struct SetAbsolutePositionPayload { - float position; - uint32_t reserved; - }; - - struct SetPosGainPayload { - float pos_gain; - uint32_t reserved; - }; - - struct SetVelGainsPayload { - float vel_gain; - float vel_integrator_gain; - }; #pragma pack(pop) From ffa9211ce05de37edb1d62840d223183f7361c9d Mon Sep 17 00:00:00 2001 From: billylin609 Date: Fri, 16 May 2025 14:44:02 -0400 Subject: [PATCH 16/33] f --- CMakeLists.txt | 12 ++++++- README.md | 59 ++++++++++++++++++----------------- inc/can_simple.hpp | 7 ++--- src/lib.cpp | 3 ++ target/ros/__init__.cpp | 0 target/seeedxiao/__init__.cpp | 0 target/stm/__init__.cpp | 0 7 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 src/lib.cpp delete mode 100644 target/ros/__init__.cpp delete mode 100644 target/seeedxiao/__init__.cpp delete mode 100644 target/stm/__init__.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 666236c..31cf76f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,25 @@ cmake_minimum_required(VERSION 3.14) -project(my_project) +project(MotorControllerLib) # GoogleTest requires at least C++17 set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Create a static library target +add_library(odrive STATIC + src/lib.cpp +) + +# Expose public headers to users of the library +target_include_directories(odrive PUBLIC ${CMAKE_SOURCE_DIR}/inc) + +# Gtest include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip ) + # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) diff --git a/README.md b/README.md index 158ce27..4bfabf1 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,39 @@ # Introduction -This is an official branch for all the device that need to interact with ODrive or Similar Motor Controller. Our team are currently using ODrive V3.6, ODrive Micro, and ODrive S1. - -# Folder Structure - -The project is divided into generic code & interface in the /inc and /src folder. Target specific code are linked in the /target folder. - -```bash -. -├── inc -├── src -└── target - ├── ros - ├── seeedxiao - └── stm -``` +This is an official library repository for all the device that need to interact with ODrive micro or S1 or similar Motor Controller. Our team are currently using ODrive V3.6, ODrive Micro, and ODrive S1. Currently the command set support ODrive Micro and S1 using documentation 6.11. [ODrive Docs](https://docs.odriverobotics.com/v/latest/guides/getting-started.html) # Project Objective In short term, this project is aimed to support ODrive family. In long term, this project is also aiming to support custom FOC Device manufactured in house. -- Device Identification -- Device Command Abstraction over CAN -- Grouping Device Command + +- High-Level CAN Message Agent + - Device Identification + - Device Command Abstraction over CAN + - Grouping Device Command - INS/ GNSS Fusion and Logging - Device Error Handling - Robotics Simulation Abstraction(Gazebo) -Anyone using this library still need to integrate application/ simulation on top of this static library. +Anyone using this library still need to integrate this library into the application/ simulation on top of this static library. +On my computer the post-compiled library is libodrive.a. +# Folder Structure -# Interface +The project + +```bash +. +├── C++.gitignore +├── CMake.gitignore +├── CMakeLists.txt +├── LICENSE +├── README.md +├── build +├── inc +├── src +└── test +``` ## Movement Command @@ -77,23 +80,23 @@ class Logging { } ``` +# Compile Library and UnitTest +```bash +mkdir build && cd build -## Set Command - -```c++ -//todo -``` - -# Testing and Validation +cmake .. && cd .. -```bash # Create build folder based on CMakeLists.txt cmake -S . -b build # Compile the project cmake --build build +``` +# Testing and Validation + +```bash # Execute test cd build && ctest && cd .. ``` diff --git a/inc/can_simple.hpp b/inc/can_simple.hpp index 224babf..57b1f42 100644 --- a/inc/can_simple.hpp +++ b/inc/can_simple.hpp @@ -3,13 +3,14 @@ namespace CanHeader { constexpr uint8_t broadcastNodeId = 0x3f; - constexpr bool autoBuad = false; //support send beacon message constexpr uint16_t headerBound = 0x7ff; constexpr uint8_t cmdBound = 0x1f; constexpr uint8_t errorCode8 = static_cast(-1); constexpr uint16_t errCode16 = static_cast(-1); - /// @todo: Support cmd decode and if not in enum assign UNDEFINE + /// @todo: Support Beacon Message for auto buad + constexpr bool autoBuad = false; + enum class CmdMap : uint8_t { Get_Version = 0x000, Heartbeat = 0x001, @@ -317,8 +318,6 @@ namespace CanPayload { }; #pragma pack(pop) - - // Compile-time check that all CAN payloads are == 8 bytes static_assert(sizeof(GetVersionPayload) == 8, "GetVersionPayload too large"); static_assert(sizeof(HeartbeatPayload) == 8, "HeartbeatPayload too large"); diff --git a/src/lib.cpp b/src/lib.cpp new file mode 100644 index 0000000..abad712 --- /dev/null +++ b/src/lib.cpp @@ -0,0 +1,3 @@ +#include +#include // For memcpy +#include "utils.hpp" \ No newline at end of file diff --git a/target/ros/__init__.cpp b/target/ros/__init__.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/target/seeedxiao/__init__.cpp b/target/seeedxiao/__init__.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/target/stm/__init__.cpp b/target/stm/__init__.cpp deleted file mode 100644 index e69de29..0000000 From 80fd5b6662b8d005f354221bd9c3b8a3122b4388 Mon Sep 17 00:00:00 2001 From: billylin609 Date: Fri, 16 May 2025 15:02:13 -0400 Subject: [PATCH 17/33] f --- CMakeLists.txt | 15 +- README.md | 4 +- example/CMakeLists.txt | 19 + example/build/CMakeCache.txt | 366 ++ .../CMakeFiles/3.16.3/CMakeCCompiler.cmake | 76 + .../CMakeFiles/3.16.3/CMakeCXXCompiler.cmake | 88 + .../3.16.3/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 16552 bytes .../3.16.3/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 16560 bytes .../build/CMakeFiles/3.16.3/CMakeSystem.cmake | 15 + .../3.16.3/CompilerIdC/CMakeCCompilerId.c | 671 ++ .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 660 ++ .../CMakeDirectoryInformation.cmake | 16 + example/build/CMakeFiles/CMakeOutput.log | 461 ++ example/build/CMakeFiles/Makefile.cmake | 49 + example/build/CMakeFiles/Makefile2 | 106 + .../build/CMakeFiles/TargetDirectories.txt | 3 + example/build/CMakeFiles/cmake.check_cache | 1 + .../CMakeFiles/exec.dir/CXX.includecache | 30 + .../CMakeFiles/exec.dir/DependInfo.cmake | 21 + example/build/CMakeFiles/exec.dir/build.make | 99 + .../CMakeFiles/exec.dir/cmake_clean.cmake | 10 + .../build/CMakeFiles/exec.dir/depend.internal | 7 + example/build/CMakeFiles/exec.dir/depend.make | 7 + example/build/CMakeFiles/exec.dir/flags.make | 10 + example/build/CMakeFiles/exec.dir/link.txt | 1 + .../build/CMakeFiles/exec.dir/progress.make | 3 + example/build/CMakeFiles/progress.marks | 1 + example/build/Makefile | 178 + example/build/cmake_install.cmake | 49 + example/build/exec | Bin 0 -> 19056 bytes example/lib/odrive/include/__init__.cpp | 0 example/lib/odrive/include/can_simple.hpp | 348 + .../lib/odrive/include/gmock/gmock-actions.h | 2302 +++++++ .../include/gmock/gmock-cardinalities.h | 159 + .../include/gmock/gmock-function-mocker.h | 514 ++ .../lib/odrive/include/gmock/gmock-matchers.h | 5625 +++++++++++++++++ .../odrive/include/gmock/gmock-more-actions.h | 662 ++ .../include/gmock/gmock-more-matchers.h | 122 + .../odrive/include/gmock/gmock-nice-strict.h | 277 + .../include/gmock/gmock-spec-builders.h | 2083 ++++++ example/lib/odrive/include/gmock/gmock.h | 96 + .../include/gmock/internal/custom/README.md | 18 + .../internal/custom/gmock-generated-actions.h | 7 + .../gmock/internal/custom/gmock-matchers.h | 37 + .../gmock/internal/custom/gmock-port.h | 40 + .../gmock/internal/gmock-internal-utils.h | 472 ++ .../include/gmock/internal/gmock-port.h | 139 + .../odrive/include/gmock/internal/gmock-pp.h | 279 + .../include/gtest/gtest-assertion-result.h | 237 + .../odrive/include/gtest/gtest-death-test.h | 345 + .../lib/odrive/include/gtest/gtest-matchers.h | 956 +++ .../lib/odrive/include/gtest/gtest-message.h | 218 + .../odrive/include/gtest/gtest-param-test.h | 545 ++ .../lib/odrive/include/gtest/gtest-printers.h | 1055 ++++ example/lib/odrive/include/gtest/gtest-spi.h | 248 + .../odrive/include/gtest/gtest-test-part.h | 190 + .../odrive/include/gtest/gtest-typed-test.h | 331 + example/lib/odrive/include/gtest/gtest.h | 2308 +++++++ .../odrive/include/gtest/gtest_pred_impl.h | 279 + example/lib/odrive/include/gtest/gtest_prod.h | 60 + .../include/gtest/internal/custom/README.md | 44 + .../gtest/internal/custom/gtest-port.h | 37 + .../gtest/internal/custom/gtest-printers.h | 42 + .../include/gtest/internal/custom/gtest.h | 37 + .../internal/gtest-death-test-internal.h | 306 + .../include/gtest/internal/gtest-filepath.h | 220 + .../include/gtest/internal/gtest-internal.h | 1570 +++++ .../include/gtest/internal/gtest-param-util.h | 1028 +++ .../include/gtest/internal/gtest-port-arch.h | 118 + .../include/gtest/internal/gtest-port.h | 2423 +++++++ .../include/gtest/internal/gtest-string.h | 177 + .../include/gtest/internal/gtest-type-util.h | 186 + example/lib/odrive/include/utils.hpp | 286 + .../odrive/lib/cmake/GTest/GTestConfig.cmake | 33 + .../lib/cmake/GTest/GTestConfigVersion.cmake | 37 + .../cmake/GTest/GTestTargets-noconfig.cmake | 49 + .../odrive/lib/cmake/GTest/GTestTargets.cmake | 131 + example/lib/odrive/lib/pkgconfig/gmock.pc | 10 + .../lib/odrive/lib/pkgconfig/gmock_main.pc | 10 + example/lib/odrive/lib/pkgconfig/gtest.pc | 9 + .../lib/odrive/lib/pkgconfig/gtest_main.pc | 10 + example/main.cpp | 33 + 82 files changed, 29709 insertions(+), 5 deletions(-) create mode 100644 example/CMakeLists.txt create mode 100644 example/build/CMakeCache.txt create mode 100644 example/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake create mode 100644 example/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake create mode 100755 example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin create mode 100755 example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin create mode 100644 example/build/CMakeFiles/3.16.3/CMakeSystem.cmake create mode 100644 example/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c create mode 100644 example/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100644 example/build/CMakeFiles/CMakeDirectoryInformation.cmake create mode 100644 example/build/CMakeFiles/CMakeOutput.log create mode 100644 example/build/CMakeFiles/Makefile.cmake create mode 100644 example/build/CMakeFiles/Makefile2 create mode 100644 example/build/CMakeFiles/TargetDirectories.txt create mode 100644 example/build/CMakeFiles/cmake.check_cache create mode 100644 example/build/CMakeFiles/exec.dir/CXX.includecache create mode 100644 example/build/CMakeFiles/exec.dir/DependInfo.cmake create mode 100644 example/build/CMakeFiles/exec.dir/build.make create mode 100644 example/build/CMakeFiles/exec.dir/cmake_clean.cmake create mode 100644 example/build/CMakeFiles/exec.dir/depend.internal create mode 100644 example/build/CMakeFiles/exec.dir/depend.make create mode 100644 example/build/CMakeFiles/exec.dir/flags.make create mode 100644 example/build/CMakeFiles/exec.dir/link.txt create mode 100644 example/build/CMakeFiles/exec.dir/progress.make create mode 100644 example/build/CMakeFiles/progress.marks create mode 100644 example/build/Makefile create mode 100644 example/build/cmake_install.cmake create mode 100755 example/build/exec create mode 100644 example/lib/odrive/include/__init__.cpp create mode 100644 example/lib/odrive/include/can_simple.hpp create mode 100644 example/lib/odrive/include/gmock/gmock-actions.h create mode 100644 example/lib/odrive/include/gmock/gmock-cardinalities.h create mode 100644 example/lib/odrive/include/gmock/gmock-function-mocker.h create mode 100644 example/lib/odrive/include/gmock/gmock-matchers.h create mode 100644 example/lib/odrive/include/gmock/gmock-more-actions.h create mode 100644 example/lib/odrive/include/gmock/gmock-more-matchers.h create mode 100644 example/lib/odrive/include/gmock/gmock-nice-strict.h create mode 100644 example/lib/odrive/include/gmock/gmock-spec-builders.h create mode 100644 example/lib/odrive/include/gmock/gmock.h create mode 100644 example/lib/odrive/include/gmock/internal/custom/README.md create mode 100644 example/lib/odrive/include/gmock/internal/custom/gmock-generated-actions.h create mode 100644 example/lib/odrive/include/gmock/internal/custom/gmock-matchers.h create mode 100644 example/lib/odrive/include/gmock/internal/custom/gmock-port.h create mode 100644 example/lib/odrive/include/gmock/internal/gmock-internal-utils.h create mode 100644 example/lib/odrive/include/gmock/internal/gmock-port.h create mode 100644 example/lib/odrive/include/gmock/internal/gmock-pp.h create mode 100644 example/lib/odrive/include/gtest/gtest-assertion-result.h create mode 100644 example/lib/odrive/include/gtest/gtest-death-test.h create mode 100644 example/lib/odrive/include/gtest/gtest-matchers.h create mode 100644 example/lib/odrive/include/gtest/gtest-message.h create mode 100644 example/lib/odrive/include/gtest/gtest-param-test.h create mode 100644 example/lib/odrive/include/gtest/gtest-printers.h create mode 100644 example/lib/odrive/include/gtest/gtest-spi.h create mode 100644 example/lib/odrive/include/gtest/gtest-test-part.h create mode 100644 example/lib/odrive/include/gtest/gtest-typed-test.h create mode 100644 example/lib/odrive/include/gtest/gtest.h create mode 100644 example/lib/odrive/include/gtest/gtest_pred_impl.h create mode 100644 example/lib/odrive/include/gtest/gtest_prod.h create mode 100644 example/lib/odrive/include/gtest/internal/custom/README.md create mode 100644 example/lib/odrive/include/gtest/internal/custom/gtest-port.h create mode 100644 example/lib/odrive/include/gtest/internal/custom/gtest-printers.h create mode 100644 example/lib/odrive/include/gtest/internal/custom/gtest.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-death-test-internal.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-filepath.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-internal.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-param-util.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-port-arch.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-port.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-string.h create mode 100644 example/lib/odrive/include/gtest/internal/gtest-type-util.h create mode 100644 example/lib/odrive/include/utils.hpp create mode 100644 example/lib/odrive/lib/cmake/GTest/GTestConfig.cmake create mode 100644 example/lib/odrive/lib/cmake/GTest/GTestConfigVersion.cmake create mode 100644 example/lib/odrive/lib/cmake/GTest/GTestTargets-noconfig.cmake create mode 100644 example/lib/odrive/lib/cmake/GTest/GTestTargets.cmake create mode 100644 example/lib/odrive/lib/pkgconfig/gmock.pc create mode 100644 example/lib/odrive/lib/pkgconfig/gmock_main.pc create mode 100644 example/lib/odrive/lib/pkgconfig/gtest.pc create mode 100644 example/lib/odrive/lib/pkgconfig/gtest_main.pc create mode 100644 example/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 31cf76f..4adb76b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,20 @@ project(MotorControllerLib) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# Create a static library target -add_library(odrive STATIC +# Create the static library +add_library(Odrive STATIC src/lib.cpp ) -# Expose public headers to users of the library -target_include_directories(odrive PUBLIC ${CMAKE_SOURCE_DIR}/inc) +# Set public header directory +target_include_directories(Odrive PUBLIC ${CMAKE_SOURCE_DIR}/inc) + +# Install compiled static library +install(TARGETS Odrive + ARCHIVE DESTINATION lib) + +# Install header files +install(DIRECTORY inc/ DESTINATION include) # Gtest include(FetchContent) diff --git a/README.md b/README.md index 4bfabf1..122035e 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,12 @@ mkdir build && cd build cmake .. && cd .. # Create build folder based on CMakeLists.txt -cmake -S . -b build +cmake -B build -DCMAKE_INSTALL_PREFIX=lib # Compile the project cmake --build build + +cmake --install build ``` # Testing and Validation diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt new file mode 100644 index 0000000..a236dcd --- /dev/null +++ b/example/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.14) +project(LibExample) + + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Add the library manually +add_library(libOdrive STATIC IMPORTED GLOBAL) +set_target_properties(libOdrive PROPERTIES + IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/odrive/lib/libOdrive.a + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/lib/odrive/include +) + +# Create your executable +add_executable(exec main.cpp) + +# Link the imported static lib +target_link_libraries(exec PRIVATE libOdrive) \ No newline at end of file diff --git a/example/build/CMakeCache.txt b/example/build/CMakeCache.txt new file mode 100644 index 0000000..1f8fa1c --- /dev/null +++ b/example/build/CMakeCache.txt @@ -0,0 +1,366 @@ +# This is the CMakeCache file. +# For build in directory: /home/linyuchen/code_ws/odrive_bridge/example/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=LibExample + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +LibExample_BINARY_DIR:STATIC=/home/linyuchen/code_ws/odrive_bridge/example/build + +//Value Computed by CMake +LibExample_SOURCE_DIR:STATIC=/home/linyuchen/code_ws/odrive_bridge/example + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/linyuchen/code_ws/odrive_bridge/example/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=16 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/linyuchen/code_ws/odrive_bridge/example +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/example/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake b/example/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..c5ece7b --- /dev/null +++ b/example/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake @@ -0,0 +1,76 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "9.4.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/example/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake b/example/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..278ef39 --- /dev/null +++ b/example/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake @@ -0,0 +1,88 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "9.4.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin b/example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000000000000000000000000000000000000..b7a0b099a8541ad05f2c95de959aebbb88a8d67c GIT binary patch literal 16552 zcmeHOZ)_Y#6`%9j&LvIGmoy=6lGY1NrI_N46B2U?HMz5W_PTQZkl0O7>Mm#B**OU`N{f&HU!QH?wbM_GWfxJ{IfiuJQQ<2fz4$z*HopmNR4d3T{(0l%N9F5E1oO3NO^D97aL+fqF8F z(#$j7paK|~uau`zi7p%?Jx048`eva;=`FN7Q6s)UQ=|)Xi5sYrV6Qt+HF4AMfGB6x_#Y()L@{X{cCe4Vj3m;IlVC3>X2zt^ll>b)1 z&3u%~Td5sFyocCG%&HAjB-wVSh#UOM$gy~Q@LOq9WZ`rIWjjd3gkWz_wD z9Aea$0k0%~l99v;KVjgtDtTLg+faq?2TrTP53j)A0sOnF$P4h_FuJQvnC9?A+#E?| zSqj%p!b?5QP<3d}nG8SpvGCxNK0uhzZ zJf~kepm=O6ERVySjpsUH-n@Drx3=cW~`d>Wn=2Oz^v3S?|mBR*UR^P8K9v_pgg30 zAX8mJrgvTIEnRuUDE;1;`s2cp{=VtDvoQ5Frq?w{Xuk-S%A4|_^0)KGbo&<}VocXP ziLh_c+5|-(!Z;MYx;)p=bOsBaB?S4Dl;1mq(0tn{Ef^PHJz!j1^c%kCjVrgUjbPwD zG7u=wjWjety;vXXd!`+;Me+UtW2(Idqekf!Yprpvy&e+t&E;}=J^??^*WH3uw{H-1 z9r}NM3^LKs0O*yTxN4M&bC+T_v6|;%SB(qC^rjyL!8_lr4K+MFHEHt7+G-$sc{C z*ZWGZc9s4VEpPm-F*WNm_Pt#E3%1wE!RW)$!RRAVb9Q7zZ)o}?)=#z%wj`D-+qu%R zGTZy{Jm7i2^ML08&jX$ZJP&vt@I2so!1I9Tf&UW^_#9swh3GxheRzKXzSHGK%*42r zKiL`{L{~^YK9o8M`vs8jZS}t&ztQ4%uKCx><#E78zzcwZg>v}>;B~-n0*0@b%a;M4 z0c@m?V)$(ogYWU9!Z#7}ZC$%6a31oI-v-w+U<+63qHC4>;4d*B)eUJ}7jcd+rn zhC3b$oDm1M?0@%rx699vsQ)lrCs+>R7|^B#*FLCI4-&Cp=xj~ry86>lFeKrXf%rUJ zABOxSpy&>UK3CHlZ2YW07SyI|W5FGtsp|^1o~<{6;i*+U!ALe3js{z!!5tkzts~gj z5e#(%1M>UgZ$SOiV8{DDhmQ1u=K;?Ho(DV+cpmUP;CaCFfad|v1OF=z@V-Xg$4JYu z%3j5_Trs)G60px(g?ZW!c^9R5zvNa*^FB!2SBio6P2#!>1LxnkUCv?pDcbDFYorsk z$nqXnAzq;THHsEb5aNDQ42=rJCPD^M6En0=ausC+s35M#4DqlDR0g(p52ab|&9bU5 z_(@XmMOM~-p6UxpOzk?oyH#)9qwj83{9703hhEiK<;MN+&Vl!*+pYLv_cQN5ck;F3R8>25 zm44)uudnnUC%;N?KXdW{!R_VbR|{@uC%;B;e{%BBJ89fF`L#l;%C8fxRrz4${Dsp_ zgWz%Krn|+jIS}^LwJI{GEcwwNrj$Wjs517=2axpI^MAGX9+Mn}vwj z85Q@#Xbx57`DwGHgX64LTrV#%Du&Ok8W9xZE`P!f49P#`;@?R;KL?c+A>IcO=(Uyl z@VM@l{Bl3w=6fucpQ~(VQpzv)C%zx6R{w8E`HWlb6WDt`%et`^)To{q{ROR4*?$%n=9?e*6syAM4+3*zEarfI2@KmHt zT8In4udmrG_<72iUqK#f#7gw{AifPe`eB^>kR*kl0*0U;Hb&Tj!cUNVg!=PN%6<-b zly{G#%Ou}S_T{@z(D?=MSWmb7?||3HrXAh{UcO+plNcY)TLr5KJC26M(yMh49Eo%8cjp@kuk8wepi< zBp=Tt%|tPinFJME$^=QvA=-H`{*h#7Clr%PC-c#cUZ`IxJCZZu9X9B8AB`T2nXyA% zCY&R2YA1x*^`S%2gT0;39C=^`C^)HO#tgDxbR89DPv7B=XrFnwyZczI-|UZe^u^Gs zJmxZ7D9Zczmj_#9#cVI#g_%smtvK6QIw}*1IL^wLD5cKBfUNUyjF~9p%&~Yjfd^-L z4}(-9l{JfnB;4Op)zEK{9x4>bj69HInsDxhy@LmGs-CiOp6hW|P3VQmj1?aOwDJna zIF`!7!JcuUXLD9kAI%o^@qBJPnYSiw)KD=6N3T)|qM-d+toW#q;$!i`n9viGStvrG zl~*|*P38-!T-K2=Aupdy$5BD(@_zO4v?cIIAI(9;N>0Epb~cdANyqESG3s7p3DD=1 z(pUXVX>c5j$1|y6s1CN94*nE6^zjVzTlau@dug0!!w`gLsR}%=V&r)?WlLF(Bi;)a z&V^Z@=UGOP!QDZ?uxBhY9-+;L^*Pqu9 zj9k7tBe%5PV6$!qhqui7Jdb4L^$Cc`fHv&mQAprg zf%SR5$;j(2u0P8$o(6qfdvKcPrHmRC=B_`{Vj3doQ`YDCE8`3aa{2E2{{rOWJ#jw% zmB~QJ>p)^2Y2~DgiNd=>xVTZ&G>*yR({>({}^)Y`V*QGWn8Fe zstC6~)4zlW&Pi$5SJnx9uGTHjX~sW*Zi7vq-w!Od011KRRB9>B{A-YbeUHnp%vW`# zF+=T#{T~DCu^+z*9Ez|$zaN;P2~-5~?1A+e7a`NGFCrw}s*uYewo*Q)Z$kuaarr#& z3XwjS!}4@HoD^z)Ed+^Ic-Fta!l(%A+mZW@T{OZ5X<*|x#wOwV@beGflW^S~`qXhZ YyNq+WEQ{06YWl~+N@A@`!Ic#M1cl@}X8-^I literal 0 HcmV?d00001 diff --git a/example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin b/example/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000000000000000000000000000000000000..a9f2f4fcd2212c7a691a5f97281887e6d1b41c2a GIT binary patch literal 16560 zcmeHOZ)_Y#6`%9j$)!!smo#Zi5}GZfBB6L=hs3>vn%vnwdks!f5}O**bUFLh_QCn? zxZ5LkMblO$5vO1pp$f_eq^bz01Rn}Q@Bsmi0%;`#YJ^mZplWETFjbm5fgnQ@AMee) zcivr}DgPusup{05W`6Vj%)Xh~o4uWRDACtl7YGPWLGgZprC3BUF{;S#r3^q!M8z8T ze!JKrRzSI4a;iS20BTiwq0WsV;)8&w*MylGxJA+6K_zY>BI+%do^4PyjDoHM^<)*5 znPm1-HH~B?C(RMC*wl(Zw1`V zhsob^{Scw}Gg5fP&P;l!ZTHShsyUO+mL{4fqHWD>yY*sD-z8mRyU+)Ysh)!a0?f=H zM`4tGv7X9U|JW<*zWdrk@A|>5C%<)k;TtcVw8lC=$TrX?%3wl$9uio_Jo-Qxb^VV( zj>a!=s(bz$z`qn2%f{62=kDq6n{GG-OJ8GpO{0YNvtX&Rp#Um>K4VO`e;G2ybi)@A z_RiZI!1Y1QgX>k5i;Y_!M#tv}K|U?z_Y5KISTM?S#@WmJjkEJXBXHihuwbtT19y;t zQ03xC<5p-F>tlN#ZpUg-x^uvoYOlkrQGV54ZJcgj0fpHel}cqc1z+bIZopG_;27w- z^#6DqD$&pY=#?M5WRy!6pGjQDW}Z%5G9EXkH~cgV(fM9|r13{Hfy8xYpYgEQkDWs^ z@q7EG+l%nz5&v*+`T6)jZ~0ohKVH5*U`#isfIiZ<;|BK0thrFB7-w$;?X9i9p?LI_ zulAKMca{GTudIK`m^v3Q_P$tp4g2fpvG{%QWAXdr=DCp(y>aVjuzj+BuqV;4?B{CF z%4+}1kANQmKLUOP{0R6F@FUk0*0Y3tM1pZGV5OBS16r%TF_o017cu$ubF;jWF zaI__Q3_~IL=!^HusQfXd`FA#xn|#}RPuoHfR6))<|>szz$<`H14ge@D$fBv z1=vI{#qixIroaP-MPMQl*t~jW=nT{$zXd)|fh~Me7hNmm8@Fwc-3^~S@RA5ey2DK$ zXuSD&=wY#c)4q4Vcbj|-iTd}!XOQI}j|pws@YxG(>OmqAj-0CNT(jZ?IEEtpWgs4d z&&QzN0uM2Ta7eyi{4J<|7VP-%=P;0d@+06!z>k0*0Y3tM1pEm25%446N8o=I0p8ch`xxnQ zth!fmH8)H?WC_^kt*i?#+s7 zFT_bw@J3d)f0o({Z-!-=;|Py^viv;N|CP$zE;9e$1KuD0A6n%7t392a`?T!?L#3=; z()Q}R^_J$=k}S2J*wv!9?ACYfQ2bjv48o{ts&U~#_|Jj&r#r0#VfQodKX>!>;?p(l zG*ritTYg1#{J8m*g2$Pg4+-usH@`}7KfC#x1dk^-52KUjjhkOBw3_@H(NdESSI=L# z?KBFWhi)E>Xii4ugJNxUf4#Fd2s^(gYRcatcwW2Z*H`DWn}^v~WBdiht=0MGmft8u z%*m*H5N30vCeL@9MID@H_2Nopkx@CkZ`Fyg$a~@mJ1`{wgonSKc)kxRD?;1_85p(I z_VB#!mi*E<;O2Yu%lB2bGb!bl#uNV^tJVIerF=w0G{`{W``UTP2VhWb*N_$9Nu}lD z@Jpx;K>w!j0zIjg-``1@TbA_iRp0~I3QzyON%G!t5|)8lI^J#vK2T#k{0#Uyv2?!N z1^ha=%8T@S!@mzbz-!XC`|GsimyWAp;3HyVwI5k44*a^hrSs_H$g_|G%VftpZode; z=8)s;*MMJJw^8u@l=<%<4=rLP`gss%fye93)Ad@U@H$`w#$i*8Ehv1HL1CQy=YixWtj@u~PH>dYScP~;uRfg53-hCWt!?S-NX~Tp z$&GAOlJE~VSnfU?KaemJ2fIu-W#YD-5@y#&4#p4kcDifiaTcK99FLhW$b!*zSeQM1 zhdSbY=ArKHBZ+>qKi<)oK&$c)%y6+Juks%sd$CeUJIN}G=VoFt*TESRrPSdVkaeGw zF;m5yIhM?(@Dxq&A&^R?vu3Gi!R0Kr1cM0Wp<=Pu+k}_pevj0AXp9As>30={wNfn-hw zUbn_*tc|5WpG!(#4LYU4c`%+FPY*+Lu-|lur_f=*kHaAL&Ypj{jO%TfqHyn2iPu+* zyxyj2Da(1pcftqP#H`QjFh&jPoQc=L%(X$rsXs{TGRAEzNXYj&rh7g5ysl%^Sdh@G ze=qQVfi*R^pPwTb*+0IQ!sKm#5;%N@V10hhU_66LknkEY&aBVR2WjB&l3AbElZ^bF z0wOY@4QKi!6!4jW^?BXN$j@KgewJfA0s8n1!ew5cGHT?^+kT?OG-NQQtk3IM#u*Z1 z|K98W64c{0aXtQ|$wbJ{gTzW-oJaf$e4P3k=`pf7*5NYalOBCuKQpr2a{Ax&=*LKb z5r4m($!qW19(`VqGxGB?+whLx?~^{qUuYyri1W*ty#9X-mDohqk7`Pq@orVDetZ4@ z9BQ2U6PglboU3Z84EI0Nzk&>|LHTiv*MWS#)+^6t##cbM(V@@(6U;XQ35n%YX|c@w z8&H8`kNsEIr@GRZq5i}1kBRj-j$a23MOdHzCzzpyR1E5ziS-%hq0*@@VkF(7ko^!_ z_0Q!6$e=Cu&+D%U>9Ze}r_14@2m*l|iC1~nzq87y4C_0Q$Bt7p#s+C(<2=TYa(npx hhyRyw+g>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if !defined(__STDC__) +# if (defined(_MSC_VER) && !defined(__clang__)) \ + || (defined(__ibmxl__) || defined(__IBMC__)) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif +#elif __STDC_VERSION__ >= 201000L +# define C_DIALECT "11" +#elif __STDC_VERSION__ >= 199901L +# define C_DIALECT "99" +#else +# define C_DIALECT "90" +#endif +const char* info_language_dialect_default = + "INFO" ":" "dialect_default[" C_DIALECT "]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/example/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/example/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..69cfdba --- /dev/null +++ b/example/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,660 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} diff --git a/example/build/CMakeFiles/CMakeDirectoryInformation.cmake b/example/build/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..039319f --- /dev/null +++ b/example/build/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/linyuchen/code_ws/odrive_bridge/example") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/linyuchen/code_ws/odrive_bridge/example/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/example/build/CMakeFiles/CMakeOutput.log b/example/build/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..57ae4be --- /dev/null +++ b/example/build/CMakeFiles/CMakeOutput.log @@ -0,0 +1,461 @@ +The system is: Linux - 5.15.167.4-microsoft-standard-WSL2 - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/3.16.3/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out" + +Determining if the C compiler works passed with the following output: +Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_14abb/fast && /usr/bin/make -f CMakeFiles/cmTC_14abb.dir/build.make CMakeFiles/cmTC_14abb.dir/build +make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_14abb.dir/testCCompiler.c.o +/usr/bin/cc -o CMakeFiles/cmTC_14abb.dir/testCCompiler.c.o -c /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp/testCCompiler.c +Linking C executable cmTC_14abb +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_14abb.dir/link.txt --verbose=1 +/usr/bin/cc CMakeFiles/cmTC_14abb.dir/testCCompiler.c.o -o cmTC_14abb +make[1]: Leaving directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' + + + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_0653c/fast && /usr/bin/make -f CMakeFiles/cmTC_0653c.dir/build.make CMakeFiles/cmTC_0653c.dir/build +make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccRrChbB.s +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 01da938ff5dc2163489aa33cb3b747a7 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o /tmp/ccRrChbB.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' +Linking C executable cmTC_0653c +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0653c.dir/link.txt --verbose=1 +/usr/bin/cc -v CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -o cmTC_0653c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_0653c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccPtMHq5.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_0653c /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_0653c' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_0653c/fast && /usr/bin/make -f CMakeFiles/cmTC_0653c.dir/build.make CMakeFiles/cmTC_0653c.dir/build] + ignore line: [make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp'] + ignore line: [Building C object CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccRrChbB.s] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 01da938ff5dc2163489aa33cb3b747a7] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o /tmp/ccRrChbB.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [Linking C executable cmTC_0653c] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0653c.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -o cmTC_0653c ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_0653c' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccPtMHq5.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_0653c /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccPtMHq5.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_0653c] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_0653c.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Determining if the CXX compiler works passed with the following output: +Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_50746/fast && /usr/bin/make -f CMakeFiles/cmTC_50746.dir/build.make CMakeFiles/cmTC_50746.dir/build +make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_50746.dir/testCXXCompiler.cxx.o +/usr/bin/c++ -o CMakeFiles/cmTC_50746.dir/testCXXCompiler.cxx.o -c /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx +Linking CXX executable cmTC_50746 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_50746.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/cmTC_50746.dir/testCXXCompiler.cxx.o -o cmTC_50746 +make[1]: Leaving directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' + + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_6a2f9/fast && /usr/bin/make -f CMakeFiles/cmTC_6a2f9.dir/build.make CMakeFiles/cmTC_6a2f9.dir/build +make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccYLLBND.s +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/9 + /usr/include/x86_64-linux-gnu/c++/9 + /usr/include/c++/9/backward + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 3d1eba838554fa2348dba760e4770469 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccYLLBND.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +Linking CXX executable cmTC_6a2f9 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6a2f9.dir/link.txt --verbose=1 +/usr/bin/c++ -v CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_6a2f9 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6a2f9' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccvLUwR6.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_6a2f9 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6a2f9' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/9] + add: [/usr/include/x86_64-linux-gnu/c++/9] + add: [/usr/include/c++/9/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/9] ==> [/usr/include/c++/9] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/9] ==> [/usr/include/x86_64-linux-gnu/c++/9] + collapse include dir [/usr/include/c++/9/backward] ==> [/usr/include/c++/9/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_6a2f9/fast && /usr/bin/make -f CMakeFiles/cmTC_6a2f9.dir/build.make CMakeFiles/cmTC_6a2f9.dir/build] + ignore line: [make[1]: Entering directory '/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/CMakeTmp'] + ignore line: [Building CXX object CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccYLLBND.s] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/9] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/9] + ignore line: [ /usr/include/c++/9/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 3d1eba838554fa2348dba760e4770469] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccYLLBND.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [Linking CXX executable cmTC_6a2f9] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6a2f9.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_6a2f9 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6a2f9' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccvLUwR6.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_6a2f9 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccvLUwR6.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_6a2f9] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_6a2f9.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + diff --git a/example/build/CMakeFiles/Makefile.cmake b/example/build/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..1cc42e0 --- /dev/null +++ b/example/build/CMakeFiles/Makefile.cmake @@ -0,0 +1,49 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "../CMakeLists.txt" + "CMakeFiles/3.16.3/CMakeCCompiler.cmake" + "CMakeFiles/3.16.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.16.3/CMakeSystem.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.16/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.16/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.16/Modules/Internal/CMakeCheckCompilerFlag.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.16/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "CMakeFiles/exec.dir/DependInfo.cmake" + ) diff --git a/example/build/CMakeFiles/Makefile2 b/example/build/CMakeFiles/Makefile2 new file mode 100644 index 0000000..8640a8c --- /dev/null +++ b/example/build/CMakeFiles/Makefile2 @@ -0,0 +1,106 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/linyuchen/code_ws/odrive_bridge/example + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/linyuchen/code_ws/odrive_bridge/example/build + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: CMakeFiles/exec.dir/all + +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: + +.PHONY : preinstall + +# The main recursive "clean" target. +clean: CMakeFiles/exec.dir/clean + +.PHONY : clean + +#============================================================================= +# Target rules for target CMakeFiles/exec.dir + +# All Build rule for target. +CMakeFiles/exec.dir/all: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/depend + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles --progress-num=1,2 "Built target exec" +.PHONY : CMakeFiles/exec.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/exec.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles 2 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/exec.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles 0 +.PHONY : CMakeFiles/exec.dir/rule + +# Convenience name for target. +exec: CMakeFiles/exec.dir/rule + +.PHONY : exec + +# clean rule for target. +CMakeFiles/exec.dir/clean: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/clean +.PHONY : CMakeFiles/exec.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/example/build/CMakeFiles/TargetDirectories.txt b/example/build/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..84da747 --- /dev/null +++ b/example/build/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,3 @@ +/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/rebuild_cache.dir +/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/edit_cache.dir +/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/exec.dir diff --git a/example/build/CMakeFiles/cmake.check_cache b/example/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/example/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/example/build/CMakeFiles/exec.dir/CXX.includecache b/example/build/CMakeFiles/exec.dir/CXX.includecache new file mode 100644 index 0000000..66cba78 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/CXX.includecache @@ -0,0 +1,30 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +../lib/odrive/include/can_simple.hpp +stdint.h +- + +../lib/odrive/include/utils.hpp +stdint.h +- +array +- +algorithm +- +can_simple.hpp +../lib/odrive/include/can_simple.hpp + +/home/linyuchen/code_ws/odrive_bridge/example/main.cpp +iostream +- +string.h +- +utils.hpp +/home/linyuchen/code_ws/odrive_bridge/example/utils.hpp + diff --git a/example/build/CMakeFiles/exec.dir/DependInfo.cmake b/example/build/CMakeFiles/exec.dir/DependInfo.cmake new file mode 100644 index 0000000..6cefaba --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/DependInfo.cmake @@ -0,0 +1,21 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/linyuchen/code_ws/odrive_bridge/example/main.cpp" "/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/exec.dir/main.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "../lib/odrive/include" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/example/build/CMakeFiles/exec.dir/build.make b/example/build/CMakeFiles/exec.dir/build.make new file mode 100644 index 0000000..647cc26 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/build.make @@ -0,0 +1,99 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/linyuchen/code_ws/odrive_bridge/example + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/linyuchen/code_ws/odrive_bridge/example/build + +# Include any dependencies generated for this target. +include CMakeFiles/exec.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/exec.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/exec.dir/flags.make + +CMakeFiles/exec.dir/main.cpp.o: CMakeFiles/exec.dir/flags.make +CMakeFiles/exec.dir/main.cpp.o: ../main.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/exec.dir/main.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/exec.dir/main.cpp.o -c /home/linyuchen/code_ws/odrive_bridge/example/main.cpp + +CMakeFiles/exec.dir/main.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/exec.dir/main.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/linyuchen/code_ws/odrive_bridge/example/main.cpp > CMakeFiles/exec.dir/main.cpp.i + +CMakeFiles/exec.dir/main.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/exec.dir/main.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/linyuchen/code_ws/odrive_bridge/example/main.cpp -o CMakeFiles/exec.dir/main.cpp.s + +# Object files for target exec +exec_OBJECTS = \ +"CMakeFiles/exec.dir/main.cpp.o" + +# External object files for target exec +exec_EXTERNAL_OBJECTS = + +exec: CMakeFiles/exec.dir/main.cpp.o +exec: CMakeFiles/exec.dir/build.make +exec: ../lib/odrive/lib/libOdrive.a +exec: CMakeFiles/exec.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable exec" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/exec.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/exec.dir/build: exec + +.PHONY : CMakeFiles/exec.dir/build + +CMakeFiles/exec.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/exec.dir/cmake_clean.cmake +.PHONY : CMakeFiles/exec.dir/clean + +CMakeFiles/exec.dir/depend: + cd /home/linyuchen/code_ws/odrive_bridge/example/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/linyuchen/code_ws/odrive_bridge/example /home/linyuchen/code_ws/odrive_bridge/example /home/linyuchen/code_ws/odrive_bridge/example/build /home/linyuchen/code_ws/odrive_bridge/example/build /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/exec.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/exec.dir/depend + diff --git a/example/build/CMakeFiles/exec.dir/cmake_clean.cmake b/example/build/CMakeFiles/exec.dir/cmake_clean.cmake new file mode 100644 index 0000000..c4ccab9 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/cmake_clean.cmake @@ -0,0 +1,10 @@ +file(REMOVE_RECURSE + "CMakeFiles/exec.dir/main.cpp.o" + "exec" + "exec.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/exec.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/example/build/CMakeFiles/exec.dir/depend.internal b/example/build/CMakeFiles/exec.dir/depend.internal new file mode 100644 index 0000000..25c97c4 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/depend.internal @@ -0,0 +1,7 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/exec.dir/main.cpp.o + ../lib/odrive/include/can_simple.hpp + ../lib/odrive/include/utils.hpp + /home/linyuchen/code_ws/odrive_bridge/example/main.cpp diff --git a/example/build/CMakeFiles/exec.dir/depend.make b/example/build/CMakeFiles/exec.dir/depend.make new file mode 100644 index 0000000..03845af --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/depend.make @@ -0,0 +1,7 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/exec.dir/main.cpp.o: ../lib/odrive/include/can_simple.hpp +CMakeFiles/exec.dir/main.cpp.o: ../lib/odrive/include/utils.hpp +CMakeFiles/exec.dir/main.cpp.o: ../main.cpp + diff --git a/example/build/CMakeFiles/exec.dir/flags.make b/example/build/CMakeFiles/exec.dir/flags.make new file mode 100644 index 0000000..0ba24a3 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -isystem /home/linyuchen/code_ws/odrive_bridge/example/lib/odrive/include + diff --git a/example/build/CMakeFiles/exec.dir/link.txt b/example/build/CMakeFiles/exec.dir/link.txt new file mode 100644 index 0000000..2abb3e0 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/exec.dir/main.cpp.o -o exec ../lib/odrive/lib/libOdrive.a diff --git a/example/build/CMakeFiles/exec.dir/progress.make b/example/build/CMakeFiles/exec.dir/progress.make new file mode 100644 index 0000000..abadeb0 --- /dev/null +++ b/example/build/CMakeFiles/exec.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 + diff --git a/example/build/CMakeFiles/progress.marks b/example/build/CMakeFiles/progress.marks new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/example/build/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/example/build/Makefile b/example/build/Makefile new file mode 100644 index 0000000..52fcc52 --- /dev/null +++ b/example/build/Makefile @@ -0,0 +1,178 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/linyuchen/code_ws/odrive_bridge/example + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/linyuchen/code_ws/odrive_bridge/example/build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +.PHONY : rebuild_cache/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +.PHONY : edit_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles/progress.marks + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/linyuchen/code_ws/odrive_bridge/example/build/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean + +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named exec + +# Build rule for target. +exec: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 exec +.PHONY : exec + +# fast build rule for target. +exec/fast: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/build +.PHONY : exec/fast + +main.o: main.cpp.o + +.PHONY : main.o + +# target to build an object file +main.cpp.o: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/main.cpp.o +.PHONY : main.cpp.o + +main.i: main.cpp.i + +.PHONY : main.i + +# target to preprocess a source file +main.cpp.i: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/main.cpp.i +.PHONY : main.cpp.i + +main.s: main.cpp.s + +.PHONY : main.s + +# target to generate assembly for a file +main.cpp.s: + $(MAKE) -f CMakeFiles/exec.dir/build.make CMakeFiles/exec.dir/main.cpp.s +.PHONY : main.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... rebuild_cache" + @echo "... edit_cache" + @echo "... exec" + @echo "... main.o" + @echo "... main.i" + @echo "... main.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/example/build/cmake_install.cmake b/example/build/cmake_install.cmake new file mode 100644 index 0000000..7abc683 --- /dev/null +++ b/example/build/cmake_install.cmake @@ -0,0 +1,49 @@ +# Install script for directory: /home/linyuchen/code_ws/odrive_bridge/example + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/linyuchen/code_ws/odrive_bridge/example/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/example/build/exec b/example/build/exec new file mode 100755 index 0000000000000000000000000000000000000000..20300152f32511f13069c929894f390d3d6b1e43 GIT binary patch literal 19056 zcmeHPe{@^beZRKj*g%k#kPwqVqw(XAKq4f^F-{|o*;7!Y1$Nsa}!WTdCy za2gio(pty3Gjv_qO1p5@p0bs7;dDzOJAgwdq#dJSC!=A|;c^0XhDRL}z*_^_=X>A% zK0Q6lz~StVoy|8#{@(BB`{UmGy+7W2_r04x3^X^DmXruiW#ab*alZKm;!}eC8&w9x zC+fwy_`6JeNz4U5M`DKDXAnq@biA~XRw}#%5t+jmmwE6dQ?@0snw2RvtyNEw_|-F-LK*@rP|MS1e0B#vg=cJ zOog&z%JHOX(63(kvr`vjlw9(!5O%wpm7Se7Dt)F@2Bo&Q_2?HVuT|OYcS$$GPLCO| zV9Mp)06U7y=S|$rTUB{8^}{|DPo~u0l&(R)SSJD`%6PmWOCz;UFdN`$Pn$SYqTC`{^726q4>#@|fmWJ+RBDO8u(H%2n#U;0F zX-jse1973LT#uR4Wlpb;C(~L-I324ECE|LcH?RwMo8Fxcwdr1Oq$`}#^i(*mr$doI zU@NfIP>x5mWLi(f!abqLHZ9P$Mr++1Ddw+%{nbX28KXq1PiqrAnI*S*w17bKBiwQ{ zI&!BL>AF+v49B|>ib!8r3+u7II9y1kGoA={$L~SgH8NCT>IugaVpDTyV}n-Xt~GNt z?lngK=9{(Ez>!MvuMEFAGDma7n0E$B8YPg>M4|EE!Ea$aelD$$A%$g@#LptDHr0P6 zP^K*DQ_@#Fge9_6XiCoOH?Ny6HE6oj`pkH6kzwC!!$;Niw9;qDS)ci%8w{N0IL~cD zj$3e4*i54qTwS`PY|Mh6V`>XAVZrBF@F@$90GWx$H?40~CMv|R(ysufLL;RQTX5Q#(&?&f5*mu)5Z^3dGCLOvaj48%)S-u zKQYm|t$C>Y0B$*gL+5UgWc?vjKes3alheb&q4j@;OmL|DAtGz1^hF5$7Rn>^XXQq# zmhFYQIIJl2<5GW32ay$@1hW&tL+@<}9-1l(mb?&r+^zx>*vC3?5{q_<;J22?hEDXp;xjUwr2TcfAVe!Dbo%+ z3>H^3I5_9B<cA((w}tQ0+3^^?E}WG_dyGaGmd>|0>3GuU^6 zLu;PK{U(}s5EUAWp$>pbF*3-$j@ayT(&mL=_LpNBLw*1wiR9-S>@aztG7Prga2O|t z3zdfhfp@A7jAW$~pP`mgR;NBT3ONw?jj3{xp>nlSc^N8qRNhhHe~N~r|4ACCPtoW- zNJIJ=8t2bao5!Z8;{DG%gW14Xa1cM#>YLC8KY?~t7&ZIFN~qpL#SX1mteUdfsD)u9 ztGU8Z_&L0jn=1_Vd$?;S_8KK6c4++`^0?e^QFS0NVK!u&q4u=0DmPV5nJQjGWuH=c z>kNlu(o}I6Dtna5v!=@Xrpmj74XwFNsXSt;oHkXC7%EpQmEESw2d2vR4V8sTtfw;Q!RfjboFjqkbB%)m z=ir{|!4{WqAai=4ePSRm-k3c)5EyIB9vKLnXv~fbphZ&yfj5XhPR^?iw4WYus@%jt zYl+H^546g#LOwRoTBgtw1FdsZc66Y%TxH)FXq~IF#|K&~hPNNiN0#b#Dtk2h^8u8D z1)*4xFyH~%ncedVCi5rPZrD}vBwCt#cM-7|=7&bhu__)2e5sz_F?W zdyXTs{SEwS9|e4ZdZFq-W*qgJpj#II4gS`f0@>FB*`rj+Nm{G=pLa41P5-VK|Ekti^ z4e#zwhNIhEt$0hMjPjteS?6j^CH3Tbm<4ZIFWjI_pm;i6T6PV+8@>R)-rweOmGt;E zk;{2NouEO`VNkk8?>?2wx$u~^`E)L~7xZD!eV|W(?ttElgoFNyaM0g^j)1y8$mK>s zw}R4Zq$fdLpeI0mpiW$7cYr<)x)<~f(0!l|T(U<%zX3W5+DOk4D6a$52l^w>9iS7S zBcMC}6ZNO3NhEq#OsV9at)isQS+aCqMddK+KsbE^@i5v-5AmY0LcXH96j{2%+3_A8 zKL~d?n;g~GRh@HpAx#4pNDqWe~Nr1 zg|8dAK#aQuJHh)9n;`dF<$Zbok3)VKbF9TGFKsmKUxIuBa+;%N z`K^Y1BcO4}m&1RI0*>Vmls7s&U!5Ct)c03xa`+OCdcVWt zcP!uNaBXx{Z*({}Ix6LR+FHz^R`{V^nb|ZOf!PSmMqoAqvk{n$z-$Emw?u%y6XWl~ z_&YG%0?K5kLILx*0qUk5FOX!aUSd#rZ-p#>m$uY^&F|Ngn&9uy=)R8<-NRG*;FDaE z=sw&-QQ~{3pvv$!R!5YazcIU0)sMd|t2WGq`s__{{5>ANW8PpuxaE^+L{WPFpv2#7 zEjC!;Q59r-xyo?8l8D*3-t zay*(zUOk?v+WpTF^LuWaOONVrpQ5db?ohN>(Y=ZeE4oino4e1=R{9LpO$`m}T+7=# zG6_B7TI;TLdscZflJnkM<8gax-8Cx={Igw`VK7&#@nhAdFE{!7^g_H$@b~A1_#E-& zqJGNF@mr`rSMazk#47}k??Sv%aK9JgX9*rJh4|Tm$7LaYjyZk{am?l-{Zoch6t1GU zL+me#SBa6LxYInZQCRML!RtjKjwf@M6*2N<;ym+ve5qMbGRym&)G4f@W@2{=WGQq209;M}KjyPrPW#wT(>uV`GrB{8I z%OZ!u_t|i2KI!xN&H7g(Q-b=m`VEB2qtt|7Ns&1804G0uT_9abyYVZ*D$47*1o7u# z{EF58QK`Q~++Ztrzr+^^rwbV*uFuOdzd+1)5t_%xWqyHJ;371S(|7G9_%i-HmxN6} zw9iKPLK}XA!p~PYud4}#SKIWzrtk}F_+Kh~iOtW`3ct{%|Ej`W3g_$GByfuJ@6?4x z?o|kU(~pV~&evnUjzYa?oa>-pg7N;7;tWI(>zLca)!_ z>O${T;u5UOhpEr^GV_|6#07m9qC6I zTZmV-%PCeUXL1h=@~6m8=>>wXb8Pa0^y3tNVQbf~6@Hs)mq!_#jS5hEhm=0o`QLEg zu%LAMdV8_bx5vK~INNevh<*!k!|XNJ^Q)Bbjv4g-b_V<(fm3^(KIK4>UjnE4Kcm`p zzrx>B_-S=R#rIQ7P#@B7Q1}x{f3w27)VNxy@Er;dtN19fxCeN#b2ASDr}1VVC*9~r zC)U-Qd4MSY->SEpll1!k7^hEp?3*Fvgg5})c} zO5)U>F5?X9B&IJ zqBzxtqhy(gNRx-UG_7f?za^jrwlvaVI1Q&AwLnmT!N#pZ zYy5*P{+3V!WCdLtEd=CoIJ$h$%cxSpz7L)IYAj>Z#O zCLN<#(MdZ#T&GlVmX1!)VP2+_S{HhZjvS(W$*rH=K5L^WdT3`|Lr=6N+)GVt(<4bb zQCJWn;GfmTh8jyhSPlo;D*VNcG1>w|1J`mGF<(S2B7$R>JS1<~V(HbWd~qF+tA}+= z)zqp!oi?-rvd;>1Yh>?F*R%}5HhndUvYw@sQ4J@iMO6;GHeDXWw6~B(EHyKQ`f45N zH0LqG^M^F$@lZO>X}6Z=FC*!UoOjfD`8X8xKKiV%_Y1tIV|r&`daXS)U%d4)62=6e zsel>rIp#sn*3H}Gbd&Q`x7C|Z#@gUdJ7!B`J~h3LD8o2}Nx54V>x@%|K3etuM9smpnym*9t6Bh#Muv6#9bvnJk; zWULMutNqP*&Y;BfQiC=B;HR?bYLhhy$Z0vpw&}G3EVbsK}(;F)Qvuj`nWZp7-sT zx|Al@pY@pD3pwotGtc{bOk0&b$C&G{U@?RY#gy%NACM{UPjmTf&+Y$~vfrp2@_skd z5rvaI+1TwL1x7Jp|G0HGlA`tNTI)PHQh-(^Uc9y3_;uf6=&A+g%?zAV$AT2I)4EgbUy{h&QgR^xpn{{K|e7@B{S*pBPQfsf z17u`LY|nHqjIH* + +namespace CanHeader { + constexpr uint8_t broadcastNodeId = 0x3f; + constexpr uint16_t headerBound = 0x7ff; + constexpr uint8_t cmdBound = 0x1f; + constexpr uint8_t errorCode8 = static_cast(-1); + constexpr uint16_t errCode16 = static_cast(-1); + + /// @todo: Support Beacon Message for auto buad + constexpr bool autoBuad = false; + + enum class CmdMap : uint8_t { + Get_Version = 0x000, + Heartbeat = 0x001, + Estop = 0x002, + Get_Error = 0x003, + RxSdo = 0x004, + TxSdo = 0x005, + Address = 0x006, + Set_Axis_State = 0x007, + Get_Encoder_Estimates = 0x009, + Set_Controller_Mode = 0x00b, + Set_Input_Pos = 0x00c, + Set_Input_Vel = 0x00d, + Set_Input_Torque = 0x00e, + Set_Limits = 0x00f, + Set_Traj_Vel_Limit = 0x011, + Set_Traj_Accel_Limits = 0x012, + Set_Traj_Inertia = 0x013, + Get_Iq = 0x014, + Get_Temperature = 0x015, + Reboot = 0x016, + Get_Bus_Voltage_Current = 0x017, + Clear_Errors = 0x018, + Set_Absolute_Position = 0x019, + Set_Pos_Gain = 0x01a, + Set_Vel_Gains = 0x01b, + Get_Torques = 0x01c, + Get_Powers = 0x01d, + Enter_DFU_Mode = 0x01f + }; + + constexpr std::array valid_cmds = { + CmdMap::Get_Version, + CmdMap::Heartbeat, + CmdMap::Estop, + CmdMap::Get_Error, + CmdMap::RxSdo, + CmdMap::TxSdo, + CmdMap::Address, + CmdMap::Set_Axis_State, + CmdMap::Get_Encoder_Estimates, + CmdMap::Set_Controller_Mode, + CmdMap::Set_Input_Pos, + CmdMap::Set_Input_Vel, + CmdMap::Set_Input_Torque, + CmdMap::Set_Limits, + CmdMap::Set_Traj_Vel_Limit, + CmdMap::Set_Traj_Accel_Limits, + CmdMap::Set_Traj_Inertia, + CmdMap::Get_Iq, + CmdMap::Get_Temperature, + CmdMap::Reboot, + CmdMap::Get_Bus_Voltage_Current, + CmdMap::Clear_Errors, + CmdMap::Set_Absolute_Position, + CmdMap::Set_Pos_Gain, + CmdMap::Set_Vel_Gains, + CmdMap::Get_Torques, + CmdMap::Get_Powers, + CmdMap::Enter_DFU_Mode + }; +} + + + +namespace CanPayload { + #pragma pack(push, 1) + struct GetVersionPayload { + uint8_t protocol_version; + uint8_t hw_version_major; + uint8_t hw_version_minor; + uint8_t hw_version_variant; + uint8_t fw_version_major; + uint8_t fw_version_minor; + uint8_t fw_version_revision; + uint8_t fw_version_unreleased; + + GetVersionPayload() = default; + GetVersionPayload(uint8_t proto, uint8_t hw_maj, uint8_t hw_min, uint8_t hw_var, + uint8_t fw_maj, uint8_t fw_min, uint8_t fw_rev, uint8_t fw_unrel) + : protocol_version(proto), hw_version_major(hw_maj), hw_version_minor(hw_min), + hw_version_variant(hw_var), fw_version_major(fw_maj), fw_version_minor(fw_min), + fw_version_revision(fw_rev), fw_version_unreleased(fw_unrel) {} + }; + + struct HeartbeatPayload { + uint32_t axis_error{}; + uint8_t axis_state{}; + uint8_t procedure_result{}; + uint8_t trajectory_done{}; + uint8_t reserved{}; + + HeartbeatPayload() = default; + HeartbeatPayload(uint32_t err, uint8_t state, uint8_t result, uint8_t done, uint8_t res) + : axis_error(err), axis_state(state), procedure_result(result), trajectory_done(done), reserved(res) {} + }; + + struct GetErrorPayload { + uint32_t active_errors{}; + uint32_t disarm_reason{}; + + GetErrorPayload() = default; + GetErrorPayload(uint32_t errors, uint32_t reason) + : active_errors(errors), disarm_reason(reason) {} + }; + + struct RxSdoPayload { + uint8_t opcode{}; + uint16_t endpoint_id{}; + uint8_t reserved{}; + uint32_t value{}; + + RxSdoPayload() = default; + RxSdoPayload(uint8_t op, uint16_t ep, uint8_t res, uint32_t val) + : opcode(op), endpoint_id(ep), reserved(res), value(val) {} + }; + + struct TxSdoPayload { + uint8_t reserved0{}; + uint16_t endpoint_id{}; + uint8_t reserved1{}; + uint32_t value{}; + + TxSdoPayload() = default; + TxSdoPayload(uint8_t res0, uint16_t ep, uint8_t res1, uint32_t val) + : reserved0(res0), endpoint_id(ep), reserved1(res1), value(val) {} + }; + + struct AddressPayload { + uint8_t node_id{}; + uint32_t serial_number_start{}; + uint16_t serial_number_end{}; + uint8_t connection_id{}; + + AddressPayload() = default; + AddressPayload(uint8_t nid, uint32_t sn_start, uint16_t sn_end, uint8_t conn_id) + : node_id(nid), serial_number_start(sn_start), serial_number_end(sn_end), connection_id(conn_id) {} + }; + + struct EncoderEstimatesPayload { + float pos_estimate{}; + float vel_estimate{}; + + EncoderEstimatesPayload() = default; + EncoderEstimatesPayload(float pos, float vel) : pos_estimate(pos), vel_estimate(vel) {} + }; + + struct GetIqPayload { + float iq_setpoint{}; + float iq_measured{}; + + GetIqPayload() = default; + GetIqPayload(float set, float meas) : iq_setpoint(set), iq_measured(meas) {} + }; + + struct GetTemperaturePayload { + float fet_temperature{}; + float motor_temperature{}; + + GetTemperaturePayload() = default; + GetTemperaturePayload(float fet, float motor) : fet_temperature(fet), motor_temperature(motor) {} + }; + + struct BusVoltageCurrentPayload { + float bus_voltage{}; + float bus_current{}; + + BusVoltageCurrentPayload() = default; + BusVoltageCurrentPayload(float volt, float curr) : bus_voltage(volt), bus_current(curr) {} + }; + + struct GetTorquesPayload { + float torque_target{}; + float torque_estimate{}; + + GetTorquesPayload() = default; + GetTorquesPayload(float tgt, float est) : torque_target(tgt), torque_estimate(est) {} + }; + + struct GetPowersPayload { + float electrical_power{}; + float mechanical_power{}; + + GetPowersPayload() = default; + GetPowersPayload(float elec, float mech) : electrical_power(elec), mechanical_power(mech) {} + }; + + struct SetAxisStatePayload { + uint32_t axis_requested_state{}; + uint32_t reserved{}; + + SetAxisStatePayload() = default; + SetAxisStatePayload(uint32_t req, uint32_t res) : axis_requested_state(req), reserved(res) {} + }; + + struct SetControllerModePayload { + uint8_t control_mode{}; + uint8_t input_mode{}; + uint16_t reserved0{}; + uint32_t reserved1{}; + + SetControllerModePayload() = default; + SetControllerModePayload(uint8_t ctrl, uint8_t input, uint16_t res0, uint32_t res1) + : control_mode(ctrl), input_mode(input), reserved0(res0), reserved1(res1) {} + }; + + struct SetInputPosPayload { + float input_pos{}; + int16_t vel_ff{}; + int16_t torque_ff{}; + + SetInputPosPayload() = default; + SetInputPosPayload(float pos, int16_t vff, int16_t tff) : input_pos(pos), vel_ff(vff), torque_ff(tff) {} + }; + + struct SetInputVelPayload { + float input_vel{}; + float input_torque_ff{}; + + SetInputVelPayload() = default; + SetInputVelPayload(float vel, float torque_ff) : input_vel(vel), input_torque_ff(torque_ff) {} + }; + + struct SetInputTorquePayload { + float input_torque{}; + uint32_t reserved{}; + + SetInputTorquePayload() = default; + SetInputTorquePayload(float torque, uint32_t res) : input_torque(torque), reserved(res) {} + }; + + struct SetLimitsPayload { + float velocity_limit{}; + float current_limit{}; + + SetLimitsPayload() = default; + SetLimitsPayload(float vel, float curr) : velocity_limit(vel), current_limit(curr) {} + }; + + struct SetTrajVelLimitPayload { + float traj_vel_limit{}; + uint32_t reserved{}; + + SetTrajVelLimitPayload() = default; + SetTrajVelLimitPayload(float vel, uint32_t res) : traj_vel_limit(vel), reserved(res) {} + }; + + struct SetTrajAccelLimitsPayload { + float traj_accel_limit{}; + float traj_decel_limit{}; + + SetTrajAccelLimitsPayload() = default; + SetTrajAccelLimitsPayload(float accel, float decel) : traj_accel_limit(accel), traj_decel_limit(decel) {} + }; + + struct SetTrajInertiaPayload { + float traj_inertia{}; + uint32_t reserved{}; + + SetTrajInertiaPayload() = default; + SetTrajInertiaPayload(float inertia, uint32_t res) : traj_inertia(inertia), reserved(res) {} + }; + + struct RebootPayload { + uint8_t action{}; + uint8_t reserved1{}; + uint16_t reserved2{}; + uint32_t reserved3{}; + + RebootPayload() = default; + RebootPayload(uint8_t act, uint8_t r1, uint16_t r2, uint32_t r3) + : action(act), reserved1(r1), reserved2(r2), reserved3(r3) {} + }; + + struct ClearErrorsPayload { + uint32_t identify{}; + uint32_t reserved{}; + + ClearErrorsPayload() = default; + ClearErrorsPayload(uint32_t id, uint32_t res) : identify(id), reserved(res) {} + }; + + struct SetAbsolutePositionPayload { + float position{}; + uint32_t reserved{}; + + SetAbsolutePositionPayload() = default; + SetAbsolutePositionPayload(float pos, uint32_t res) : position(pos), reserved(res) {} + }; + + struct SetPosGainPayload { + float pos_gain{}; + uint32_t reserved{}; + + SetPosGainPayload() = default; + SetPosGainPayload(float gain, uint32_t res) : pos_gain(gain), reserved(res) {} + }; + + struct SetVelGainsPayload { + float vel_gain{}; + float vel_integrator_gain{}; + + SetVelGainsPayload() = default; + SetVelGainsPayload(float gain, float igain) : vel_gain(gain), vel_integrator_gain(igain) {} + }; + #pragma pack(pop) + + // Compile-time check that all CAN payloads are == 8 bytes + static_assert(sizeof(GetVersionPayload) == 8, "GetVersionPayload too large"); + static_assert(sizeof(HeartbeatPayload) == 8, "HeartbeatPayload too large"); + static_assert(sizeof(GetErrorPayload) == 8, "GetErrorPayload too large"); + static_assert(sizeof(RxSdoPayload) == 8, "RxSdoPayload too large"); + static_assert(sizeof(TxSdoPayload) == 8, "TxSdoPayload too large"); + static_assert(sizeof(AddressPayload) == 8, "AddressPayload too large"); + static_assert(sizeof(EncoderEstimatesPayload) == 8, "EncoderEstimatesPayload too large"); + static_assert(sizeof(GetIqPayload) == 8, "GetIqPayload too large"); + static_assert(sizeof(GetTemperaturePayload) == 8, "GetTemperaturePayload too large"); + static_assert(sizeof(BusVoltageCurrentPayload) == 8, "BusVoltageCurrentPayload too large"); + static_assert(sizeof(GetTorquesPayload) == 8, "GetTorquesPayload too large"); + static_assert(sizeof(GetPowersPayload) == 8, "GetPowersPayload too large"); + static_assert(sizeof(SetAxisStatePayload) == 8, "SetAxisStatePayload too large"); + static_assert(sizeof(SetControllerModePayload) == 8, "SetControllerModePayload too large"); + static_assert(sizeof(SetInputPosPayload) == 8, "SetInputPosPayload too large"); + static_assert(sizeof(SetInputVelPayload) == 8, "SetInputVelPayload too large"); + static_assert(sizeof(SetInputTorquePayload) == 8, "SetInputTorquePayload too large"); + static_assert(sizeof(SetLimitsPayload) == 8, "SetLimitsPayload too large"); + static_assert(sizeof(SetTrajVelLimitPayload) == 8, "SetTrajVelLimitPayload too large"); + static_assert(sizeof(SetTrajAccelLimitsPayload) == 8, "SetTrajAccelLimitsPayload too large"); + static_assert(sizeof(SetTrajInertiaPayload) == 8, "SetTrajInertiaPayload too large"); + static_assert(sizeof(RebootPayload) == 8, "RebootPayload too large"); + static_assert(sizeof(ClearErrorsPayload) == 8, "ClearErrorsPayload too large"); + static_assert(sizeof(SetAbsolutePositionPayload) == 8, "SetAbsolutePositionPayload too large"); + static_assert(sizeof(SetPosGainPayload) == 8, "SetPosGainPayload too large"); + static_assert(sizeof(SetVelGainsPayload) == 8, "SetVelGainsPayload too large"); +} \ No newline at end of file diff --git a/example/lib/odrive/include/gmock/gmock-actions.h b/example/lib/odrive/include/gmock/gmock-actions.h new file mode 100644 index 0000000..aad07d5 --- /dev/null +++ b/example/lib/odrive/include/gmock/gmock-actions.h @@ -0,0 +1,2302 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// The ACTION* family of macros can be used in a namespace scope to +// define custom actions easily. The syntax: +// +// ACTION(name) { statements; } +// +// will define an action with the given name that executes the +// statements. The value returned by the statements will be used as +// the return value of the action. Inside the statements, you can +// refer to the K-th (0-based) argument of the mock function by +// 'argK', and refer to its type by 'argK_type'. For example: +// +// ACTION(IncrementArg1) { +// arg1_type temp = arg1; +// return ++(*temp); +// } +// +// allows you to write +// +// ...WillOnce(IncrementArg1()); +// +// You can also refer to the entire argument tuple and its type by +// 'args' and 'args_type', and refer to the mock function type and its +// return type by 'function_type' and 'return_type'. +// +// Note that you don't need to specify the types of the mock function +// arguments. However rest assured that your code is still type-safe: +// you'll get a compiler error if *arg1 doesn't support the ++ +// operator, or if the type of ++(*arg1) isn't compatible with the +// mock function's return type, for example. +// +// Sometimes you'll want to parameterize the action. For that you can use +// another macro: +// +// ACTION_P(name, param_name) { statements; } +// +// For example: +// +// ACTION_P(Add, n) { return arg0 + n; } +// +// will allow you to write: +// +// ...WillOnce(Add(5)); +// +// Note that you don't need to provide the type of the parameter +// either. If you need to reference the type of a parameter named +// 'foo', you can write 'foo_type'. For example, in the body of +// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type +// of 'n'. +// +// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support +// multi-parameter actions. +// +// For the purpose of typing, you can view +// +// ACTION_Pk(Foo, p1, ..., pk) { ... } +// +// as shorthand for +// +// template +// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } +// +// In particular, you can provide the template type arguments +// explicitly when invoking Foo(), as in Foo(5, false); +// although usually you can rely on the compiler to infer the types +// for you automatically. You can assign the result of expression +// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. +// +// You can also overload actions with different numbers of parameters: +// +// ACTION_P(Plus, a) { ... } +// ACTION_P2(Plus, a, b) { ... } +// +// While it's tempting to always use the ACTION* macros when defining +// a new action, you should also consider implementing ActionInterface +// or using MakePolymorphicAction() instead, especially if you need to +// use the action a lot. While these approaches require more work, +// they give you more control on the types of the mock function +// arguments and the action parameters, which in general leads to +// better compiler error messages that pay off in the long run. They +// also allow overloading actions based on parameter types (as opposed +// to just based on the number of parameters). +// +// CAVEAT: +// +// ACTION*() can only be used in a namespace scope as templates cannot be +// declared inside of a local class. +// Users can, however, define any local functors (e.g. a lambda) that +// can be used as actions. +// +// MORE INFORMATION: +// +// To learn more about using these macros, please search for 'ACTION' on +// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md + +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + +#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ +#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ + +#ifndef _WIN32_WCE +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-port.h" +#include "gmock/internal/gmock-pp.h" + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4100) +#endif + +namespace testing { + +// To implement an action Foo, define: +// 1. a class FooAction that implements the ActionInterface interface, and +// 2. a factory function that creates an Action object from a +// const FooAction*. +// +// The two-level delegation design follows that of Matcher, providing +// consistency for extension developers. It also eases ownership +// management as Action objects can now be copied like plain values. + +namespace internal { + +// BuiltInDefaultValueGetter::Get() returns a +// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error. +// +// This primary template is used when kDefaultConstructible is true. +template +struct BuiltInDefaultValueGetter { + static T Get() { return T(); } +}; +template +struct BuiltInDefaultValueGetter { + static T Get() { + Assert(false, __FILE__, __LINE__, + "Default action undefined for the function return type."); + return internal::Invalid(); + // The above statement will never be reached, but is required in + // order for this function to compile. + } +}; + +// BuiltInDefaultValue::Get() returns the "built-in" default value +// for type T, which is NULL when T is a raw pointer type, 0 when T is +// a numeric type, false when T is bool, or "" when T is string or +// std::string. In addition, in C++11 and above, it turns a +// default-constructed T value if T is default constructible. For any +// other type T, the built-in default T value is undefined, and the +// function will abort the process. +template +class BuiltInDefaultValue { + public: + // This function returns true if and only if type T has a built-in default + // value. + static bool Exists() { return ::std::is_default_constructible::value; } + + static T Get() { + return BuiltInDefaultValueGetter< + T, ::std::is_default_constructible::value>::Get(); + } +}; + +// This partial specialization says that we use the same built-in +// default value for T and const T. +template +class BuiltInDefaultValue { + public: + static bool Exists() { return BuiltInDefaultValue::Exists(); } + static T Get() { return BuiltInDefaultValue::Get(); } +}; + +// This partial specialization defines the default values for pointer +// types. +template +class BuiltInDefaultValue { + public: + static bool Exists() { return true; } + static T* Get() { return nullptr; } +}; + +// The following specializations define the default values for +// specific types we care about. +#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ + template <> \ + class BuiltInDefaultValue { \ + public: \ + static bool Exists() { return true; } \ + static type Get() { return value; } \ + } + +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); + +// There's no need for a default action for signed wchar_t, as that +// type is the same as wchar_t for gcc, and invalid for MSVC. +// +// There's also no need for a default action for unsigned wchar_t, as +// that type is the same as unsigned int for gcc, and invalid for +// MSVC. +#if GMOCK_WCHAR_T_IS_NATIVE_ +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT +#endif + +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); + +#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ + +// Partial implementations of metaprogramming types from the standard library +// not available in C++11. + +template +struct negation + // NOLINTNEXTLINE + : std::integral_constant {}; + +// Base case: with zero predicates the answer is always true. +template +struct conjunction : std::true_type {}; + +// With a single predicate, the answer is that predicate. +template +struct conjunction : P1 {}; + +// With multiple predicates the answer is the first predicate if that is false, +// and we recurse otherwise. +template +struct conjunction + : std::conditional, P1>::type {}; + +template +struct disjunction : std::false_type {}; + +template +struct disjunction : P1 {}; + +template +struct disjunction + // NOLINTNEXTLINE + : std::conditional, P1>::type {}; + +template +using void_t = void; + +// Detects whether an expression of type `From` can be implicitly converted to +// `To` according to [conv]. In C++17, [conv]/3 defines this as follows: +// +// An expression e can be implicitly converted to a type T if and only if +// the declaration T t=e; is well-formed, for some invented temporary +// variable t ([dcl.init]). +// +// [conv]/2 implies we can use function argument passing to detect whether this +// initialization is valid. +// +// Note that this is distinct from is_convertible, which requires this be valid: +// +// To test() { +// return declval(); +// } +// +// In particular, is_convertible doesn't give the correct answer when `To` and +// `From` are the same non-moveable type since `declval` will be an rvalue +// reference, defeating the guaranteed copy elision that would otherwise make +// this function work. +// +// REQUIRES: `From` is not cv void. +template +struct is_implicitly_convertible { + private: + // A function that accepts a parameter of type T. This can be called with type + // U successfully only if U is implicitly convertible to T. + template + static void Accept(T); + + // A function that creates a value of type T. + template + static T Make(); + + // An overload be selected when implicit conversion from T to To is possible. + template (Make()))> + static std::true_type TestImplicitConversion(int); + + // A fallback overload selected in all other cases. + template + static std::false_type TestImplicitConversion(...); + + public: + using type = decltype(TestImplicitConversion(0)); + static constexpr bool value = type::value; +}; + +// Like std::invoke_result_t from C++17, but works only for objects with call +// operators (not e.g. member function pointers, which we don't need specific +// support for in OnceAction because std::function deals with them). +template +using call_result_t = decltype(std::declval()(std::declval()...)); + +template +struct is_callable_r_impl : std::false_type {}; + +// Specialize the struct for those template arguments where call_result_t is +// well-formed. When it's not, the generic template above is chosen, resulting +// in std::false_type. +template +struct is_callable_r_impl>, R, F, Args...> + : std::conditional< + std::is_void::value, // + std::true_type, // + is_implicitly_convertible, R>>::type {}; + +// Like std::is_invocable_r from C++17, but works only for objects with call +// operators. See the note on call_result_t. +template +using is_callable_r = is_callable_r_impl; + +// Like std::as_const from C++17. +template +typename std::add_const::type& as_const(T& t) { + return t; +} + +} // namespace internal + +// Specialized for function types below. +template +class OnceAction; + +// An action that can only be used once. +// +// This is accepted by WillOnce, which doesn't require the underlying action to +// be copy-constructible (only move-constructible), and promises to invoke it as +// an rvalue reference. This allows the action to work with move-only types like +// std::move_only_function in a type-safe manner. +// +// For example: +// +// // Assume we have some API that needs to accept a unique pointer to some +// // non-copyable object Foo. +// void AcceptUniquePointer(std::unique_ptr foo); +// +// // We can define an action that provides a Foo to that API. Because It +// // has to give away its unique pointer, it must not be called more than +// // once, so its call operator is &&-qualified. +// struct ProvideFoo { +// std::unique_ptr foo; +// +// void operator()() && { +// AcceptUniquePointer(std::move(Foo)); +// } +// }; +// +// // This action can be used with WillOnce. +// EXPECT_CALL(mock, Call) +// .WillOnce(ProvideFoo{std::make_unique(...)}); +// +// // But a call to WillRepeatedly will fail to compile. This is correct, +// // since the action cannot correctly be used repeatedly. +// EXPECT_CALL(mock, Call) +// .WillRepeatedly(ProvideFoo{std::make_unique(...)}); +// +// A less-contrived example would be an action that returns an arbitrary type, +// whose &&-qualified call operator is capable of dealing with move-only types. +template +class OnceAction final { + private: + // True iff we can use the given callable type (or lvalue reference) directly + // via StdFunctionAdaptor. + template + using IsDirectlyCompatible = internal::conjunction< + // It must be possible to capture the callable in StdFunctionAdaptor. + std::is_constructible::type, Callable>, + // The callable must be compatible with our signature. + internal::is_callable_r::type, + Args...>>; + + // True iff we can use the given callable type via StdFunctionAdaptor once we + // ignore incoming arguments. + template + using IsCompatibleAfterIgnoringArguments = internal::conjunction< + // It must be possible to capture the callable in a lambda. + std::is_constructible::type, Callable>, + // The callable must be invocable with zero arguments, returning something + // convertible to Result. + internal::is_callable_r::type>>; + + public: + // Construct from a callable that is directly compatible with our mocked + // signature: it accepts our function type's arguments and returns something + // convertible to our result type. + template ::type>>, + IsDirectlyCompatible> // + ::value, + int>::type = 0> + OnceAction(Callable&& callable) // NOLINT + : function_(StdFunctionAdaptor::type>( + {}, std::forward(callable))) {} + + // As above, but for a callable that ignores the mocked function's arguments. + template ::type>>, + // Exclude callables for which the overload above works. + // We'd rather provide the arguments if possible. + internal::negation>, + IsCompatibleAfterIgnoringArguments>::value, + int>::type = 0> + OnceAction(Callable&& callable) // NOLINT + // Call the constructor above with a callable + // that ignores the input arguments. + : OnceAction(IgnoreIncomingArguments::type>{ + std::forward(callable)}) {} + + // We are naturally copyable because we store only an std::function, but + // semantically we should not be copyable. + OnceAction(const OnceAction&) = delete; + OnceAction& operator=(const OnceAction&) = delete; + OnceAction(OnceAction&&) = default; + + // Invoke the underlying action callable with which we were constructed, + // handing it the supplied arguments. + Result Call(Args... args) && { + return function_(std::forward(args)...); + } + + private: + // An adaptor that wraps a callable that is compatible with our signature and + // being invoked as an rvalue reference so that it can be used as an + // StdFunctionAdaptor. This throws away type safety, but that's fine because + // this is only used by WillOnce, which we know calls at most once. + // + // Once we have something like std::move_only_function from C++23, we can do + // away with this. + template + class StdFunctionAdaptor final { + public: + // A tag indicating that the (otherwise universal) constructor is accepting + // the callable itself, instead of e.g. stealing calls for the move + // constructor. + struct CallableTag final {}; + + template + explicit StdFunctionAdaptor(CallableTag, F&& callable) + : callable_(std::make_shared(std::forward(callable))) {} + + // Rather than explicitly returning Result, we return whatever the wrapped + // callable returns. This allows for compatibility with existing uses like + // the following, when the mocked function returns void: + // + // EXPECT_CALL(mock_fn_, Call) + // .WillOnce([&] { + // [...] + // return 0; + // }); + // + // Such a callable can be turned into std::function. If we use an + // explicit return type of Result here then it *doesn't* work with + // std::function, because we'll get a "void function should not return a + // value" error. + // + // We need not worry about incompatible result types because the SFINAE on + // OnceAction already checks this for us. std::is_invocable_r_v itself makes + // the same allowance for void result types. + template + internal::call_result_t operator()( + ArgRefs&&... args) const { + return std::move(*callable_)(std::forward(args)...); + } + + private: + // We must put the callable on the heap so that we are copyable, which + // std::function needs. + std::shared_ptr callable_; + }; + + // An adaptor that makes a callable that accepts zero arguments callable with + // our mocked arguments. + template + struct IgnoreIncomingArguments { + internal::call_result_t operator()(Args&&...) { + return std::move(callable)(); + } + + Callable callable; + }; + + std::function function_; +}; + +// When an unexpected function call is encountered, Google Mock will +// let it return a default value if the user has specified one for its +// return type, or if the return type has a built-in default value; +// otherwise Google Mock won't know what value to return and will have +// to abort the process. +// +// The DefaultValue class allows a user to specify the +// default value for a type T that is both copyable and publicly +// destructible (i.e. anything that can be used as a function return +// type). The usage is: +// +// // Sets the default value for type T to be foo. +// DefaultValue::Set(foo); +template +class DefaultValue { + public: + // Sets the default value for type T; requires T to be + // copy-constructable and have a public destructor. + static void Set(T x) { + delete producer_; + producer_ = new FixedValueProducer(x); + } + + // Provides a factory function to be called to generate the default value. + // This method can be used even if T is only move-constructible, but it is not + // limited to that case. + typedef T (*FactoryFunction)(); + static void SetFactory(FactoryFunction factory) { + delete producer_; + producer_ = new FactoryValueProducer(factory); + } + + // Unsets the default value for type T. + static void Clear() { + delete producer_; + producer_ = nullptr; + } + + // Returns true if and only if the user has set the default value for type T. + static bool IsSet() { return producer_ != nullptr; } + + // Returns true if T has a default return value set by the user or there + // exists a built-in default value. + static bool Exists() { + return IsSet() || internal::BuiltInDefaultValue::Exists(); + } + + // Returns the default value for type T if the user has set one; + // otherwise returns the built-in default value. Requires that Exists() + // is true, which ensures that the return value is well-defined. + static T Get() { + return producer_ == nullptr ? internal::BuiltInDefaultValue::Get() + : producer_->Produce(); + } + + private: + class ValueProducer { + public: + virtual ~ValueProducer() {} + virtual T Produce() = 0; + }; + + class FixedValueProducer : public ValueProducer { + public: + explicit FixedValueProducer(T value) : value_(value) {} + T Produce() override { return value_; } + + private: + const T value_; + FixedValueProducer(const FixedValueProducer&) = delete; + FixedValueProducer& operator=(const FixedValueProducer&) = delete; + }; + + class FactoryValueProducer : public ValueProducer { + public: + explicit FactoryValueProducer(FactoryFunction factory) + : factory_(factory) {} + T Produce() override { return factory_(); } + + private: + const FactoryFunction factory_; + FactoryValueProducer(const FactoryValueProducer&) = delete; + FactoryValueProducer& operator=(const FactoryValueProducer&) = delete; + }; + + static ValueProducer* producer_; +}; + +// This partial specialization allows a user to set default values for +// reference types. +template +class DefaultValue { + public: + // Sets the default value for type T&. + static void Set(T& x) { // NOLINT + address_ = &x; + } + + // Unsets the default value for type T&. + static void Clear() { address_ = nullptr; } + + // Returns true if and only if the user has set the default value for type T&. + static bool IsSet() { return address_ != nullptr; } + + // Returns true if T has a default return value set by the user or there + // exists a built-in default value. + static bool Exists() { + return IsSet() || internal::BuiltInDefaultValue::Exists(); + } + + // Returns the default value for type T& if the user has set one; + // otherwise returns the built-in default value if there is one; + // otherwise aborts the process. + static T& Get() { + return address_ == nullptr ? internal::BuiltInDefaultValue::Get() + : *address_; + } + + private: + static T* address_; +}; + +// This specialization allows DefaultValue::Get() to +// compile. +template <> +class DefaultValue { + public: + static bool Exists() { return true; } + static void Get() {} +}; + +// Points to the user-set default value for type T. +template +typename DefaultValue::ValueProducer* DefaultValue::producer_ = nullptr; + +// Points to the user-set default value for type T&. +template +T* DefaultValue::address_ = nullptr; + +// Implement this interface to define an action for function type F. +template +class ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + ActionInterface() {} + virtual ~ActionInterface() {} + + // Performs the action. This method is not const, as in general an + // action can have side effects and be stateful. For example, a + // get-the-next-element-from-the-collection action will need to + // remember the current element. + virtual Result Perform(const ArgumentTuple& args) = 0; + + private: + ActionInterface(const ActionInterface&) = delete; + ActionInterface& operator=(const ActionInterface&) = delete; +}; + +template +class Action; + +// An Action is a copyable and IMMUTABLE (except by assignment) +// object that represents an action to be taken when a mock function of type +// R(Args...) is called. The implementation of Action is just a +// std::shared_ptr to const ActionInterface. Don't inherit from Action! You +// can view an object implementing ActionInterface as a concrete action +// (including its current state), and an Action object as a handle to it. +template +class Action { + private: + using F = R(Args...); + + // Adapter class to allow constructing Action from a legacy ActionInterface. + // New code should create Actions from functors instead. + struct ActionAdapter { + // Adapter must be copyable to satisfy std::function requirements. + ::std::shared_ptr> impl_; + + template + typename internal::Function::Result operator()(InArgs&&... args) { + return impl_->Perform( + ::std::forward_as_tuple(::std::forward(args)...)); + } + }; + + template + using IsCompatibleFunctor = std::is_constructible, G>; + + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + // Constructs a null Action. Needed for storing Action objects in + // STL containers. + Action() {} + + // Construct an Action from a specified callable. + // This cannot take std::function directly, because then Action would not be + // directly constructible from lambda (it would require two conversions). + template < + typename G, + typename = typename std::enable_if, std::is_constructible, + G>>::value>::type> + Action(G&& fun) { // NOLINT + Init(::std::forward(fun), IsCompatibleFunctor()); + } + + // Constructs an Action from its implementation. + explicit Action(ActionInterface* impl) + : fun_(ActionAdapter{::std::shared_ptr>(impl)}) {} + + // This constructor allows us to turn an Action object into an + // Action, as long as F's arguments can be implicitly converted + // to Func's and Func's return type can be implicitly converted to F's. + template + Action(const Action& action) // NOLINT + : fun_(action.fun_) {} + + // Returns true if and only if this is the DoDefault() action. + bool IsDoDefault() const { return fun_ == nullptr; } + + // Performs the action. Note that this method is const even though + // the corresponding method in ActionInterface is not. The reason + // is that a const Action means that it cannot be re-bound to + // another concrete action, not that the concrete action it binds to + // cannot change state. (Think of the difference between a const + // pointer and a pointer to const.) + Result Perform(ArgumentTuple args) const { + if (IsDoDefault()) { + internal::IllegalDoDefault(__FILE__, __LINE__); + } + return internal::Apply(fun_, ::std::move(args)); + } + + // An action can be used as a OnceAction, since it's obviously safe to call it + // once. + operator OnceAction() const { // NOLINT + // Return a OnceAction-compatible callable that calls Perform with the + // arguments it is provided. We could instead just return fun_, but then + // we'd need to handle the IsDoDefault() case separately. + struct OA { + Action action; + + R operator()(Args... args) && { + return action.Perform( + std::forward_as_tuple(std::forward(args)...)); + } + }; + + return OA{*this}; + } + + private: + template + friend class Action; + + template + void Init(G&& g, ::std::true_type) { + fun_ = ::std::forward(g); + } + + template + void Init(G&& g, ::std::false_type) { + fun_ = IgnoreArgs::type>{::std::forward(g)}; + } + + template + struct IgnoreArgs { + template + Result operator()(const InArgs&...) const { + return function_impl(); + } + + FunctionImpl function_impl; + }; + + // fun_ is an empty function if and only if this is the DoDefault() action. + ::std::function fun_; +}; + +// The PolymorphicAction class template makes it easy to implement a +// polymorphic action (i.e. an action that can be used in mock +// functions of than one type, e.g. Return()). +// +// To define a polymorphic action, a user first provides a COPYABLE +// implementation class that has a Perform() method template: +// +// class FooAction { +// public: +// template +// Result Perform(const ArgumentTuple& args) const { +// // Processes the arguments and returns a result, using +// // std::get(args) to get the N-th (0-based) argument in the tuple. +// } +// ... +// }; +// +// Then the user creates the polymorphic action using +// MakePolymorphicAction(object) where object has type FooAction. See +// the definition of Return(void) and SetArgumentPointee(value) for +// complete examples. +template +class PolymorphicAction { + public: + explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} + + template + operator Action() const { + return Action(new MonomorphicImpl(impl_)); + } + + private: + template + class MonomorphicImpl : public ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} + + Result Perform(const ArgumentTuple& args) override { + return impl_.template Perform(args); + } + + private: + Impl impl_; + }; + + Impl impl_; +}; + +// Creates an Action from its implementation and returns it. The +// created Action object owns the implementation. +template +Action MakeAction(ActionInterface* impl) { + return Action(impl); +} + +// Creates a polymorphic action from its implementation. This is +// easier to use than the PolymorphicAction constructor as it +// doesn't require you to explicitly write the template argument, e.g. +// +// MakePolymorphicAction(foo); +// vs +// PolymorphicAction(foo); +template +inline PolymorphicAction MakePolymorphicAction(const Impl& impl) { + return PolymorphicAction(impl); +} + +namespace internal { + +// Helper struct to specialize ReturnAction to execute a move instead of a copy +// on return. Useful for move-only types, but could be used on any type. +template +struct ByMoveWrapper { + explicit ByMoveWrapper(T value) : payload(std::move(value)) {} + T payload; +}; + +// The general implementation of Return(R). Specializations follow below. +template +class ReturnAction final { + public: + explicit ReturnAction(R value) : value_(std::move(value)) {} + + template >, // + negation>, // + std::is_convertible, // + std::is_move_constructible>::value>::type> + operator OnceAction() && { // NOLINT + return Impl(std::move(value_)); + } + + template >, // + negation>, // + std::is_convertible, // + std::is_copy_constructible>::value>::type> + operator Action() const { // NOLINT + return Impl(value_); + } + + private: + // Implements the Return(x) action for a mock function that returns type U. + template + class Impl final { + public: + // The constructor used when the return value is allowed to move from the + // input value (i.e. we are converting to OnceAction). + explicit Impl(R&& input_value) + : state_(new State(std::move(input_value))) {} + + // The constructor used when the return value is not allowed to move from + // the input value (i.e. we are converting to Action). + explicit Impl(const R& input_value) : state_(new State(input_value)) {} + + U operator()() && { return std::move(state_->value); } + U operator()() const& { return state_->value; } + + private: + // We put our state on the heap so that the compiler-generated copy/move + // constructors work correctly even when U is a reference-like type. This is + // necessary only because we eagerly create State::value (see the note on + // that symbol for details). If we instead had only the input value as a + // member then the default constructors would work fine. + // + // For example, when R is std::string and U is std::string_view, value is a + // reference to the string backed by input_value. The copy constructor would + // copy both, so that we wind up with a new input_value object (with the + // same contents) and a reference to the *old* input_value object rather + // than the new one. + struct State { + explicit State(const R& input_value_in) + : input_value(input_value_in), + // Make an implicit conversion to Result before initializing the U + // object we store, avoiding calling any explicit constructor of U + // from R. + // + // This simulates the language rules: a function with return type U + // that does `return R()` requires R to be implicitly convertible to + // U, and uses that path for the conversion, even U Result has an + // explicit constructor from R. + value(ImplicitCast_(internal::as_const(input_value))) {} + + // As above, but for the case where we're moving from the ReturnAction + // object because it's being used as a OnceAction. + explicit State(R&& input_value_in) + : input_value(std::move(input_value_in)), + // For the same reason as above we make an implicit conversion to U + // before initializing the value. + // + // Unlike above we provide the input value as an rvalue to the + // implicit conversion because this is a OnceAction: it's fine if it + // wants to consume the input value. + value(ImplicitCast_(std::move(input_value))) {} + + // A copy of the value originally provided by the user. We retain this in + // addition to the value of the mock function's result type below in case + // the latter is a reference-like type. See the std::string_view example + // in the documentation on Return. + R input_value; + + // The value we actually return, as the type returned by the mock function + // itself. + // + // We eagerly initialize this here, rather than lazily doing the implicit + // conversion automatically each time Perform is called, for historical + // reasons: in 2009-11, commit a070cbd91c (Google changelist 13540126) + // made the Action conversion operator eagerly convert the R value to + // U, but without keeping the R alive. This broke the use case discussed + // in the documentation for Return, making reference-like types such as + // std::string_view not safe to use as U where the input type R is a + // value-like type such as std::string. + // + // The example the commit gave was not very clear, nor was the issue + // thread (https://github.com/google/googlemock/issues/86), but it seems + // the worry was about reference-like input types R that flatten to a + // value-like type U when being implicitly converted. An example of this + // is std::vector::reference, which is often a proxy type with an + // reference to the underlying vector: + // + // // Helper method: have the mock function return bools according + // // to the supplied script. + // void SetActions(MockFunction& mock, + // const std::vector& script) { + // for (size_t i = 0; i < script.size(); ++i) { + // EXPECT_CALL(mock, Call(i)).WillOnce(Return(script[i])); + // } + // } + // + // TEST(Foo, Bar) { + // // Set actions using a temporary vector, whose operator[] + // // returns proxy objects that references that will be + // // dangling once the call to SetActions finishes and the + // // vector is destroyed. + // MockFunction mock; + // SetActions(mock, {false, true}); + // + // EXPECT_FALSE(mock.AsStdFunction()(0)); + // EXPECT_TRUE(mock.AsStdFunction()(1)); + // } + // + // This eager conversion helps with a simple case like this, but doesn't + // fully make these types work in general. For example the following still + // uses a dangling reference: + // + // TEST(Foo, Baz) { + // MockFunction()> mock; + // + // // Return the same vector twice, and then the empty vector + // // thereafter. + // auto action = Return(std::initializer_list{ + // "taco", "burrito", + // }); + // + // EXPECT_CALL(mock, Call) + // .WillOnce(action) + // .WillOnce(action) + // .WillRepeatedly(Return(std::vector{})); + // + // EXPECT_THAT(mock.AsStdFunction()(), + // ElementsAre("taco", "burrito")); + // EXPECT_THAT(mock.AsStdFunction()(), + // ElementsAre("taco", "burrito")); + // EXPECT_THAT(mock.AsStdFunction()(), IsEmpty()); + // } + // + U value; + }; + + const std::shared_ptr state_; + }; + + R value_; +}; + +// A specialization of ReturnAction when R is ByMoveWrapper for some T. +// +// This version applies the type system-defeating hack of moving from T even in +// the const call operator, checking at runtime that it isn't called more than +// once, since the user has declared their intent to do so by using ByMove. +template +class ReturnAction> final { + public: + explicit ReturnAction(ByMoveWrapper wrapper) + : state_(new State(std::move(wrapper.payload))) {} + + T operator()() const { + GTEST_CHECK_(!state_->called) + << "A ByMove() action must be performed at most once."; + + state_->called = true; + return std::move(state_->value); + } + + private: + // We store our state on the heap so that we are copyable as required by + // Action, despite the fact that we are stateful and T may not be copyable. + struct State { + explicit State(T&& value_in) : value(std::move(value_in)) {} + + T value; + bool called = false; + }; + + const std::shared_ptr state_; +}; + +// Implements the ReturnNull() action. +class ReturnNullAction { + public: + // Allows ReturnNull() to be used in any pointer-returning function. In C++11 + // this is enforced by returning nullptr, and in non-C++11 by asserting a + // pointer type on compile time. + template + static Result Perform(const ArgumentTuple&) { + return nullptr; + } +}; + +// Implements the Return() action. +class ReturnVoidAction { + public: + // Allows Return() to be used in any void-returning function. + template + static void Perform(const ArgumentTuple&) { + static_assert(std::is_void::value, "Result should be void."); + } +}; + +// Implements the polymorphic ReturnRef(x) action, which can be used +// in any function that returns a reference to the type of x, +// regardless of the argument types. +template +class ReturnRefAction { + public: + // Constructs a ReturnRefAction object from the reference to be returned. + explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT + + // This template type conversion operator allows ReturnRef(x) to be + // used in ANY function that returns a reference to x's type. + template + operator Action() const { + typedef typename Function::Result Result; + // Asserts that the function return type is a reference. This + // catches the user error of using ReturnRef(x) when Return(x) + // should be used, and generates some helpful error message. + static_assert(std::is_reference::value, + "use Return instead of ReturnRef to return a value"); + return Action(new Impl(ref_)); + } + + private: + // Implements the ReturnRef(x) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(T& ref) : ref_(ref) {} // NOLINT + + Result Perform(const ArgumentTuple&) override { return ref_; } + + private: + T& ref_; + }; + + T& ref_; +}; + +// Implements the polymorphic ReturnRefOfCopy(x) action, which can be +// used in any function that returns a reference to the type of x, +// regardless of the argument types. +template +class ReturnRefOfCopyAction { + public: + // Constructs a ReturnRefOfCopyAction object from the reference to + // be returned. + explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT + + // This template type conversion operator allows ReturnRefOfCopy(x) to be + // used in ANY function that returns a reference to x's type. + template + operator Action() const { + typedef typename Function::Result Result; + // Asserts that the function return type is a reference. This + // catches the user error of using ReturnRefOfCopy(x) when Return(x) + // should be used, and generates some helpful error message. + static_assert(std::is_reference::value, + "use Return instead of ReturnRefOfCopy to return a value"); + return Action(new Impl(value_)); + } + + private: + // Implements the ReturnRefOfCopy(x) action for a particular function type F. + template + class Impl : public ActionInterface { + public: + typedef typename Function::Result Result; + typedef typename Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const T& value) : value_(value) {} // NOLINT + + Result Perform(const ArgumentTuple&) override { return value_; } + + private: + T value_; + }; + + const T value_; +}; + +// Implements the polymorphic ReturnRoundRobin(v) action, which can be +// used in any function that returns the element_type of v. +template +class ReturnRoundRobinAction { + public: + explicit ReturnRoundRobinAction(std::vector values) { + GTEST_CHECK_(!values.empty()) + << "ReturnRoundRobin requires at least one element."; + state_->values = std::move(values); + } + + template + T operator()(Args&&...) const { + return state_->Next(); + } + + private: + struct State { + T Next() { + T ret_val = values[i++]; + if (i == values.size()) i = 0; + return ret_val; + } + + std::vector values; + size_t i = 0; + }; + std::shared_ptr state_ = std::make_shared(); +}; + +// Implements the polymorphic DoDefault() action. +class DoDefaultAction { + public: + // This template type conversion operator allows DoDefault() to be + // used in any function. + template + operator Action() const { + return Action(); + } // NOLINT +}; + +// Implements the Assign action to set a given pointer referent to a +// particular value. +template +class AssignAction { + public: + AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} + + template + void Perform(const ArgumentTuple& /* args */) const { + *ptr_ = value_; + } + + private: + T1* const ptr_; + const T2 value_; +}; + +#if !GTEST_OS_WINDOWS_MOBILE + +// Implements the SetErrnoAndReturn action to simulate return from +// various system calls and libc functions. +template +class SetErrnoAndReturnAction { + public: + SetErrnoAndReturnAction(int errno_value, T result) + : errno_(errno_value), result_(result) {} + template + Result Perform(const ArgumentTuple& /* args */) const { + errno = errno_; + return result_; + } + + private: + const int errno_; + const T result_; +}; + +#endif // !GTEST_OS_WINDOWS_MOBILE + +// Implements the SetArgumentPointee(x) action for any function +// whose N-th argument (0-based) is a pointer to x's type. +template +struct SetArgumentPointeeAction { + A value; + + template + void operator()(const Args&... args) const { + *::std::get(std::tie(args...)) = value; + } +}; + +// Implements the Invoke(object_ptr, &Class::Method) action. +template +struct InvokeMethodAction { + Class* const obj_ptr; + const MethodPtr method_ptr; + + template + auto operator()(Args&&... args) const + -> decltype((obj_ptr->*method_ptr)(std::forward(args)...)) { + return (obj_ptr->*method_ptr)(std::forward(args)...); + } +}; + +// Implements the InvokeWithoutArgs(f) action. The template argument +// FunctionImpl is the implementation type of f, which can be either a +// function pointer or a functor. InvokeWithoutArgs(f) can be used as an +// Action as long as f's type is compatible with F. +template +struct InvokeWithoutArgsAction { + FunctionImpl function_impl; + + // Allows InvokeWithoutArgs(f) to be used as any action whose type is + // compatible with f. + template + auto operator()(const Args&...) -> decltype(function_impl()) { + return function_impl(); + } +}; + +// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. +template +struct InvokeMethodWithoutArgsAction { + Class* const obj_ptr; + const MethodPtr method_ptr; + + using ReturnType = + decltype((std::declval()->*std::declval())()); + + template + ReturnType operator()(const Args&...) const { + return (obj_ptr->*method_ptr)(); + } +}; + +// Implements the IgnoreResult(action) action. +template +class IgnoreResultAction { + public: + explicit IgnoreResultAction(const A& action) : action_(action) {} + + template + operator Action() const { + // Assert statement belongs here because this is the best place to verify + // conditions on F. It produces the clearest error messages + // in most compilers. + // Impl really belongs in this scope as a local class but can't + // because MSVC produces duplicate symbols in different translation units + // in this case. Until MS fixes that bug we put Impl into the class scope + // and put the typedef both here (for use in assert statement) and + // in the Impl class. But both definitions must be the same. + typedef typename internal::Function::Result Result; + + // Asserts at compile time that F returns void. + static_assert(std::is_void::value, "Result type should be void."); + + return Action(new Impl(action_)); + } + + private: + template + class Impl : public ActionInterface { + public: + typedef typename internal::Function::Result Result; + typedef typename internal::Function::ArgumentTuple ArgumentTuple; + + explicit Impl(const A& action) : action_(action) {} + + void Perform(const ArgumentTuple& args) override { + // Performs the action and ignores its result. + action_.Perform(args); + } + + private: + // Type OriginalFunction is the same as F except that its return + // type is IgnoredValue. + typedef + typename internal::Function::MakeResultIgnoredValue OriginalFunction; + + const Action action_; + }; + + const A action_; +}; + +template +struct WithArgsAction { + InnerAction inner_action; + + // The signature of the function as seen by the inner action, given an out + // action with the given result and argument types. + template + using InnerSignature = + R(typename std::tuple_element>::type...); + + // Rather than a call operator, we must define conversion operators to + // particular action types. This is necessary for embedded actions like + // DoDefault(), which rely on an action conversion operators rather than + // providing a call operator because even with a particular set of arguments + // they don't have a fixed return type. + + template >...)>>::value, + int>::type = 0> + operator OnceAction() && { // NOLINT + struct OA { + OnceAction> inner_action; + + R operator()(Args&&... args) && { + return std::move(inner_action) + .Call(std::get( + std::forward_as_tuple(std::forward(args)...))...); + } + }; + + return OA{std::move(inner_action)}; + } + + template >...)>>::value, + int>::type = 0> + operator Action() const { // NOLINT + Action> converted(inner_action); + + return [converted](Args&&... args) -> R { + return converted.Perform(std::forward_as_tuple( + std::get(std::forward_as_tuple(std::forward(args)...))...)); + }; + } +}; + +template +class DoAllAction; + +// Base case: only a single action. +template +class DoAllAction { + public: + struct UserConstructorTag {}; + + template + explicit DoAllAction(UserConstructorTag, T&& action) + : final_action_(std::forward(action)) {} + + // Rather than a call operator, we must define conversion operators to + // particular action types. This is necessary for embedded actions like + // DoDefault(), which rely on an action conversion operators rather than + // providing a call operator because even with a particular set of arguments + // they don't have a fixed return type. + + template >::value, + int>::type = 0> + operator OnceAction() && { // NOLINT + return std::move(final_action_); + } + + template < + typename R, typename... Args, + typename std::enable_if< + std::is_convertible>::value, + int>::type = 0> + operator Action() const { // NOLINT + return final_action_; + } + + private: + FinalAction final_action_; +}; + +// Recursive case: support N actions by calling the initial action and then +// calling through to the base class containing N-1 actions. +template +class DoAllAction + : private DoAllAction { + private: + using Base = DoAllAction; + + // The type of reference that should be provided to an initial action for a + // mocked function parameter of type T. + // + // There are two quirks here: + // + // * Unlike most forwarding functions, we pass scalars through by value. + // This isn't strictly necessary because an lvalue reference would work + // fine too and be consistent with other non-reference types, but it's + // perhaps less surprising. + // + // For example if the mocked function has signature void(int), then it + // might seem surprising for the user's initial action to need to be + // convertible to Action. This is perhaps less + // surprising for a non-scalar type where there may be a performance + // impact, or it might even be impossible, to pass by value. + // + // * More surprisingly, `const T&` is often not a const reference type. + // By the reference collapsing rules in C++17 [dcl.ref]/6, if T refers to + // U& or U&& for some non-scalar type U, then InitialActionArgType is + // U&. In other words, we may hand over a non-const reference. + // + // So for example, given some non-scalar type Obj we have the following + // mappings: + // + // T InitialActionArgType + // ------- ----------------------- + // Obj const Obj& + // Obj& Obj& + // Obj&& Obj& + // const Obj const Obj& + // const Obj& const Obj& + // const Obj&& const Obj& + // + // In other words, the initial actions get a mutable view of an non-scalar + // argument if and only if the mock function itself accepts a non-const + // reference type. They are never given an rvalue reference to an + // non-scalar type. + // + // This situation makes sense if you imagine use with a matcher that is + // designed to write through a reference. For example, if the caller wants + // to fill in a reference argument and then return a canned value: + // + // EXPECT_CALL(mock, Call) + // .WillOnce(DoAll(SetArgReferee<0>(17), Return(19))); + // + template + using InitialActionArgType = + typename std::conditional::value, T, const T&>::type; + + public: + struct UserConstructorTag {}; + + template + explicit DoAllAction(UserConstructorTag, T&& initial_action, + U&&... other_actions) + : Base({}, std::forward(other_actions)...), + initial_action_(std::forward(initial_action)) {} + + template ...)>>, + std::is_convertible>>::value, + int>::type = 0> + operator OnceAction() && { // NOLINT + // Return an action that first calls the initial action with arguments + // filtered through InitialActionArgType, then forwards arguments directly + // to the base class to deal with the remaining actions. + struct OA { + OnceAction...)> initial_action; + OnceAction remaining_actions; + + R operator()(Args... args) && { + std::move(initial_action) + .Call(static_cast>(args)...); + + return std::move(remaining_actions).Call(std::forward(args)...); + } + }; + + return OA{ + std::move(initial_action_), + std::move(static_cast(*this)), + }; + } + + template < + typename R, typename... Args, + typename std::enable_if< + conjunction< + // Both the initial action and the rest must support conversion to + // Action. + std::is_convertible...)>>, + std::is_convertible>>::value, + int>::type = 0> + operator Action() const { // NOLINT + // Return an action that first calls the initial action with arguments + // filtered through InitialActionArgType, then forwards arguments directly + // to the base class to deal with the remaining actions. + struct OA { + Action...)> initial_action; + Action remaining_actions; + + R operator()(Args... args) const { + initial_action.Perform(std::forward_as_tuple( + static_cast>(args)...)); + + return remaining_actions.Perform( + std::forward_as_tuple(std::forward(args)...)); + } + }; + + return OA{ + initial_action_, + static_cast(*this), + }; + } + + private: + InitialAction initial_action_; +}; + +template +struct ReturnNewAction { + T* operator()() const { + return internal::Apply( + [](const Params&... unpacked_params) { + return new T(unpacked_params...); + }, + params); + } + std::tuple params; +}; + +template +struct ReturnArgAction { + template ::type> + auto operator()(Args&&... args) const -> decltype(std::get( + std::forward_as_tuple(std::forward(args)...))) { + return std::get(std::forward_as_tuple(std::forward(args)...)); + } +}; + +template +struct SaveArgAction { + Ptr pointer; + + template + void operator()(const Args&... args) const { + *pointer = std::get(std::tie(args...)); + } +}; + +template +struct SaveArgPointeeAction { + Ptr pointer; + + template + void operator()(const Args&... args) const { + *pointer = *std::get(std::tie(args...)); + } +}; + +template +struct SetArgRefereeAction { + T value; + + template + void operator()(Args&&... args) const { + using argk_type = + typename ::std::tuple_element>::type; + static_assert(std::is_lvalue_reference::value, + "Argument must be a reference type."); + std::get(std::tie(args...)) = value; + } +}; + +template +struct SetArrayArgumentAction { + I1 first; + I2 last; + + template + void operator()(const Args&... args) const { + auto value = std::get(std::tie(args...)); + for (auto it = first; it != last; ++it, (void)++value) { + *value = *it; + } + } +}; + +template +struct DeleteArgAction { + template + void operator()(const Args&... args) const { + delete std::get(std::tie(args...)); + } +}; + +template +struct ReturnPointeeAction { + Ptr pointer; + template + auto operator()(const Args&...) const -> decltype(*pointer) { + return *pointer; + } +}; + +#if GTEST_HAS_EXCEPTIONS +template +struct ThrowAction { + T exception; + // We use a conversion operator to adapt to any return type. + template + operator Action() const { // NOLINT + T copy = exception; + return [copy](Args...) -> R { throw copy; }; + } +}; +#endif // GTEST_HAS_EXCEPTIONS + +} // namespace internal + +// An Unused object can be implicitly constructed from ANY value. +// This is handy when defining actions that ignore some or all of the +// mock function arguments. For example, given +// +// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); +// MOCK_METHOD3(Bar, double(int index, double x, double y)); +// +// instead of +// +// double DistanceToOriginWithLabel(const string& label, double x, double y) { +// return sqrt(x*x + y*y); +// } +// double DistanceToOriginWithIndex(int index, double x, double y) { +// return sqrt(x*x + y*y); +// } +// ... +// EXPECT_CALL(mock, Foo("abc", _, _)) +// .WillOnce(Invoke(DistanceToOriginWithLabel)); +// EXPECT_CALL(mock, Bar(5, _, _)) +// .WillOnce(Invoke(DistanceToOriginWithIndex)); +// +// you could write +// +// // We can declare any uninteresting argument as Unused. +// double DistanceToOrigin(Unused, double x, double y) { +// return sqrt(x*x + y*y); +// } +// ... +// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); +// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); +typedef internal::IgnoredValue Unused; + +// Creates an action that does actions a1, a2, ..., sequentially in +// each invocation. All but the last action will have a readonly view of the +// arguments. +template +internal::DoAllAction::type...> DoAll( + Action&&... action) { + return internal::DoAllAction::type...>( + {}, std::forward(action)...); +} + +// WithArg(an_action) creates an action that passes the k-th +// (0-based) argument of the mock function to an_action and performs +// it. It adapts an action accepting one argument to one that accepts +// multiple arguments. For convenience, we also provide +// WithArgs(an_action) (defined below) as a synonym. +template +internal::WithArgsAction::type, k> WithArg( + InnerAction&& action) { + return {std::forward(action)}; +} + +// WithArgs(an_action) creates an action that passes +// the selected arguments of the mock function to an_action and +// performs it. It serves as an adaptor between actions with +// different argument lists. +template +internal::WithArgsAction::type, k, ks...> +WithArgs(InnerAction&& action) { + return {std::forward(action)}; +} + +// WithoutArgs(inner_action) can be used in a mock function with a +// non-empty argument list to perform inner_action, which takes no +// argument. In other words, it adapts an action accepting no +// argument to one that accepts (and ignores) arguments. +template +internal::WithArgsAction::type> WithoutArgs( + InnerAction&& action) { + return {std::forward(action)}; +} + +// Creates an action that returns a value. +// +// The returned type can be used with a mock function returning a non-void, +// non-reference type U as follows: +// +// * If R is convertible to U and U is move-constructible, then the action can +// be used with WillOnce. +// +// * If const R& is convertible to U and U is copy-constructible, then the +// action can be used with both WillOnce and WillRepeatedly. +// +// The mock expectation contains the R value from which the U return value is +// constructed (a move/copy of the argument to Return). This means that the R +// value will survive at least until the mock object's expectations are cleared +// or the mock object is destroyed, meaning that U can safely be a +// reference-like type such as std::string_view: +// +// // The mock function returns a view of a copy of the string fed to +// // Return. The view is valid even after the action is performed. +// MockFunction mock; +// EXPECT_CALL(mock, Call).WillOnce(Return(std::string("taco"))); +// const std::string_view result = mock.AsStdFunction()(); +// EXPECT_EQ("taco", result); +// +template +internal::ReturnAction Return(R value) { + return internal::ReturnAction(std::move(value)); +} + +// Creates an action that returns NULL. +inline PolymorphicAction ReturnNull() { + return MakePolymorphicAction(internal::ReturnNullAction()); +} + +// Creates an action that returns from a void function. +inline PolymorphicAction Return() { + return MakePolymorphicAction(internal::ReturnVoidAction()); +} + +// Creates an action that returns the reference to a variable. +template +inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT + return internal::ReturnRefAction(x); +} + +// Prevent using ReturnRef on reference to temporary. +template +internal::ReturnRefAction ReturnRef(R&&) = delete; + +// Creates an action that returns the reference to a copy of the +// argument. The copy is created when the action is constructed and +// lives as long as the action. +template +inline internal::ReturnRefOfCopyAction ReturnRefOfCopy(const R& x) { + return internal::ReturnRefOfCopyAction(x); +} + +// DEPRECATED: use Return(x) directly with WillOnce. +// +// Modifies the parent action (a Return() action) to perform a move of the +// argument instead of a copy. +// Return(ByMove()) actions can only be executed once and will assert this +// invariant. +template +internal::ByMoveWrapper ByMove(R x) { + return internal::ByMoveWrapper(std::move(x)); +} + +// Creates an action that returns an element of `vals`. Calling this action will +// repeatedly return the next value from `vals` until it reaches the end and +// will restart from the beginning. +template +internal::ReturnRoundRobinAction ReturnRoundRobin(std::vector vals) { + return internal::ReturnRoundRobinAction(std::move(vals)); +} + +// Creates an action that returns an element of `vals`. Calling this action will +// repeatedly return the next value from `vals` until it reaches the end and +// will restart from the beginning. +template +internal::ReturnRoundRobinAction ReturnRoundRobin( + std::initializer_list vals) { + return internal::ReturnRoundRobinAction(std::vector(vals)); +} + +// Creates an action that does the default action for the give mock function. +inline internal::DoDefaultAction DoDefault() { + return internal::DoDefaultAction(); +} + +// Creates an action that sets the variable pointed by the N-th +// (0-based) function argument to 'value'. +template +internal::SetArgumentPointeeAction SetArgPointee(T value) { + return {std::move(value)}; +} + +// The following version is DEPRECATED. +template +internal::SetArgumentPointeeAction SetArgumentPointee(T value) { + return {std::move(value)}; +} + +// Creates an action that sets a pointer referent to a given value. +template +PolymorphicAction> Assign(T1* ptr, T2 val) { + return MakePolymorphicAction(internal::AssignAction(ptr, val)); +} + +#if !GTEST_OS_WINDOWS_MOBILE + +// Creates an action that sets errno and returns the appropriate error. +template +PolymorphicAction> SetErrnoAndReturn( + int errval, T result) { + return MakePolymorphicAction( + internal::SetErrnoAndReturnAction(errval, result)); +} + +#endif // !GTEST_OS_WINDOWS_MOBILE + +// Various overloads for Invoke(). + +// Legacy function. +// Actions can now be implicitly constructed from callables. No need to create +// wrapper objects. +// This function exists for backwards compatibility. +template +typename std::decay::type Invoke(FunctionImpl&& function_impl) { + return std::forward(function_impl); +} + +// Creates an action that invokes the given method on the given object +// with the mock function's arguments. +template +internal::InvokeMethodAction Invoke(Class* obj_ptr, + MethodPtr method_ptr) { + return {obj_ptr, method_ptr}; +} + +// Creates an action that invokes 'function_impl' with no argument. +template +internal::InvokeWithoutArgsAction::type> +InvokeWithoutArgs(FunctionImpl function_impl) { + return {std::move(function_impl)}; +} + +// Creates an action that invokes the given method on the given object +// with no argument. +template +internal::InvokeMethodWithoutArgsAction InvokeWithoutArgs( + Class* obj_ptr, MethodPtr method_ptr) { + return {obj_ptr, method_ptr}; +} + +// Creates an action that performs an_action and throws away its +// result. In other words, it changes the return type of an_action to +// void. an_action MUST NOT return void, or the code won't compile. +template +inline internal::IgnoreResultAction IgnoreResult(const A& an_action) { + return internal::IgnoreResultAction(an_action); +} + +// Creates a reference wrapper for the given L-value. If necessary, +// you can explicitly specify the type of the reference. For example, +// suppose 'derived' is an object of type Derived, ByRef(derived) +// would wrap a Derived&. If you want to wrap a const Base& instead, +// where Base is a base class of Derived, just write: +// +// ByRef(derived) +// +// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper. +// However, it may still be used for consistency with ByMove(). +template +inline ::std::reference_wrapper ByRef(T& l_value) { // NOLINT + return ::std::reference_wrapper(l_value); +} + +// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new +// instance of type T, constructed on the heap with constructor arguments +// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. +template +internal::ReturnNewAction::type...> ReturnNew( + Params&&... params) { + return {std::forward_as_tuple(std::forward(params)...)}; +} + +// Action ReturnArg() returns the k-th argument of the mock function. +template +internal::ReturnArgAction ReturnArg() { + return {}; +} + +// Action SaveArg(pointer) saves the k-th (0-based) argument of the +// mock function to *pointer. +template +internal::SaveArgAction SaveArg(Ptr pointer) { + return {pointer}; +} + +// Action SaveArgPointee(pointer) saves the value pointed to +// by the k-th (0-based) argument of the mock function to *pointer. +template +internal::SaveArgPointeeAction SaveArgPointee(Ptr pointer) { + return {pointer}; +} + +// Action SetArgReferee(value) assigns 'value' to the variable +// referenced by the k-th (0-based) argument of the mock function. +template +internal::SetArgRefereeAction::type> SetArgReferee( + T&& value) { + return {std::forward(value)}; +} + +// Action SetArrayArgument(first, last) copies the elements in +// source range [first, last) to the array pointed to by the k-th +// (0-based) argument, which can be either a pointer or an +// iterator. The action does not take ownership of the elements in the +// source range. +template +internal::SetArrayArgumentAction SetArrayArgument(I1 first, + I2 last) { + return {first, last}; +} + +// Action DeleteArg() deletes the k-th (0-based) argument of the mock +// function. +template +internal::DeleteArgAction DeleteArg() { + return {}; +} + +// This action returns the value pointed to by 'pointer'. +template +internal::ReturnPointeeAction ReturnPointee(Ptr pointer) { + return {pointer}; +} + +// Action Throw(exception) can be used in a mock function of any type +// to throw the given exception. Any copyable value can be thrown. +#if GTEST_HAS_EXCEPTIONS +template +internal::ThrowAction::type> Throw(T&& exception) { + return {std::forward(exception)}; +} +#endif // GTEST_HAS_EXCEPTIONS + +namespace internal { + +// A macro from the ACTION* family (defined later in gmock-generated-actions.h) +// defines an action that can be used in a mock function. Typically, +// these actions only care about a subset of the arguments of the mock +// function. For example, if such an action only uses the second +// argument, it can be used in any mock function that takes >= 2 +// arguments where the type of the second argument is compatible. +// +// Therefore, the action implementation must be prepared to take more +// arguments than it needs. The ExcessiveArg type is used to +// represent those excessive arguments. In order to keep the compiler +// error messages tractable, we define it in the testing namespace +// instead of testing::internal. However, this is an INTERNAL TYPE +// and subject to change without notice, so a user MUST NOT USE THIS +// TYPE DIRECTLY. +struct ExcessiveArg {}; + +// Builds an implementation of an Action<> for some particular signature, using +// a class defined by an ACTION* macro. +template +struct ActionImpl; + +template +struct ImplBase { + struct Holder { + // Allows each copy of the Action<> to get to the Impl. + explicit operator const Impl&() const { return *ptr; } + std::shared_ptr ptr; + }; + using type = typename std::conditional::value, + Impl, Holder>::type; +}; + +template +struct ActionImpl : ImplBase::type { + using Base = typename ImplBase::type; + using function_type = R(Args...); + using args_type = std::tuple; + + ActionImpl() = default; // Only defined if appropriate for Base. + explicit ActionImpl(std::shared_ptr impl) : Base{std::move(impl)} {} + + R operator()(Args&&... arg) const { + static constexpr size_t kMaxArgs = + sizeof...(Args) <= 10 ? sizeof...(Args) : 10; + return Apply(MakeIndexSequence{}, + MakeIndexSequence<10 - kMaxArgs>{}, + args_type{std::forward(arg)...}); + } + + template + R Apply(IndexSequence, IndexSequence, + const args_type& args) const { + // Impl need not be specific to the signature of action being implemented; + // only the implementing function body needs to have all of the specific + // types instantiated. Up to 10 of the args that are provided by the + // args_type get passed, followed by a dummy of unspecified type for the + // remainder up to 10 explicit args. + static constexpr ExcessiveArg kExcessArg{}; + return static_cast(*this) + .template gmock_PerformImpl< + /*function_type=*/function_type, /*return_type=*/R, + /*args_type=*/args_type, + /*argN_type=*/ + typename std::tuple_element::type...>( + /*args=*/args, std::get(args)..., + ((void)excess_id, kExcessArg)...); + } +}; + +// Stores a default-constructed Impl as part of the Action<>'s +// std::function<>. The Impl should be trivial to copy. +template +::testing::Action MakeAction() { + return ::testing::Action(ActionImpl()); +} + +// Stores just the one given instance of Impl. +template +::testing::Action MakeAction(std::shared_ptr impl) { + return ::testing::Action(ActionImpl(std::move(impl))); +} + +#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \ + , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_ +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \ + const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \ + GMOCK_INTERNAL_ARG_UNUSED, , 10) + +#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ \ + const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10) + +#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) , typename arg##i##_type +#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ \ + GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10)) + +#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) , typename param##_type +#define GMOCK_ACTION_TYPENAME_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params)) + +#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) , param##_type +#define GMOCK_ACTION_TYPE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params)) + +#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) \ + , param##_type gmock_p##i +#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params)) + +#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) \ + , std::forward(gmock_p##i) +#define GMOCK_ACTION_GVALUE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params)) + +#define GMOCK_INTERNAL_INIT_PARAM(i, data, param) \ + , param(::std::forward(gmock_p##i)) +#define GMOCK_ACTION_INIT_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params)) + +#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) param##_type param; +#define GMOCK_ACTION_FIELD_PARAMS_(params) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params) + +#define GMOCK_INTERNAL_ACTION(name, full_name, params) \ + template \ + class full_name { \ + public: \ + explicit full_name(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ + : impl_(std::make_shared( \ + GMOCK_ACTION_GVALUE_PARAMS_(params))) {} \ + full_name(const full_name&) = default; \ + full_name(full_name&&) noexcept = default; \ + template \ + operator ::testing::Action() const { \ + return ::testing::internal::MakeAction(impl_); \ + } \ + \ + private: \ + class gmock_Impl { \ + public: \ + explicit gmock_Impl(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ + : GMOCK_ACTION_INIT_PARAMS_(params) {} \ + template \ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ + GMOCK_ACTION_FIELD_PARAMS_(params) \ + }; \ + std::shared_ptr impl_; \ + }; \ + template \ + inline full_name name( \ + GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) GTEST_MUST_USE_RESULT_; \ + template \ + inline full_name name( \ + GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) { \ + return full_name( \ + GMOCK_ACTION_GVALUE_PARAMS_(params)); \ + } \ + template \ + template \ + return_type \ + full_name::gmock_Impl::gmock_PerformImpl( \ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +} // namespace internal + +// Similar to GMOCK_INTERNAL_ACTION, but no bound parameters are stored. +#define ACTION(name) \ + class name##Action { \ + public: \ + explicit name##Action() noexcept {} \ + name##Action(const name##Action&) noexcept {} \ + template \ + operator ::testing::Action() const { \ + return ::testing::internal::MakeAction(); \ + } \ + \ + private: \ + class gmock_Impl { \ + public: \ + template \ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ + }; \ + }; \ + inline name##Action name() GTEST_MUST_USE_RESULT_; \ + inline name##Action name() { return name##Action(); } \ + template \ + return_type name##Action::gmock_Impl::gmock_PerformImpl( \ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__)) + +#define ACTION_P2(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__)) + +#define ACTION_P3(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__)) + +#define ACTION_P4(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__)) + +#define ACTION_P5(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__)) + +#define ACTION_P6(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__)) + +#define ACTION_P7(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__)) + +#define ACTION_P8(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__)) + +#define ACTION_P9(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__)) + +#define ACTION_P10(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__)) + +} // namespace testing + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/example/lib/odrive/include/gmock/gmock-cardinalities.h b/example/lib/odrive/include/gmock/gmock-cardinalities.h new file mode 100644 index 0000000..b6ab648 --- /dev/null +++ b/example/lib/odrive/include/gmock/gmock-cardinalities.h @@ -0,0 +1,159 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements some commonly used cardinalities. More +// cardinalities can be defined by the user implementing the +// CardinalityInterface interface if necessary. + +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + +#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ +#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ + +#include + +#include +#include // NOLINT + +#include "gmock/internal/gmock-port.h" +#include "gtest/gtest.h" + +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + +namespace testing { + +// To implement a cardinality Foo, define: +// 1. a class FooCardinality that implements the +// CardinalityInterface interface, and +// 2. a factory function that creates a Cardinality object from a +// const FooCardinality*. +// +// The two-level delegation design follows that of Matcher, providing +// consistency for extension developers. It also eases ownership +// management as Cardinality objects can now be copied like plain values. + +// The implementation of a cardinality. +class CardinalityInterface { + public: + virtual ~CardinalityInterface() {} + + // Conservative estimate on the lower/upper bound of the number of + // calls allowed. + virtual int ConservativeLowerBound() const { return 0; } + virtual int ConservativeUpperBound() const { return INT_MAX; } + + // Returns true if and only if call_count calls will satisfy this + // cardinality. + virtual bool IsSatisfiedByCallCount(int call_count) const = 0; + + // Returns true if and only if call_count calls will saturate this + // cardinality. + virtual bool IsSaturatedByCallCount(int call_count) const = 0; + + // Describes self to an ostream. + virtual void DescribeTo(::std::ostream* os) const = 0; +}; + +// A Cardinality is a copyable and IMMUTABLE (except by assignment) +// object that specifies how many times a mock function is expected to +// be called. The implementation of Cardinality is just a std::shared_ptr +// to const CardinalityInterface. Don't inherit from Cardinality! +class GTEST_API_ Cardinality { + public: + // Constructs a null cardinality. Needed for storing Cardinality + // objects in STL containers. + Cardinality() {} + + // Constructs a Cardinality from its implementation. + explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} + + // Conservative estimate on the lower/upper bound of the number of + // calls allowed. + int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } + int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } + + // Returns true if and only if call_count calls will satisfy this + // cardinality. + bool IsSatisfiedByCallCount(int call_count) const { + return impl_->IsSatisfiedByCallCount(call_count); + } + + // Returns true if and only if call_count calls will saturate this + // cardinality. + bool IsSaturatedByCallCount(int call_count) const { + return impl_->IsSaturatedByCallCount(call_count); + } + + // Returns true if and only if call_count calls will over-saturate this + // cardinality, i.e. exceed the maximum number of allowed calls. + bool IsOverSaturatedByCallCount(int call_count) const { + return impl_->IsSaturatedByCallCount(call_count) && + !impl_->IsSatisfiedByCallCount(call_count); + } + + // Describes self to an ostream + void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } + + // Describes the given actual call count to an ostream. + static void DescribeActualCallCountTo(int actual_call_count, + ::std::ostream* os); + + private: + std::shared_ptr impl_; +}; + +// Creates a cardinality that allows at least n calls. +GTEST_API_ Cardinality AtLeast(int n); + +// Creates a cardinality that allows at most n calls. +GTEST_API_ Cardinality AtMost(int n); + +// Creates a cardinality that allows any number of calls. +GTEST_API_ Cardinality AnyNumber(); + +// Creates a cardinality that allows between min and max calls. +GTEST_API_ Cardinality Between(int min, int max); + +// Creates a cardinality that allows exactly n calls. +GTEST_API_ Cardinality Exactly(int n); + +// Creates a cardinality from its implementation. +inline Cardinality MakeCardinality(const CardinalityInterface* c) { + return Cardinality(c); +} + +} // namespace testing + +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + +#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/example/lib/odrive/include/gmock/gmock-function-mocker.h b/example/lib/odrive/include/gmock/gmock-function-mocker.h new file mode 100644 index 0000000..b568aef --- /dev/null +++ b/example/lib/odrive/include/gmock/gmock-function-mocker.h @@ -0,0 +1,514 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// This file implements MOCK_METHOD. + +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + +#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_ +#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_ + +#include // IWYU pragma: keep +#include // IWYU pragma: keep + +#include "gmock/gmock-spec-builders.h" +#include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-pp.h" + +namespace testing { +namespace internal { +template +using identity_t = T; + +template +struct ThisRefAdjuster { + template + using AdjustT = typename std::conditional< + std::is_const::type>::value, + typename std::conditional::value, + const T&, const T&&>::type, + typename std::conditional::value, T&, + T&&>::type>::type; + + template + static AdjustT Adjust(const MockType& mock) { + return static_cast>(const_cast(mock)); + } +}; + +constexpr bool PrefixOf(const char* a, const char* b) { + return *a == 0 || (*a == *b && internal::PrefixOf(a + 1, b + 1)); +} + +template +constexpr bool StartsWith(const char (&prefix)[N], const char (&str)[M]) { + return N <= M && internal::PrefixOf(prefix, str); +} + +template +constexpr bool EndsWith(const char (&suffix)[N], const char (&str)[M]) { + return N <= M && internal::PrefixOf(suffix, str + M - N); +} + +template +constexpr bool Equals(const char (&a)[N], const char (&b)[M]) { + return N == M && internal::PrefixOf(a, b); +} + +template +constexpr bool ValidateSpec(const char (&spec)[N]) { + return internal::Equals("const", spec) || + internal::Equals("override", spec) || + internal::Equals("final", spec) || + internal::Equals("noexcept", spec) || + (internal::StartsWith("noexcept(", spec) && + internal::EndsWith(")", spec)) || + internal::Equals("ref(&)", spec) || + internal::Equals("ref(&&)", spec) || + (internal::StartsWith("Calltype(", spec) && + internal::EndsWith(")", spec)); +} + +} // namespace internal + +// The style guide prohibits "using" statements in a namespace scope +// inside a header file. However, the FunctionMocker class template +// is meant to be defined in the ::testing namespace. The following +// line is just a trick for working around a bug in MSVC 8.0, which +// cannot handle it if we define FunctionMocker in ::testing. +using internal::FunctionMocker; +} // namespace testing + +#define MOCK_METHOD(...) \ + GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \ + GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \ + GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \ + GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ()) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \ + GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \ + GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \ + GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ + GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \ + GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ + GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ + GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \ + GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \ + GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \ + GMOCK_INTERNAL_GET_CALLTYPE_SPEC(_Spec), \ + GMOCK_INTERNAL_GET_REF_SPEC(_Spec), \ + (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args))) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \ + GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \ + GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \ + GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) + +#define GMOCK_INTERNAL_WRONG_ARITY(...) \ + static_assert( \ + false, \ + "MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \ + "_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \ + "enclosed in parentheses. If _Ret is a type with unprotected commas, " \ + "it must also be enclosed in parentheses.") + +#define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \ + static_assert( \ + GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \ + GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.") + +#define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \ + static_assert( \ + std::is_function<__VA_ARGS__>::value, \ + "Signature must be a function type, maybe return type contains " \ + "unprotected comma."); \ + static_assert( \ + ::testing::tuple_size::ArgumentTuple>::value == _N, \ + "This method does not take " GMOCK_PP_STRINGIZE( \ + _N) " arguments. Parenthesize all types with unprotected commas.") + +#define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec) + +#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \ + _Override, _Final, _NoexceptSpec, \ + _CallType, _RefSpec, _Signature) \ + typename ::testing::internal::Function::Result \ + GMOCK_INTERNAL_EXPAND(_CallType) \ + _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ + GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \ + GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ + GMOCK_MOCKER_(_N, _Constness, _MethodName) \ + .SetOwnerAndName(this, #_MethodName); \ + return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ + .Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \ + } \ + ::testing::MockSpec gmock_##_MethodName( \ + GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \ + GMOCK_PP_IF(_Constness, const, ) _RefSpec { \ + GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \ + return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ + .With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \ + } \ + ::testing::MockSpec gmock_##_MethodName( \ + const ::testing::internal::WithoutMatchers&, \ + GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \ + GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _RefSpec _NoexceptSpec { \ + return ::testing::internal::ThisRefAdjuster::Adjust(*this) \ + .gmock_##_MethodName(GMOCK_PP_REPEAT( \ + GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \ + } \ + mutable ::testing::FunctionMocker \ + GMOCK_MOCKER_(_N, _Constness, _MethodName) + +#define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__ + +// Valid modifiers. +#define GMOCK_INTERNAL_HAS_CONST(_Tuple) \ + GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple)) + +#define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \ + GMOCK_PP_HAS_COMMA( \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple)) + +#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \ + GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple)) + +#define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple) + +#define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \ + GMOCK_PP_IF( \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \ + _elem, ) + +#define GMOCK_INTERNAL_GET_CALLTYPE_SPEC(_Tuple) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_CALLTYPE_SPEC_IF_CALLTYPE, ~, _Tuple) + +#define GMOCK_INTERNAL_CALLTYPE_SPEC_IF_CALLTYPE(_i, _, _elem) \ + GMOCK_PP_IF( \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem)), \ + GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), ) + +#define GMOCK_INTERNAL_GET_REF_SPEC(_Tuple) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_REF_SPEC_IF_REF, ~, _Tuple) + +#define GMOCK_INTERNAL_REF_SPEC_IF_REF(_i, _, _elem) \ + GMOCK_PP_IF(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)), \ + GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), ) + +#ifdef GMOCK_INTERNAL_STRICT_SPEC_ASSERT +#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \ + static_assert( \ + ::testing::internal::ValidateSpec(GMOCK_PP_STRINGIZE(_elem)), \ + "Token \'" GMOCK_PP_STRINGIZE( \ + _elem) "\' cannot be recognized as a valid specification " \ + "modifier. Is a ',' missing?"); +#else +#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \ + static_assert( \ + (GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)) + \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem))) == 1, \ + GMOCK_PP_STRINGIZE( \ + _elem) " cannot be recognized as a valid specification modifier."); +#endif // GMOCK_INTERNAL_STRICT_SPEC_ASSERT + +// Modifiers implementation. +#define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_CONST_I_const , + +#define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override , + +#define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_FINAL_I_final , + +#define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept , + +#define GMOCK_INTERNAL_DETECT_REF(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_REF_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_REF_I_ref , + +#define GMOCK_INTERNAL_UNPACK_ref(x) x + +#define GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem) \ + GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CALLTYPE_I_, _elem) + +#define GMOCK_INTERNAL_DETECT_CALLTYPE_I_Calltype , + +#define GMOCK_INTERNAL_UNPACK_Calltype(...) __VA_ARGS__ + +// Note: The use of `identity_t` here allows _Ret to represent return types that +// would normally need to be specified in a different way. For example, a method +// returning a function pointer must be written as +// +// fn_ptr_return_t (*method(method_args_t...))(fn_ptr_args_t...) +// +// But we only support placing the return type at the beginning. To handle this, +// we wrap all calls in identity_t, so that a declaration will be expanded to +// +// identity_t method(method_args_t...) +// +// This allows us to work around the syntactic oddities of function/method +// types. +#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \ + ::testing::internal::identity_t( \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args)) + +#define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \ + GMOCK_PP_COMMA_IF(_i) \ + GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \ + GMOCK_PP_IDENTITY) \ + (_elem) + +#define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \ + GMOCK_PP_COMMA_IF(_i) \ + GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \ + gmock_a##_i + +#define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \ + GMOCK_PP_COMMA_IF(_i) \ + ::std::forward(gmock_a##_i) + +#define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \ + GMOCK_PP_COMMA_IF(_i) \ + GMOCK_INTERNAL_MATCHER_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \ + gmock_a##_i + +#define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \ + GMOCK_PP_COMMA_IF(_i) \ + gmock_a##_i + +#define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \ + GMOCK_PP_COMMA_IF(_i) \ + ::testing::A() + +#define GMOCK_INTERNAL_ARG_O(_i, ...) \ + typename ::testing::internal::Function<__VA_ARGS__>::template Arg<_i>::type + +#define GMOCK_INTERNAL_MATCHER_O(_i, ...) \ + const ::testing::Matcher::template Arg<_i>::type>& + +#define MOCK_METHOD0(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 0, __VA_ARGS__) +#define MOCK_METHOD1(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 1, __VA_ARGS__) +#define MOCK_METHOD2(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 2, __VA_ARGS__) +#define MOCK_METHOD3(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 3, __VA_ARGS__) +#define MOCK_METHOD4(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 4, __VA_ARGS__) +#define MOCK_METHOD5(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 5, __VA_ARGS__) +#define MOCK_METHOD6(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 6, __VA_ARGS__) +#define MOCK_METHOD7(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 7, __VA_ARGS__) +#define MOCK_METHOD8(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 8, __VA_ARGS__) +#define MOCK_METHOD9(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 9, __VA_ARGS__) +#define MOCK_METHOD10(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, , m, 10, __VA_ARGS__) + +#define MOCK_CONST_METHOD0(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 0, __VA_ARGS__) +#define MOCK_CONST_METHOD1(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 1, __VA_ARGS__) +#define MOCK_CONST_METHOD2(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 2, __VA_ARGS__) +#define MOCK_CONST_METHOD3(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 3, __VA_ARGS__) +#define MOCK_CONST_METHOD4(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 4, __VA_ARGS__) +#define MOCK_CONST_METHOD5(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 5, __VA_ARGS__) +#define MOCK_CONST_METHOD6(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 6, __VA_ARGS__) +#define MOCK_CONST_METHOD7(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 7, __VA_ARGS__) +#define MOCK_CONST_METHOD8(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 8, __VA_ARGS__) +#define MOCK_CONST_METHOD9(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 9, __VA_ARGS__) +#define MOCK_CONST_METHOD10(m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, , m, 10, __VA_ARGS__) + +#define MOCK_METHOD0_T(m, ...) MOCK_METHOD0(m, __VA_ARGS__) +#define MOCK_METHOD1_T(m, ...) MOCK_METHOD1(m, __VA_ARGS__) +#define MOCK_METHOD2_T(m, ...) MOCK_METHOD2(m, __VA_ARGS__) +#define MOCK_METHOD3_T(m, ...) MOCK_METHOD3(m, __VA_ARGS__) +#define MOCK_METHOD4_T(m, ...) MOCK_METHOD4(m, __VA_ARGS__) +#define MOCK_METHOD5_T(m, ...) MOCK_METHOD5(m, __VA_ARGS__) +#define MOCK_METHOD6_T(m, ...) MOCK_METHOD6(m, __VA_ARGS__) +#define MOCK_METHOD7_T(m, ...) MOCK_METHOD7(m, __VA_ARGS__) +#define MOCK_METHOD8_T(m, ...) MOCK_METHOD8(m, __VA_ARGS__) +#define MOCK_METHOD9_T(m, ...) MOCK_METHOD9(m, __VA_ARGS__) +#define MOCK_METHOD10_T(m, ...) MOCK_METHOD10(m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_T(m, ...) MOCK_CONST_METHOD0(m, __VA_ARGS__) +#define MOCK_CONST_METHOD1_T(m, ...) MOCK_CONST_METHOD1(m, __VA_ARGS__) +#define MOCK_CONST_METHOD2_T(m, ...) MOCK_CONST_METHOD2(m, __VA_ARGS__) +#define MOCK_CONST_METHOD3_T(m, ...) MOCK_CONST_METHOD3(m, __VA_ARGS__) +#define MOCK_CONST_METHOD4_T(m, ...) MOCK_CONST_METHOD4(m, __VA_ARGS__) +#define MOCK_CONST_METHOD5_T(m, ...) MOCK_CONST_METHOD5(m, __VA_ARGS__) +#define MOCK_CONST_METHOD6_T(m, ...) MOCK_CONST_METHOD6(m, __VA_ARGS__) +#define MOCK_CONST_METHOD7_T(m, ...) MOCK_CONST_METHOD7(m, __VA_ARGS__) +#define MOCK_CONST_METHOD8_T(m, ...) MOCK_CONST_METHOD8(m, __VA_ARGS__) +#define MOCK_CONST_METHOD9_T(m, ...) MOCK_CONST_METHOD9(m, __VA_ARGS__) +#define MOCK_CONST_METHOD10_T(m, ...) MOCK_CONST_METHOD10(m, __VA_ARGS__) + +#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 0, __VA_ARGS__) +#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 1, __VA_ARGS__) +#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 2, __VA_ARGS__) +#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 3, __VA_ARGS__) +#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 4, __VA_ARGS__) +#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 5, __VA_ARGS__) +#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 6, __VA_ARGS__) +#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 7, __VA_ARGS__) +#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 8, __VA_ARGS__) +#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 9, __VA_ARGS__) +#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 10, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 0, __VA_ARGS__) +#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 1, __VA_ARGS__) +#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 2, __VA_ARGS__) +#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 3, __VA_ARGS__) +#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 4, __VA_ARGS__) +#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 5, __VA_ARGS__) +#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 6, __VA_ARGS__) +#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 7, __VA_ARGS__) +#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 8, __VA_ARGS__) +#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 9, __VA_ARGS__) +#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ + GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 10, __VA_ARGS__) + +#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__) + +#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__) +#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ + MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__) + +#define GMOCK_INTERNAL_MOCK_METHODN(constness, ct, Method, args_num, ...) \ + GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ + args_num, ::testing::internal::identity_t<__VA_ARGS__>); \ + GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ + args_num, Method, GMOCK_PP_NARG0(constness), 0, 0, , ct, , \ + (::testing::internal::identity_t<__VA_ARGS__>)) + +#define GMOCK_MOCKER_(arity, constness, Method) \ + GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) + +#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_ diff --git a/example/lib/odrive/include/gmock/gmock-matchers.h b/example/lib/odrive/include/gmock/gmock-matchers.h new file mode 100644 index 0000000..5faf8dc --- /dev/null +++ b/example/lib/odrive/include/gmock/gmock-matchers.h @@ -0,0 +1,5625 @@ +// Copyright 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Google Mock - a framework for writing C++ mock classes. +// +// The MATCHER* family of macros can be used in a namespace scope to +// define custom matchers easily. +// +// Basic Usage +// =========== +// +// The syntax +// +// MATCHER(name, description_string) { statements; } +// +// defines a matcher with the given name that executes the statements, +// which must return a bool to indicate if the match succeeds. Inside +// the statements, you can refer to the value being matched by 'arg', +// and refer to its type by 'arg_type'. +// +// The description string documents what the matcher does, and is used +// to generate the failure message when the match fails. Since a +// MATCHER() is usually defined in a header file shared by multiple +// C++ source files, we require the description to be a C-string +// literal to avoid possible side effects. It can be empty, in which +// case we'll use the sequence of words in the matcher name as the +// description. +// +// For example: +// +// MATCHER(IsEven, "") { return (arg % 2) == 0; } +// +// allows you to write +// +// // Expects mock_foo.Bar(n) to be called where n is even. +// EXPECT_CALL(mock_foo, Bar(IsEven())); +// +// or, +// +// // Verifies that the value of some_expression is even. +// EXPECT_THAT(some_expression, IsEven()); +// +// If the above assertion fails, it will print something like: +// +// Value of: some_expression +// Expected: is even +// Actual: 7 +// +// where the description "is even" is automatically calculated from the +// matcher name IsEven. +// +// Argument Type +// ============= +// +// Note that the type of the value being matched (arg_type) is +// determined by the context in which you use the matcher and is +// supplied to you by the compiler, so you don't need to worry about +// declaring it (nor can you). This allows the matcher to be +// polymorphic. For example, IsEven() can be used to match any type +// where the value of "(arg % 2) == 0" can be implicitly converted to +// a bool. In the "Bar(IsEven())" example above, if method Bar() +// takes an int, 'arg_type' will be int; if it takes an unsigned long, +// 'arg_type' will be unsigned long; and so on. +// +// Parameterizing Matchers +// ======================= +// +// Sometimes you'll want to parameterize the matcher. For that you +// can use another macro: +// +// MATCHER_P(name, param_name, description_string) { statements; } +// +// For example: +// +// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } +// +// will allow you to write: +// +// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); +// +// which may lead to this message (assuming n is 10): +// +// Value of: Blah("a") +// Expected: has absolute value 10 +// Actual: -9 +// +// Note that both the matcher description and its parameter are +// printed, making the message human-friendly. +// +// In the matcher definition body, you can write 'foo_type' to +// reference the type of a parameter named 'foo'. For example, in the +// body of MATCHER_P(HasAbsoluteValue, value) above, you can write +// 'value_type' to refer to the type of 'value'. +// +// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to +// support multi-parameter matchers. +// +// Describing Parameterized Matchers +// ================================= +// +// The last argument to MATCHER*() is a string-typed expression. The +// expression can reference all of the matcher's parameters and a +// special bool-typed variable named 'negation'. When 'negation' is +// false, the expression should evaluate to the matcher's description; +// otherwise it should evaluate to the description of the negation of +// the matcher. For example, +// +// using testing::PrintToString; +// +// MATCHER_P2(InClosedRange, low, hi, +// std::string(negation ? "is not" : "is") + " in range [" + +// PrintToString(low) + ", " + PrintToString(hi) + "]") { +// return low <= arg && arg <= hi; +// } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: is in range [4, 6] +// ... +// Expected: is not in range [2, 4] +// +// If you specify "" as the description, the failure message will +// contain the sequence of words in the matcher name followed by the +// parameter values printed as a tuple. For example, +// +// MATCHER_P2(InClosedRange, low, hi, "") { ... } +// ... +// EXPECT_THAT(3, InClosedRange(4, 6)); +// EXPECT_THAT(3, Not(InClosedRange(2, 4))); +// +// would generate two failures that contain the text: +// +// Expected: in closed range (4, 6) +// ... +// Expected: not (in closed range (2, 4)) +// +// Types of Matcher Parameters +// =========================== +// +// For the purpose of typing, you can view +// +// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } +// +// as shorthand for +// +// template +// FooMatcherPk +// Foo(p1_type p1, ..., pk_type pk) { ... } +// +// When you write Foo(v1, ..., vk), the compiler infers the types of +// the parameters v1, ..., and vk for you. If you are not happy with +// the result of the type inference, you can specify the types by +// explicitly instantiating the template, as in Foo(5, +// false). As said earlier, you don't get to (or need to) specify +// 'arg_type' as that's determined by the context in which the matcher +// is used. You can assign the result of expression Foo(p1, ..., pk) +// to a variable of type FooMatcherPk. This +// can be useful when composing matchers. +// +// While you can instantiate a matcher template with reference types, +// passing the parameters by pointer usually makes your code more +// readable. If, however, you still want to pass a parameter by +// reference, be aware that in the failure message generated by the +// matcher you will see the value of the referenced object but not its +// address. +// +// Explaining Match Results +// ======================== +// +// Sometimes the matcher description alone isn't enough to explain why +// the match has failed or succeeded. For example, when expecting a +// long string, it can be very helpful to also print the diff between +// the expected string and the actual one. To achieve that, you can +// optionally stream additional information to a special variable +// named result_listener, whose type is a pointer to class +// MatchResultListener: +// +// MATCHER_P(EqualsLongString, str, "") { +// if (arg == str) return true; +// +// *result_listener << "the difference: " +/// << DiffStrings(str, arg); +// return false; +// } +// +// Overloading Matchers +// ==================== +// +// You can overload matchers with different numbers of parameters: +// +// MATCHER_P(Blah, a, description_string1) { ... } +// MATCHER_P2(Blah, a, b, description_string2) { ... } +// +// Caveats +// ======= +// +// When defining a new matcher, you should also consider implementing +// MatcherInterface or using MakePolymorphicMatcher(). These +// approaches require more work than the MATCHER* macros, but also +// give you more control on the types of the value being matched and +// the matcher parameters, which may leads to better compiler error +// messages when the matcher is used wrong. They also allow +// overloading matchers based on parameter types (as opposed to just +// based on the number of parameters). +// +// MATCHER*() can only be used in a namespace scope as templates cannot be +// declared inside of a local class. +// +// More Information +// ================ +// +// To learn more about using these macros, please search for 'MATCHER' +// on +// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md +// +// This file also implements some commonly used argument matchers. More +// matchers can be defined by the user implementing the +// MatcherInterface interface if necessary. +// +// See googletest/include/gtest/gtest-matchers.h for the definition of class +// Matcher, class MatcherInterface, and others. + +// IWYU pragma: private, include "gmock/gmock.h" +// IWYU pragma: friend gmock/.* + +#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ +#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ + +#include +#include +#include +#include +#include +#include +#include // NOLINT +#include +#include +#include +#include +#include + +#include "gmock/internal/gmock-internal-utils.h" +#include "gmock/internal/gmock-port.h" +#include "gmock/internal/gmock-pp.h" +#include "gtest/gtest.h" + +// MSVC warning C5046 is new as of VS2017 version 15.8. +#if defined(_MSC_VER) && _MSC_VER >= 1915 +#define GMOCK_MAYBE_5046_ 5046 +#else +#define GMOCK_MAYBE_5046_ +#endif + +GTEST_DISABLE_MSC_WARNINGS_PUSH_( + 4251 GMOCK_MAYBE_5046_ /* class A needs to have dll-interface to be used by + clients of class B */ + /* Symbol involving type with internal linkage not defined */) + +namespace testing { + +// To implement a matcher Foo for type T, define: +// 1. a class FooMatcherImpl that implements the +// MatcherInterface interface, and +// 2. a factory function that creates a Matcher object from a +// FooMatcherImpl*. +// +// The two-level delegation design makes it possible to allow a user +// to write "v" instead of "Eq(v)" where a Matcher is expected, which +// is impossible if we pass matchers by pointers. It also eases +// ownership management as Matcher objects can now be copied like +// plain values. + +// A match result listener that stores the explanation in a string. +class StringMatchResultListener : public MatchResultListener { + public: + StringMatchResultListener() : MatchResultListener(&ss_) {} + + // Returns the explanation accumulated so far. + std::string str() const { return ss_.str(); } + + // Clears the explanation accumulated so far. + void Clear() { ss_.str(""); } + + private: + ::std::stringstream ss_; + + StringMatchResultListener(const StringMatchResultListener&) = delete; + StringMatchResultListener& operator=(const StringMatchResultListener&) = + delete; +}; + +// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION +// and MUST NOT BE USED IN USER CODE!!! +namespace internal { + +// The MatcherCastImpl class template is a helper for implementing +// MatcherCast(). We need this helper in order to partially +// specialize the implementation of MatcherCast() (C++ allows +// class/struct templates to be partially specialized, but not +// function templates.). + +// This general version is used when MatcherCast()'s argument is a +// polymorphic matcher (i.e. something that can be converted to a +// Matcher but is not one yet; for example, Eq(value)) or a value (for +// example, "hello"). +template +class MatcherCastImpl { + public: + static Matcher Cast(const M& polymorphic_matcher_or_value) { + // M can be a polymorphic matcher, in which case we want to use + // its conversion operator to create Matcher. Or it can be a value + // that should be passed to the Matcher's constructor. + // + // We can't call Matcher(polymorphic_matcher_or_value) when M is a + // polymorphic matcher because it'll be ambiguous if T has an implicit + // constructor from M (this usually happens when T has an implicit + // constructor from any type). + // + // It won't work to unconditionally implicit_cast + // polymorphic_matcher_or_value to Matcher because it won't trigger + // a user-defined conversion from M to T if one exists (assuming M is + // a value). + return CastImpl(polymorphic_matcher_or_value, + std::is_convertible>{}, + std::is_convertible{}); + } + + private: + template + static Matcher CastImpl(const M& polymorphic_matcher_or_value, + std::true_type /* convertible_to_matcher */, + std::integral_constant) { + // M is implicitly convertible to Matcher, which means that either + // M is a polymorphic matcher or Matcher has an implicit constructor + // from M. In both cases using the implicit conversion will produce a + // matcher. + // + // Even if T has an implicit constructor from M, it won't be called because + // creating Matcher would require a chain of two user-defined conversions + // (first to create T from M and then to create Matcher from T). + return polymorphic_matcher_or_value; + } + + // M can't be implicitly converted to Matcher, so M isn't a polymorphic + // matcher. It's a value of a type implicitly convertible to T. Use direct + // initialization to create a matcher. + static Matcher CastImpl(const M& value, + std::false_type /* convertible_to_matcher */, + std::true_type /* convertible_to_T */) { + return Matcher(ImplicitCast_(value)); + } + + // M can't be implicitly converted to either Matcher or T. Attempt to use + // polymorphic matcher Eq(value) in this case. + // + // Note that we first attempt to perform an implicit cast on the value and + // only fall back to the polymorphic Eq() matcher afterwards because the + // latter calls bool operator==(const Lhs& lhs, const Rhs& rhs) in the end + // which might be undefined even when Rhs is implicitly convertible to Lhs + // (e.g. std::pair vs. std::pair). + // + // We don't define this method inline as we need the declaration of Eq(). + static Matcher CastImpl(const M& value, + std::false_type /* convertible_to_matcher */, + std::false_type /* convertible_to_T */); +}; + +// This more specialized version is used when MatcherCast()'s argument +// is already a Matcher. This only compiles when type T can be +// statically converted to type U. +template +class MatcherCastImpl> { + public: + static Matcher Cast(const Matcher& source_matcher) { + return Matcher(new Impl(source_matcher)); + } + + private: + class Impl : public MatcherInterface { + public: + explicit Impl(const Matcher& source_matcher) + : source_matcher_(source_matcher) {} + + // We delegate the matching logic to the source matcher. + bool MatchAndExplain(T x, MatchResultListener* listener) const override { + using FromType = typename std::remove_cv::type>::type>::type; + using ToType = typename std::remove_cv::type>::type>::type; + // Do not allow implicitly converting base*/& to derived*/&. + static_assert( + // Do not trigger if only one of them is a pointer. That implies a + // regular conversion and not a down_cast. + (std::is_pointer::type>::value != + std::is_pointer::type>::value) || + std::is_same::value || + !std::is_base_of::value, + "Can't implicitly convert from to "); + + // Do the cast to `U` explicitly if necessary. + // Otherwise, let implicit conversions do the trick. + using CastType = + typename std::conditional::value, + T&, U>::type; + + return source_matcher_.MatchAndExplain(static_cast(x), + listener); + } + + void DescribeTo(::std::ostream* os) const override { + source_matcher_.DescribeTo(os); + } + + void DescribeNegationTo(::std::ostream* os) const override { + source_matcher_.DescribeNegationTo(os); + } + + private: + const Matcher source_matcher_; + }; +}; + +// This even more specialized version is used for efficiently casting +// a matcher to its own type. +template +class MatcherCastImpl> { + public: + static Matcher Cast(const Matcher& matcher) { return matcher; } +}; + +// Template specialization for parameterless Matcher. +template +class MatcherBaseImpl { + public: + MatcherBaseImpl() = default; + + template + operator ::testing::Matcher() const { // NOLINT(runtime/explicit) + return ::testing::Matcher(new + typename Derived::template gmock_Impl()); + } +}; + +// Template specialization for Matcher with parameters. +template