-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Employ new directory structure - Move some stuff around Topic: directory-reorg Relative: Reviewers:
- Loading branch information
1 parent
fce54ea
commit c7ca508
Showing
39 changed files
with
72 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,7 @@ | |
*.out | ||
*.app | ||
|
||
build/ | ||
build/ | ||
|
||
# Bazel files | ||
bazel-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,63 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
set(This MAINS) | ||
set(BINARY ${CMAKE_PROJECT_NAME}) | ||
|
||
project(${This} C CXX) | ||
|
||
set(CMAKE_C_STANDARD 99) | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(BUILD_GMOCK ON) | ||
|
||
# enable Werror | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") | ||
|
||
enable_testing() | ||
|
||
# add the googletest subdirectory, located in the lib folder tree that is one level above this one | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest) | ||
|
||
# set the HEADERS as everything in the inc folder, as well as test *.hpp files | ||
file(GLOB HEADERS "inc/*.hpp") | ||
|
||
# set the SOURCES as everything in the src folder | ||
file(GLOB SOURCES "src/*.cpp") | ||
|
||
# add_executable(${BINARY}_run ${SOURCES}) | ||
add_library(${This} STATIC ${SOURCES} ${HEADERS}) | ||
|
||
add_subdirectory(test) | ||
|
||
# To find the tests, this is rquired | ||
include_directories(inc) | ||
include_directories(src) | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
set(This tests) | ||
|
||
set(BINARY ${CMAKE_PROJECT_NAME}) | ||
|
||
project(${This} C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_C_STANDARD 99) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(BUILD_GMOCK ON) | ||
|
||
#enable Werror, Wextra, Wall, pedantic, and pedantic-errors | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wextra -Wall") | ||
|
||
# enable testing | ||
enable_testing() | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest) | ||
|
||
# Glob recurse the headers inside hal/ | ||
file(GLOB_RECURSE HAL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/hal/*.hpp) | ||
|
||
# Glob recurse the headers inside hwbridge/ | ||
file(GLOB_RECURSE HWBRIDGE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/hwbridge/*.hpp) | ||
|
||
# Glob recurse the headers inside control_loop/ | ||
file(GLOB_RECURSE CONTROL_LOOP_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/control_loop/*.hpp) | ||
# Glob recurse the sources inside control_loop/ | ||
file(GLOB_RECURSE CONTROL_LOOP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/control_loop/*.cpp) | ||
|
||
# Glob recurse the headers inside utils/ | ||
file(GLOB_RECURSE UTILS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/util/*.hpp) | ||
# Glob recurse the sources inside utils/ | ||
file(GLOB_RECURSE UTILS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/util/*.cpp) | ||
|
||
# Add a compiler definition -DUNITTEST to the compiler | ||
add_definitions(-DUNIT_TEST) | ||
|
||
# Glob recurse the headers inside test/ | ||
file(GLOB_RECURSE TEST_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.hpp) | ||
# Glob recurse the sources inside test/ | ||
file(GLOB_RECURSE TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp) | ||
|
||
# Include the headers in the above paths and also do so recursively as there is a hierarchy | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hal) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hwbridge/3phase) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hwbridge/h_bridge) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/control_loop) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/control_loop/brushed) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/control_loop/bldc) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/control_loop/stepper) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util/pid) | ||
|
||
# Mocks | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test/mocks) | ||
|
||
# Add an executable with the above sources | ||
add_executable(${This} ${CONTROL_LOOP_SOURCES} ${UTILS_SOURCES} ${TEST_SOURCES}) | ||
|
||
# Link the executable with the GoogleTest libraries | ||
target_link_libraries(${This} PUBLIC gtest gtest_main gmock) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
src/brushed_control_loop.cpp → ...rol_loop/brushed/brushed_control_loop.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
src/stepper_control_loop.cpp → ...rol_loop/stepper/stepper_control_loop.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#include "stepper_control_loop.hpp" | ||
|
||
#include "math.h" | ||
#include "param_service.hpp" | ||
|
||
namespace control_loop { | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +0,0 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
set(This tests) | ||
|
||
# set the test sources to everything in this folder that is cpp | ||
file(GLOB SOURCES "*.cpp") | ||
# add the main project sources in ../src to the test sources | ||
file(GLOB MAIN_SOURCES "../src/*.cpp") | ||
|
||
# include the headers from the main project, which is located at "../inc/" | ||
include_directories(../inc) | ||
include_directories((../test/)) | ||
|
||
add_test( | ||
NAME ${This} | ||
COMMAND ${This} | ||
) | ||
|
||
# add compiler definition for UNIT_TEST | ||
add_definitions(-DUNIT_TEST) | ||
|
||
add_executable(${This} ${SOURCES} ${MAIN_SOURCES}) | ||
target_link_libraries(${This} PUBLIC gtest_main gtest gmock) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.