Skip to content

Commit

Permalink
builds
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishKittur committed Nov 14, 2024
2 parents c01c64b + 49101e1 commit 11e641b
Show file tree
Hide file tree
Showing 53 changed files with 3,962 additions and 1,650 deletions.
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BasedOnStyle: LLVM # or Google, Mozilla, etc.
IndentWidth: 4
TabWidth: 4
UseTab: Never # Ensures spaces instead of tabs are used
BreakBeforeBraces: Attach # Optional, adjust brace style
AllowShortFunctionsOnASingleLine: Empty
ColumnLimit: 100 # Adjust if desired
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generate doxygen docs and deploy to github pages

on:
push:
branches:
- master

jobs:

gen_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Generate docs
uses: mattnotmitt/[email protected]
with:
doxyfile-path: 'Doxyfile'


- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y graphviz

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html # Set this to the Doxygen output directory
keep_files: false # Set to true to keep files that are not in the Doxygen output directory
24 changes: 24 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Unit Tests

on:
push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: cachix/install-nix-action@v29

- name: Checkout repository
uses: actions/checkout@v4
with:
repository: hytech-racing/drivebrain_software
ref: ${{ github.ref }}

- name: Build and test
run: |
nix develop --command bash -c 'mkdir -p build && cd build && cmake .. && make -j && ctest --output-on-failure'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ result-dev
result-dev/
*.mcap
core.*
result-man/
result-man
.cache/
111 changes: 63 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ set(CMAKE_INCLUDE_HEADERS_IN_COMPILE_COMMANDS ON)
### just like "include what you use" and do "find what you use"

## hytech's upstream libraries
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)



### generated via nix-proto from hytech's generated CAN protobufs
find_package(hytech_np_proto_cpp CONFIG REQUIRED)
Expand All @@ -28,53 +32,27 @@ find_package(nlohmann_json REQUIRED)
find_package(Boost REQUIRED COMPONENTS system program_options)
find_package(protobuf REQUIRED)
find_package(GTest REQUIRED)

find_package(mcap REQUIRED)

# custom packaged libraries, code didnt require changes just the packaging
find_package(dbcppp CONFIG REQUIRED)
find_package(foxglove_websocket REQUIRED)
find_package(cmake_macros REQUIRED)

