From d87eed4dc204d0d51d90af5b95cc307632d372ba Mon Sep 17 00:00:00 2001
From: Damiano Amatruda <damiano.amatruda@skywarder.eu>
Date: Sun, 14 Nov 2021 04:48:52 +0100
Subject: [PATCH] =?UTF-8?q?[SBS]=C2=A0Update=20Visual=20Studio=20Code=20fi?=
 =?UTF-8?q?les=20for=20CMake?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* CMake Tools settings for Ccache are added

* CMake Tools kit 'Miosix' that uses Toolchain File is added

* VSCode-specific fix in sbs.cmake is no longer needed
---
 .gitignore                            |   2 -
 .vscode/c_cpp_properties.json         | 109 --------------------------
 .vscode/cmake-kits.json               |   6 ++
 .vscode/settings.json                 |   7 ++
 .vscode/tasks.json                    |   8 +-
 cmake/sbs.cmake                       |   5 --
 src/tests/catch/test-kalman-eigen.cpp |   2 +-
 7 files changed, 18 insertions(+), 121 deletions(-)
 delete mode 100755 .vscode/c_cpp_properties.json
 create mode 100644 .vscode/cmake-kits.json
 create mode 100644 .vscode/settings.json

diff --git a/.gitignore b/.gitignore
index eedfb36fa..f3ef600cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,8 +24,6 @@ build
 *.sublime-workspace
 *.sublime-project
 
