Skip to content

Commit fc36f4f

Browse files
committed
finish implementation
1 parent 400331b commit fc36f4f

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(CMAKE_C_STANDARD 11)
1212
set(CMAKE_C_STANDARD_REQUIRED ON)
1313
set(CMAKE_C_EXTENSIONS ON)
1414

15-
if(NOT DEFINED CMAKE_BUILD_TYPE)
15+
if(NOT DEFINED CMAKE_PRESET_NAME)
1616
message(
1717
FATAL_ERROR
1818
"This project requires configuration using a CMake preset. Please use 'cmake --preset <preset-name>' or select a preset in your IDE."
@@ -51,6 +51,12 @@ message(
5151
${CMAKE_BUILD_TYPE}
5252
)
5353

54+
message(
55+
STATUS
56+
"Active CMake Preset: "
57+
${CMAKE_PRESET_NAME}
58+
)
59+
5460
# Projects
5561
add_gr_project(STM32G474xE ECU)
5662

CMakePresets.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
"generator": "Ninja",
88
"binaryDir": "${sourceDir}/build/${presetName}",
99
"toolchainFile": "${sourceDir}/Lib/cmake/gcc-arm-none-eabi.cmake",
10-
"cacheVariables": {}
10+
"cacheVariables": {
11+
"TARGET_TYPE": "Embedded",
12+
"CMAKE_PRESET_NAME": "${presetName}"
13+
}
1114
},
1215
{
1316
"name": "HOOTLTest",
1417
"generator": "Ninja",
1518
"binaryDir": "${sourceDir}/build/${presetName}",
1619
"toolchainFile": "${sourceDir}/Lib/cmake/HOOTL.cmake",
1720
"cacheVariables": {
18-
"CMAKE_BUILD_TYPE": "Debug"
21+
"CMAKE_BUILD_TYPE": "Debug",
22+
"TARGET_TYPE": "Host",
23+
"CMAKE_PRESET_NAME": "${presetName}"
1924
}
2025
},
2126
{

ECU/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif()
1313
# what, does in fact not get the filename of somthing but rather the name of the project from the path
1414
get_filename_component(GR_PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
1515

16-
if(CMAKE_BUILD_TYPE STREQUAL "Test")
16+
if(CMAKE_PRESET_NAME STREQUAL "HOOTLTest")
1717
add_executable(state_machine_tick_returns)
1818
target_include_directories(
1919
state_machine_tick_returns

Lib/GlobalShare/common.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ target_include_directories(
77
)
88

99
if(
10-
CMAKE_BUILD_TYPE
10+
CMAKE_PRESET_NAME
1111
STREQUAL
1212
"Debug"
1313
OR
14-
CMAKE_BUILD_TYPE
14+
CMAKE_PRESET_NAME
1515
STREQUAL
1616
"RelWithDebInfo"
1717
)
@@ -26,7 +26,7 @@ if(
2626
)
2727
endif()
2828

29-
if(CMAKE_BUILD_TYPE STREQUAL "Test")
29+
if(CMAKE_PRESET_NAME STREQUAL "HOOTLTest")
3030
target_compile_definitions(GLOBALSHARE_LIB INTERFACE LOGOMATIC_ENABLED)
3131

3232
add_executable(logomatic_simple)

Lib/Utils/BitManipulations/bit-utils.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ target_sources(
1212
${CMAKE_CURRENT_LIST_DIR}/Src/setBits.c
1313
)
1414

15-
if(CMAKE_BUILD_TYPE STREQUAL "Test")
15+
if(CMAKE_PRESET_NAME STREQUAL "HOOTLTest")
1616
add_executable(
1717
BitManipulations_VerifyGetBit_test
1818
${CMAKE_CURRENT_LIST_DIR}/Test/verifyGetBit.c

Lib/Utils/CircularBuffer/circular-buffer-lib.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ target_include_directories(
1212
)
1313

1414
# link test to this library
15-
if(CMAKE_BUILD_TYPE STREQUAL "Test")
15+
if(CMAKE_PRESET_NAME STREQUAL "HOOTLTest")
1616
# Initialization
1717
add_executable(
1818
CircularBuffer_Lib_Initialization_test

Lib/cmake/gr-lib.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function(add_gr_project)
1313
set(Platform ${ARGV0})
1414
set(GR_PROJECT ${ARGV1})
1515

16-
if(CMAKE_BUILD_TYPE STREQUAL "Test")
16+
if(CMAKE_PRESET_NAME STREQUAL "HOOTLTest")
1717
if(DEFINED GR_PROJECT_PATH)
1818
add_subdirectory("${GR_PROJECT}/${GR_PROJECT_PATH}")
1919
else()

0 commit comments

Comments
 (0)