find_package(GTest REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_package(db_service_grpc_cpp REQUIRED)
find_package(codegen REQUIRED)

find_package(drivebrain_core REQUIRED)

include(create_package)

#####################
# created libraries #
#####################

# drivebrain core library
add_library(drivebrain_core SHARED
drivebrain_core_base/src/JsonFileHandler.cpp
drivebrain_core_base/src/Configurable.cpp
drivebrain_core_base/src/StateEstimator.cpp
drivebrain_core_base/src/Logger.cpp)

target_include_directories(drivebrain_core PUBLIC
$<INSTALL_INTERFACE:drivebrain_core_base/include/public>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_base/include/public>
)

# right now we dont want to expose the json file handler directly to all of the
# components of drivebrain

target_include_directories(drivebrain_core PRIVATE
$<INSTALL_INTERFACE:drivebrain_core_base/include/private>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_base/include/private>
)

target_link_libraries(drivebrain_core PUBLIC
nlohmann_json::nlohmann_json
Boost::boost
Boost::system
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
hytech_np_proto_cpp::hytech_np_proto_cpp
)

make_cmake_package(drivebrain_core drivebrain)


# utils
add_library(drivebrain_common_utils SHARED
drivebrain_core_impl/drivebrain_common_utils/src/ProtobufUtils.cpp
)
Expand All @@ -86,6 +64,7 @@ target_include_directories(drivebrain_common_utils PUBLIC

target_link_libraries(drivebrain_common_utils PUBLIC
protobuf::libprotobuf
spdlog::spdlog
)

make_cmake_package(drivebrain_common_utils drivebrain)
Expand Down Expand Up @@ -113,7 +92,7 @@ target_include_directories(drivebrain_comms PUBLIC
)

target_link_libraries(drivebrain_comms PUBLIC
drivebrain_core
drivebrain_core::drivebrain_core
drivebrain_common_utils
gRPC::grpc++_reflection
foxglove_websocket::foxglove_websocket
Expand All @@ -123,7 +102,8 @@ target_link_libraries(drivebrain_comms PUBLIC
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
db_service_grpc_cpp::db_service_grpc_cpp
libvncxx::libvncxx

drivebrain_estimation
spdlog::spdlog
)

make_cmake_package(drivebrain_comms drivebrain)
Expand All @@ -137,7 +117,7 @@ target_include_directories(drivebrain_control PUBLIC
)

target_link_libraries(drivebrain_control PUBLIC
drivebrain_core
drivebrain_core::drivebrain_core
hytech_np_proto_cpp::hytech_np_proto_cpp
protobuf::libprotobuf
)
Expand All @@ -151,21 +131,38 @@ target_include_directories(drivebrain_mcap_logger PUBLIC
)

target_link_libraries(drivebrain_mcap_logger PUBLIC
drivebrain_core
drivebrain_core::drivebrain_core
drivebrain_common_utils
protobuf::libprotobuf
mcap::mcap

)
target_link_libraries(drivebrain_mcap_logger INTERFACE
mcap::mcap
)

target_include_directories(drivebrain_mcap_logger PUBLIC
$<INSTALL_INTERFACE:version_header>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/version_header>
)
make_cmake_package(drivebrain_mcap_logger drivebrain)

add_library(drivebrain_estimation SHARED
drivebrain_core_impl/drivebrain_estimation/src/StateEstimator.cpp
)

target_include_directories(drivebrain_estimation PUBLIC
$<INSTALL_INTERFACE:drivebrain_core_impl/drivebrain_estimation/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_impl/drivebrain_estimation/include>
)

target_link_libraries(drivebrain_estimation PUBLIC
drivebrain_core::drivebrain_core
drivebrain_common_utils
codegen::Tire_Model_Codegen
codegen::matlab_model
hytech_np_proto_cpp::hytech_np_proto_cpp
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
protobuf::libprotobuf
)

make_cmake_package(drivebrain_estimation drivebrain)

###############
# executables #
Expand Down Expand Up @@ -208,13 +205,13 @@ target_link_libraries(test_db_grpc PUBLIC
)


add_executable(test_mcap test/test_mcap/test_mcap_logging.cpp test/test_mcap/BuildFileDescriptorSet.cpp)
# add_executable(test_mcap test/test_mcap/test_mcap_logging.cpp test/test_mcap/BuildFileDescriptorSet.cpp)

target_link_libraries(test_mcap PUBLIC
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
protobuf::libprotobuf
mcap::mcap
)
# target_link_libraries(test_mcap PUBLIC
# drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
# protobuf::libprotobuf
# mcap::mcap
# )

set(CMAKE_CXX_STANDARD 17)
add_executable(test_vn test/test_vn.cpp)
Expand All @@ -232,14 +229,32 @@ target_compile_features(test_vn PUBLIC cxx_std_11)

add_executable(alpha_build drivebrain_app/main.cpp)

enable_testing()

add_executable(alpha_test
unit_test/main.cpp
unit_test/SimpleControllerTest.cpp
)

target_link_libraries(alpha_build PUBLIC
drivebrain_core
drivebrain_core::drivebrain_core
drivebrain_control
drivebrain_comms
drivebrain_mcap_logger
Boost::program_options
)


target_link_libraries(alpha_test PUBLIC
drivebrain_core::drivebrain_core
drivebrain_control
drivebrain_comms
Boost::program_options
gtest
)

add_test(NAME MyTest COMMAND alpha_test)

target_link_libraries(mcu_standin PUBLIC
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
protobuf::libprotobuf
Expand All @@ -250,4 +265,4 @@ include(GNUInstallDirs)
install(TARGETS
alpha_build
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR})
DESTINATION ${CMAKE_INSTALL_BINDIR})
Loading

0 comments on commit 11e641b

Please sign in to comment.