Skip to content

Commit 33b4091

Browse files
committed
refactor: include fakeit with cmake
1 parent 5e5787b commit 33b4091

File tree

9 files changed

+29
-10071
lines changed

9 files changed

+29
-10071
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
cmake_minimum_required(VERSION 3.2.2)
22
project(ArduinoFake VERSION 0.1)
33

4-
set(CMAKE_CXX_STANDARD 11)
4+
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66

77
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
88

99
# Include external libs
10-
add_subdirectory(external)
10+
add_subdirectory(external/fakeit)
11+
add_subdirectory(external/unity)
1112

1213
# Targets that we develop here
1314
enable_testing()

external/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Include external libs
22
add_subdirectory(unity)
3+
add_subdirectory(fakeit)

external/fakeit/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_minimum_required(VERSION 3.2.2)
2+
project(fakeit VERSION 2.4.0 LANGUAGES CXX)
3+
4+
include(git-download)
5+
6+
set(REPO_DIR ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-repo)
7+
8+
download_repo(
9+
URL "https://github.com/eranpeer/FakeIt.git"
10+
TAG ${PROJECT_VERSION}
11+
CLONE_DIR ${REPO_DIR}
12+
)
13+
14+
add_library(${PROJECT_NAME} INTERFACE)
15+
16+
target_include_directories(${PROJECT_NAME} INTERFACE
17+
${REPO_DIR}/single_header/standalone/
18+
)

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[env:native]
22
platform = native
3-
build_flags = -std=gnu++11
3+
build_flags = -std=gnu++17
44
test_build_src = yes

src/ArduinoFake.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#define USBCON
55
#endif
66

7-
#include <map>
7+
#include <unordered_map>
88
#include <cstring>
99
#include <cstdint>
1010
#include <stdexcept>
11-
#include "fakeit/fakeit.hpp"
11+
#include <fakeit.hpp>
1212

1313
#include "arduino/Arduino.h"
1414

@@ -91,7 +91,7 @@ class ArduinoFakeContext
9191
public:
9292
ArduinoFakeInstances* Instances = new ArduinoFakeInstances();
9393
ArduinoFakeMocks* Mocks = new ArduinoFakeMocks();
94-
std::map<void*, void*> Mapping;
94+
std::unordered_map<void*, void*> Mapping;
9595

9696
_ArduinoFakeInstanceGetter1(Print)
9797
_ArduinoFakeInstanceGetter1(Stream)

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ aux_source_directory(./fakeit SRC_LIST)
33
aux_source_directory(./arduino SRC_LIST)
44

55
add_library(${PROJECT_NAME} SHARED ${SRC_LIST})
6+
7+
target_link_libraries(${PROJECT_NAME} fakeit)

src/FunctionFake.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "fakeit/fakeit.hpp"
3+
#include <fakeit.hpp>
44

55
struct FunctionFake
66
{

src/fakeit/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)