Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CMakePresets.json 対応 #271

Merged
merged 4 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"build/": true
},
"cmake.configureOnOpen": true,
"cmake.useCMakePresets": "always",
"C_Cpp.clang_format_style": "file",
"C_Cpp.default.cppStandard": "c++14",
"C_Cpp.doxygen.generatedStyle": "/**",
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ target_sources(spirit
./src/spirit/src/SpeedDataConverter.cpp
)

enable_testing()

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
add_subdirectory(tests)
endif()

Expand Down
55 changes: 55 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20
},
"configurePresets": [
{
"name": "Debug",
"displayName": "Debug",
"description": "Configure project for debugging",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"binaryDir": "${sourceDir}/build/${presetName}"
},
{
"name": "Release",
"displayName": "Release",
"description": "Configure project for release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
},
"binaryDir": "${sourceDir}/build/${presetName}"
}
],
"buildPresets": [
{
"name": "Debug",
"displayName": "Debug",
"description": "Build project for debugging",
"configurePreset": "Debug"
},
{
"name": "Release",
"displayName": "Release",
"description": "Build project for release",
"configurePreset": "Release"
}
],
"testPresets": [
{
"name": "Debug",
"displayName": "Debug",
"description": "Test project in debug mode",
"configurePreset": "Debug"
},
{
"name": "Release",
"displayName": "Release",
"description": "Test project in release mode",
"configurePreset": "Release"
}
]
}
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ flowchart TB

最終的にはMbed/Arduino等での利用を想定していますが、自動テストを非マイコンで行う都合上、可能な限り特定の環境への依存を減らしています


## 💻 Supported platforms

下記の環境では多分動きます
Expand All @@ -48,10 +47,12 @@ flowchart TB

リポジトリのルートディレクトリで下の手順を行うことで、ビルドからテストの実行ができます

プリセットは `Debug` と `Release` の2種類があります

```shell
cmake -S . -B build # Configurate & Generate
cmake --build build # Build
ctest --test-dir build # Test
cmake -S . --preset Debug # Configurate & Generate
cmake --build --preset Debug # Build
ctest --preset Debug # Test
```

テストフレームワークとして Google Test を利用しています
Expand Down