Skip to content

Commit

Permalink
Set cppStandard from ros version (#1292)
Browse files Browse the repository at this point in the history
Create a function that looks up ros version setting and then sets cppStandard variable accordingly
ROS1:https://www.ros.org/reps/rep-0003.html
ROS2:https://www.ros.org/reps/rep-2000.html

Signed-off-by: Jonathan <[email protected]>
  • Loading branch information
jmblixt3 authored Jun 1, 2024
1 parent 03591b4 commit a32f83d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/ros/build-env-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async function updateCppPropertiesInternal(): Promise<void> {
cppProperties.configurations[0].intelliSenseMode = "gcc-" + process.arch
cppProperties.configurations[0].compilerPath = "/usr/bin/gcc"
cppProperties.configurations[0].cStandard = "gnu11"
cppProperties.configurations[0].cppStandard = "c++14"
cppProperties.configurations[0].cppStandard = getCppStandard()

// read the existing file
try {
Expand Down Expand Up @@ -138,3 +138,29 @@ function updatePythonAutoCompletePathInternal() {
function updatePythonAnalysisPathInternal() {
vscode.workspace.getConfiguration().update(PYTHON_ANALYSIS_PATHS, extension.env.PYTHONPATH.split(path.delimiter));
}

function getCppStandard() {
switch (vscode.workspace.getConfiguration().get("ros.distro"))
{
case "kinetic":
case "lunar":
return "c++11"
case "melodic":
case "noetic":
case "ardent":
case "bouncy":
case "crystal":
case "dashing":
case "eloquent":
case "foxy":
return "c++14"
case "galactic":
case "humble":
case "iron":
case "jazzy":
case "rolling":
return "c++17"
default:
return "c++17"
}
}

0 comments on commit a32f83d

Please sign in to comment.