Skip to content

Commit

Permalink
update project structure to STM32CubeMX generated CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
benedekkupper committed Jul 6, 2024
1 parent 42b4558 commit d26555e
Show file tree
Hide file tree
Showing 39 changed files with 3,185 additions and 3,079 deletions.
38 changes: 38 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
BasedOnStyle: LLVM
ColumnLimit: 100
---
Language: Cpp
Standard: c++20
IndentWidth: 4
PPIndentWidth: 4
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentRequiresClause: true
DerivePointerAlignment: false
PointerAlignment: Left
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterStruct: true
AfterUnion: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterExternBlock: true
AfterCaseLabel: true
AfterControlStatement: Always
BeforeElse: true
BeforeCatch: true
BeforeLambdaBody: true
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
PackConstructorInitializers: NextLine
AlwaysBreakTemplateDeclarations: Yes
IncludeCategories:
- Regex: '^<([a-z]+)>'
Priority: 0
FixNamespaceComments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: Inline
ShortNamespaceLines: 1
216 changes: 0 additions & 216 deletions .cproject

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/cmake-gcc-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake on a single platform

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- name: Git checkout recursively
uses: actions/checkout@v4
with:
submodules: true

- name: Install ARM GCC toolchain
run: |
sudo apt update
sudo apt install -y gcc-arm-none-eabi
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ build
doc/*
/Debug/
/Release/

.vscode/
47 changes: 21 additions & 26 deletions .mxproject

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.22)

# Setup compiler settings
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

# Define the build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

# Include toolchain file
include("cmake/gcc-arm-none-eabi.cmake")

# Enable compile command to ease indexing with e.g. clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

# Enable CMake support for ASM and C languages
enable_language(C CXX ASM)

project(ProntoInfrared)

add_executable(${PROJECT_NAME})

add_subdirectory(cmake/stm32cubemx)
add_subdirectory(etl)
add_subdirectory(${PROJECT_NAME})

target_include_directories(${PROJECT_NAME} PRIVATE
stm32header
)

target_link_libraries(${PROJECT_NAME}
stm32cubemx
etl
)
61 changes: 61 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "Debug",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "RelWithDebInfo",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "Release",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "MinSizeRel",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "MinSizeRel"
}
}
],
"buildPresets": [
{
"name": "Debug",
"configurePreset": "Debug"
},
{
"name": "RelWithDebInfo",
"configurePreset": "RelWithDebInfo"
},
{
"name": "Release",
"configurePreset": "Release"
},
{
"name": "MinSizeRel",
"configurePreset": "MinSizeRel"
}
]
}
200 changes: 0 additions & 200 deletions Code/infrared_config_stm32.h

This file was deleted.

Loading

0 comments on commit d26555e

Please sign in to comment.