diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b169f4..754d714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,55 +5,31 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -set(PLATFORM bxcan) -set(stm32cubeMxProjectPath ${CMAKE_CURRENT_LIST_DIR}/Libs/stm32-cube-project) +set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}) + +# libparams +set(LIBPARAMS_PATH ${ROOT_DIR}/Libs/libparams) +set(LIBPARAMS_PLATFORM stm32f103) +include(${ROOT_DIR}/Libs/libparams/CMakeLists.txt) if(USE_DRONECAN) - set(LIBPARAMS_PATH ${CMAKE_CURRENT_LIST_DIR}/Libs/libparams) - set(LIBPARAMS_PLATFORM stm32f103) - include(Libs/libsqcan/CMakeLists.txt) - include(Libs/libparams/CMakeLists.txt) - set(libsSourceCode - ${libparamsSrc} - ${dronecanSources} - ) - set(libsHeaders - ${libparamsHeaders} - ${dronecanHeaders} - ) - include(Src/dronecan_application/CMakeLists.txt) + include(${ROOT_DIR}/Src/dronecan_application/CMakeLists.txt) else() - set(libparamsPath ${CMAKE_CURRENT_LIST_DIR}/Libs/libparams) - add_definitions(-DBXCAN_MAX_IFACE_INDEX=0) - include(Libs/Cyphal/CMakeLists.txt) - set(libsSourceCode ${CYPHAL_SRC}) - set(libsHeaders - Libs/Cyphal/Cyphal - Libs/Cyphal/Libs/libcanard/libcanard - ${libparamsPath}/libparams - Libs/Cyphal/Libs/o1heap/o1heap - build/nunavut_out - ) - set(cyphalRegisters ${CMAKE_CURRENT_LIST_DIR}/Libs/Cyphal/Cyphal/params.yaml) - include(Src/cyphal_application/CMakeLists.txt) - list(APPEND applicationSourceCode - build/src/params.cpp - build/src/string_params.cpp - ) + include(${ROOT_DIR}/Src/cyphal_application/CMakeLists.txt) endif() - set(TOOLCHAIN_PREFIX arm-none-eabi-) set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++) set(CMAKE_CXX_STANDARD 20) +set(stm32cubeMxProjectPath ${ROOT_DIR}/Libs/stm32-cube-project) FILE(GLOB coreSources ${stm32cubeMxProjectPath}/Core/Src/*) FILE(GLOB driversSources ${stm32cubeMxProjectPath}/Drivers/STM32F1xx_HAL_Driver/Src/*.c*) set(gitRelatedHeaders - build/src + ${ROOT_DIR}/build/src ) set(stm32CubeMxGeneratedFiles diff --git a/Src/cyphal_application/CMakeLists.txt b/Src/cyphal_application/CMakeLists.txt index 9a29483..e9c25af 100644 --- a/Src/cyphal_application/CMakeLists.txt +++ b/Src/cyphal_application/CMakeLists.txt @@ -1,17 +1,37 @@ +cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SRC_DIR) +cmake_path(GET SRC_DIR PARENT_PATH ROOT_DIR) + +set(PLATFORM bxcan) +set(libparamsPath ${ROOT_DIR}/Libs/libparams) +add_definitions(-DBXCAN_MAX_IFACE_INDEX=0) +include(${ROOT_DIR}/Libs/Cyphal/CMakeLists.txt) +set(libsSourceCode ${CYPHAL_SRC}) +set(libsHeaders + ${ROOT_DIR}/Libs/Cyphal/Cyphal + ${ROOT_DIR}/Libs/Cyphal/Libs/libcanard/libcanard + ${libparamsPath}/libparams + ${ROOT_DIR}/Libs/Cyphal/Libs/o1heap/o1heap + ${ROOT_DIR}/build/nunavut_out +) + set(applicationSourceCode - Src/periphery/pwm/pwm.cpp - Src/periphery/led/led.cpp + ${ROOT_DIR}/Src/periphery/pwm/pwm.cpp + ${ROOT_DIR}/Src/periphery/led/led.cpp + + ${ROOT_DIR}/Src/cyphal_application/setpoint/setpoint.cpp + ${ROOT_DIR}/Src/cyphal_application/feedback/feedback.cpp + ${ROOT_DIR}/Src/cyphal_application/application.cpp - Src/cyphal_application/setpoint/setpoint.cpp - Src/cyphal_application/feedback/feedback.cpp - Src/cyphal_application/application.cpp + ${ROOT_DIR}/build/src/params.cpp + ${ROOT_DIR}/build/src/string_params.cpp ) set(applicationHeaders - Src - Src/cyphal_application - Libs/Cyphal + ${ROOT_DIR}/Src + ${ROOT_DIR}/Src/cyphal_application + ${ROOT_DIR}/Libs/Cyphal ) +set(cyphalRegisters ${ROOT_DIR}/Libs/Cyphal/Cyphal/params.yaml) list(APPEND cyphalRegisters ${CMAKE_CURRENT_LIST_DIR}/params.yaml ${CMAKE_CURRENT_LIST_DIR}/setpoint/params.yaml diff --git a/Src/dronecan_application/CMakeLists.txt b/Src/dronecan_application/CMakeLists.txt index 9a38dfa..7359ccf 100644 --- a/Src/dronecan_application/CMakeLists.txt +++ b/Src/dronecan_application/CMakeLists.txt @@ -1,11 +1,25 @@ +cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SRC_DIR) +cmake_path(GET SRC_DIR PARENT_PATH ROOT_DIR) + +set(PLATFORM bxcan) +include(${ROOT_DIR}/Libs/libsqcan/CMakeLists.txt) +set(libsSourceCode + ${libparamsSrc} + ${dronecanSources} +) +set(libsHeaders + ${libparamsHeaders} + ${dronecanHeaders} +) + set(applicationSourceCode - Src/periphery/pwm/pwm.cpp - Src/periphery/led/led.cpp + ${ROOT_DIR}/Src/periphery/pwm/pwm.cpp + ${ROOT_DIR}/Src/periphery/led/led.cpp - Src/dronecan_application/application.cpp - Src/dronecan_application/params.cpp + ${ROOT_DIR}/Src/dronecan_application/application.cpp + ${ROOT_DIR}/Src/dronecan_application/params.cpp ) set(applicationHeaders - Src - Src/dronecan_application + ${ROOT_DIR}/Src + ${ROOT_DIR}/Src/dronecan_application )