dev: Реализовал сборку с помощью CMakePresets

This commit is contained in:
Vadim Sychev 2022-12-19 09:46:20 +03:00
parent f507403d39
commit d0d8f31dc5
6 changed files with 126 additions and 12 deletions

@ -1 +1 @@
Subproject commit 602a82c3cbec94805d8326446e41caa6c7b2e62c Subproject commit 377ea373b453f3f8571da8123fb1dcebe66f56b7

View File

@ -1,8 +1,5 @@
{ {
"cmake.configureArgs": [ "cmake.useCMakePresets": "always",
"-DBOARD=BeagleBoneAI",
"-DCMAKE_TOOLCHAIN_FILE=${workspaceFolder}/../sitara_depot/compile/toolchain_beagle_bone.cmake",
],
"files.associations": { "files.associations": {
"string_view": "cpp", "string_view": "cpp",
"cctype": "cpp", "cctype": "cpp",
@ -73,6 +70,8 @@
"typeinfo": "cpp", "typeinfo": "cpp",
"valarray": "cpp", "valarray": "cpp",
"variant": "cpp", "variant": "cpp",
"semaphore": "cpp" "semaphore": "cpp",
"filesystem": "cpp",
"shared_mutex": "cpp"
} }
} }

View File

@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 3.0)
project (PROFINET_IO_DEV VERSION 0.0.1) project (PROFINET_IO_DEV VERSION 0.0.1)
message("CMakeList.txt: Starting...")
if (DEFINED BOARD) if (DEFINED BOARD)
if ( (NOT (${BOARD} STREQUAL "am5718-idk")) AND (NOT (${BOARD} STREQUAL "BeagleBoneAI"))) if ( (NOT (${BOARD} STREQUAL "am5718-idk")) AND (NOT (${BOARD} STREQUAL "BeagleBoneAI")))
message(FATAL_ERROR "BOARD ${BOARD} unsupported!\n" message(FATAL_ERROR "BOARD ${BOARD} unsupported!\n"
@ -33,7 +35,9 @@ set(SRC_FILES ${SRC_FILES} ./app.cpp)
set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../sitara_depot) set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../sitara_depot)
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake) if(DEFINED BOARD)
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake)
endif()
# óáèðàåò ïðåäóïðåæäåíèÿ nlohman json î GCC7.1 # óáèðàåò ïðåäóïðåæäåíèÿ nlohman json î GCC7.1
add_compile_options(-Wno-psabi) add_compile_options(-Wno-psabi)

110
src/CMakePresets.json Normal file
View File

@ -0,0 +1,110 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"displayName": "default",
"description": "Default build using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
}
},
{
"name": "x86_64_Debug",
"inherits": "default",
"displayName": "x86_64 Debug",
"description": "Degub build for x86_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "x86_64_Release",
"inherits": "x86_64_Debug",
"displayName": "x86_64 Release",
"description": "Release build for x86_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "am571x_idk_Debug",
"inherits": "default",
"displayName": "am571x-idk Debug",
"description": "Degub build for AM571x-IDK board(arm cortex-a15)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../sitara_depot/compile/toolchain.cmake",
"BOARD": "am5718-idk"
},
"environment": {
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-",
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
}
},
{
"name": "am571x_idk_Release",
"inherits": "am571x_idk_Debug",
"displayName": "am571x-idk Release",
"description": "Release build for AM571x-IDK board(arm cortex-a15)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "BeagleBoneAI_Debug",
"inherits": "default",
"displayName": "BeagleBoneAI Debug",
"description": "Degub build for BeagleBoneAI board(arm cortex-a15)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../sitara_depot/compile/toolchain.cmake",
"BOARD": "BeagleBoneAI"
},
"environment": {
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-",
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/armdev/beagle_board/sysroot"
}
},
{
"name": "BeagleBoneAI_Release",
"inherits": "BeagleBoneAI_Debug",
"displayName": "BeagleBoneAI Release",
"description": "Release build for BeagleBoneAI board(arm cortex-a15)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "x86_64 Debug",
"configurePreset": "x86_64_Debug"
},
{
"name": "x86_64 Release",
"configurePreset": "x86_64_Release"
},
{
"name": "am571x-idk Debug",
"configurePreset": "am571x_idk_Debug"
},
{
"name": "am571x-idk Release",
"configurePreset": "am571x_idk_Release"
},
{
"name": "BeagleBoneAI Debug",
"configurePreset": "BeagleBoneAI_Debug"
},
{
"name": "BeagleBoneAI Release",
"configurePreset": "BeagleBoneAI_Release"
}
]
}

View File

@ -1,12 +1,13 @@
find_package(Boost 1.74.0) find_package(Boost 1.72.0)
if(Boost_FOUND) if(Boost_FOUND)
set(INC_DIRS ${INC_DIRS} ${Boost_INCLUDE_DIRS}) set(INC_DIRS ${INC_DIRS} ${Boost_INCLUDE_DIRS})
else() else()
message(BOOST NOT FOUND) message(FATAL_ERROR "interprocess.cmake: BOOST not found")
endif() endif()
message("Boost dir: " ${Boost_INCLUDE_DIRS}) message(STATUS "Boost dir: " ${Boost_INCLUDE_DIRS})
message("Boost libs:" ${Boost_LIBRARIES}) message(STATUS "Boost libs:" ${Boost_LIBRARIES})
include(./interprocess/shared_memory/shared_memory.cmake) include(./interprocess/shared_memory/shared_memory.cmake)
include(./interprocess/pipes/pipes.cmake) include(./interprocess/pipes/pipes.cmake)

View File

@ -1,5 +1,5 @@
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message("log enable") message(STATUS "profinet log enable")
add_definitions(-DLOG_ENABLE) add_definitions(-DLOG_ENABLE)
endif() endif()