-.vscode/*
-
 store.json
 **/generated/
 core
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100755
index 90febbe99..000000000
--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,109 +0,0 @@
-{
-    "configurations": [
-        {
-            "name": "stm32f407vg_stm32f4discovery",
-            "defines": [
-                "DEBUG",
-                "_ARCH_CORTEXM4_STM32F4",
-                "_BOARD_STM32F407VG_STM32F4DISCOVERY",
-                "_MIOSIX_BOARDNAME=stm32f407vg_stm32f4discovery",
-                "HSE_VALUE=8000000",
-                "SYSCLK_FREQ_168MHz=168000000",
-                "_MIOSIX",
-                "__cplusplus=201103L"
-            ],
-            "includePath": [
-                "${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
-                "${workspaceFolder}/libs/miosix-kernel/miosix",
-                "${workspaceFolder}/libs/mavlink_skyward_lib",
-                "${workspaceFolder}/libs",
-                "${workspaceFolder}/src/shared",
-                "${workspaceFolder}/src",
-                "${workspaceFolder}"
-            ],
-            "compilerPath": "/opt/arm-miosix-eabi/bin/arm-miosix-eabi-g++",
-            "cStandard": "c11",
-            "cppStandard": "c++11",
-            "browse": {
-                "path": [
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/stdlib_integration",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/interfaces",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/filesystem",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/kernel",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/util",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/e20",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/*",
-                    "${workspaceFolder}/libs/simple-template-matrix",
-                    "${workspaceFolder}/libs/mavlink_skyward_lib",
-                    "${workspaceFolder}/libs/eigen",
-                    "${workspaceFolder}/libs/tscpp",
-                    "${workspaceFolder}/libs/mxgui",
-                    "${workspaceFolder}/libs/fmt",
-                    "${workspaceFolder}/src/shared",
-                    "${workspaceFolder}/src/tests"
-                ],
-                "limitSymbolsToIncludedHeaders": true
-            }
-        },
-        {
-            "name": "stm32f429zi_skyward_death_stack_x",
-            "defines": [
-                "DEBUG",
-                "_ARCH_CORTEXM4_STM32F4",
-                "_BOARD_stm32f429zi_skyward_death_stack",
-                "_MIOSIX_BOARDNAME=stm32f429zi_skyward_death_stack",
-                "HSE_VALUE=8000000",
-                "SYSCLK_FREQ_168MHz=168000000",
-                "_MIOSIX",
-                "__cplusplus=201103L"
-            ],
-            "includePath": [
-                "${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f429zi_skyward_death_stack",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_death_stack",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
-                "${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
-                "${workspaceFolder}/libs/miosix-kernel/miosix",
-                "${workspaceFolder}/libs/mavlink_skyward_lib",
-                "${workspaceFolder}/libs",
-                "${workspaceFolder}/src/shared",
-                "${workspaceFolder}/src",
-                "${workspaceFolder}"
-            ],
-            "compilerPath": "/opt/arm-miosix-eabi/bin/arm-miosix-eabi-g++",
-            "cStandard": "c11",
-            "cppStandard": "c++11",
-            "browse": {
-                "path": [
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/config/arch/cortexM4_stm32f4/stm32f429zi_skyward_death_stack_x",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_death_stack_x",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/stdlib_integration",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/arch/common",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/interfaces",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/filesystem",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/kernel",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/util",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/e20",
-                    "${workspaceFolder}/libs/miosix-kernel/miosix/*",
-                    "${workspaceFolder}/libs/simple-template-matrix",
-                    "${workspaceFolder}/libs/mavlink_skyward_lib",
-                    "${workspaceFolder}/libs/eigen",
-                    "${workspaceFolder}/libs/tscpp",
-                    "${workspaceFolder}/libs/mxgui",
-                    "${workspaceFolder}/libs/fmt",
-                    "${workspaceFolder}/src/shared",
-                    "${workspaceFolder}/src/tests"
-                ],
-                "limitSymbolsToIncludedHeaders": true
-            }
-        }
-    ],
-    "version": 4
-}
\ No newline at end of file
diff --git a/.vscode/cmake-kits.json b/.vscode/cmake-kits.json
new file mode 100644
index 000000000..2571df7c7
--- /dev/null
+++ b/.vscode/cmake-kits.json
@@ -0,0 +1,6 @@
+[
+    {
+        "name": "Miosix",
+        "toolchainFile": "libs/miosix-kernel/miosix/_tools/toolchain.cmake"
+    }
+]
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..8baac88d4
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,7 @@
+{
+    "cmake.configureSettings": {
+        "CMAKE_C_COMPILER_LAUNCHER": "ccache",
+        "CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
+    },
+    "cmake.parallelJobs": 1
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 3afed1afb..86491abb4 100755
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -13,7 +13,7 @@
       "label": "CLEAN",
       "type": "shell",
       "windows": {
-        "command": "python sbs -c"
+        "command": "sh sbs -c"
       },
       "linux": {
         "command": "./sbs -c"
@@ -24,7 +24,7 @@
       "label": "BUILD all",
       "type": "shell",
       "windows": {
-        "command": "python sbs"
+        "command": "sh sbs"
       },
       "linux": {
         "command": "./sbs"
@@ -35,7 +35,7 @@
       "label": "BUILD current-entrypoint",
       "type": "shell",
       "windows": {
-        "command": "python sbs -v -n -b ${fileBasenameNoExtension}"
+        "command": "sh sbs -v -n -b ${fileBasenameNoExtension}"
       },
       "linux": {
         "command": "./sbs -v -b ${fileBasenameNoExtension}"
@@ -75,7 +75,7 @@
       "label": "BUILD tests-catch",
       "type": "shell",
       "windows": {
-        "command": "python sbs -v -n -b tests-catch"
+        "command": "sh sbs -v -n -b tests-catch"
       },
       "linux": {
         "command": "./sbs -v -b tests-catch"
diff --git a/cmake/sbs.cmake b/cmake/sbs.cmake
index be74f21f1..b581132dc 100644
--- a/cmake/sbs.cmake
+++ b/cmake/sbs.cmake
@@ -21,11 +21,6 @@
 
 enable_language(C CXX ASM)
 
-# Fix VSCode warning "cannot find entry symbol arch_paths_first; defaulting to 0000000000000000"
-# Alternative: set(CMAKE_<LANG>_LINK_EXECUTABLE "<CMAKE_<LANG>_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
-set(CMAKE_C_LINK_FLAGS "")
-set(CMAKE_CXX_LINK_FLAGS "")
-
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
 get_filename_component(SBS_BASE ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
 file(GLOB KPATH ${SBS_BASE}/libs/miosix-kernel/miosix)
diff --git a/src/tests/catch/test-kalman-eigen.cpp b/src/tests/catch/test-kalman-eigen.cpp
index c8696d351..07a94564e 100644
--- a/src/tests/catch/test-kalman-eigen.cpp
+++ b/src/tests/catch/test-kalman-eigen.cpp
@@ -29,7 +29,7 @@
 #include <iostream>
 #include <utils/testutils/catch.hpp>
 #include <kalman/KalmanEigen.h>
-#include "kalman/test-kalman-data.h"
+#include "../kalman/test-kalman-data.h"
 
 using namespace Eigen;
 
-- 
GitLab