Skip to content

Commit

Permalink
Merge pull request #1 from raspberrypi/feature-platform-independent-c…
Browse files Browse the repository at this point in the history
…pp_properties

c_cpp_properties platform independent
  • Loading branch information
paulober authored May 8, 2024
2 parents 65f2a1f + 25a62b7 commit a64fcd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions scripts/pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
"name": "Pico",
"includePath": [
"${{workspaceFolder}}/**",
"{propertiesSdkPath(sdkVersion)}/**"
"{codeSdkPath(sdkVersion)}/**"
],
"forcedInclude": [
"{propertiesSdkPath(sdkVersion)}/src/common/pico_base/include/pico.h",
"{codeSdkPath(sdkVersion)}/src/common/pico_base/include/pico.h",
"${{workspaceFolder}}/build/generated/pico_base/pico/config_autogen.h"
],
"defines": [],
Expand Down Expand Up @@ -1184,7 +1184,7 @@ def DoEverything(parent, params):
if args.cpath:
compilerPath = Path(args.cpath)
elif args.toolchainVersion:
compilerPath = Path(propertiesToolchainPath(args.toolchainVersion)+"/bin/"+COMPILER_NAME)
compilerPath = Path(codeToolchainPath(args.toolchainVersion)+"/bin/"+COMPILER_NAME)
else:
compilerPath = Path(c)

Expand Down
11 changes: 4 additions & 7 deletions src/utils/vscodeConfigUtil.mts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ async function updateCppPropertiesFile(
cppProperties.configurations.forEach(config => {
// Remove the old pico-sdk includePath values set by this extension
config.includePath = config.includePath.filter(
item => !item.startsWith("${env:HOME}/.pico-sdk")
item => !item.startsWith("${userHome}/.pico-sdk")
);
// Add the new pico-sdk includePath
config.includePath.push(`\${env:HOME}/.pico-sdk/sdk/${newSDKVersion}/**`);
config.includePath.push(`\${userHome}/.pico-sdk/sdk/${newSDKVersion}/**`);
// Update the compilerPath
config.compilerPath =
"${env:HOME}/.pico-sdk/toolchain" +
"${userHome}/.pico-sdk/toolchain" +
`/${newToolchainVersion}/bin/${
// "arm-none-eabi-gcc" should work on all platforms no need for extension on Windows
/*process.platform === "win32"
Expand Down Expand Up @@ -94,10 +94,7 @@ function relativeToolchainPath(toolchainVersion: string): string {
* @returns The path to the toolchain.
*/
function buildPropertiesToolchainPathBin(toolchainVersion: string): string {
// TODO: may home is also available in newer versions of windows
return `${
process.platform === "win32" ? "${env:USERPROFILE}" : "${env:HOME}"
}${relativeToolchainPath(toolchainVersion)}/bin`;
return `\${userHome}${relativeToolchainPath(toolchainVersion)}/bin`;
}

function buildCMakePath(cmakeVersion: string): string {
Expand Down

0 comments on commit a64fcd1

Please sign in to comment.