Skip to content

Commit

Permalink
adapted c_cpp_properties to include the same paths as done in the mak…
Browse files Browse the repository at this point in the history
…efile for consistency
  • Loading branch information
luni64 committed Sep 25, 2021
1 parent 83e5200 commit ea80358
Showing 1 changed file with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public static string generate(IProject project, SetupData setup, LibManager libM
var cfg = project.selectedConfiguration;
if (!cfg.isOk) return "ERROR";

; var brd = cfg.selectedBoard;
// if (project.selectedConfiguration.compilerBase == null || brd == null) return ""; // hack
; var brd = cfg.selectedBoard;
// if (project.selectedConfiguration.compilerBase == null || brd == null) return ""; // hack

var props = new PropertiesJson()
{
Expand All @@ -25,29 +25,50 @@ public static string generate(IProject project, SetupData setup, LibManager libM
{
name = "VisualTeensy",
compilerPath = Path.Combine(cfg.compiler,"arm-none-eabi-gcc.exe").Replace('\\','/'),
intelliSenseMode = "gcc-arm",
intelliSenseMode = "gcc-arm",
cppStandard = "gnu++14", // hack: might be better to extract from boards.txt
includePath = new List<string>(),
includePath = new List<string>(),
defines = new List<string>()
}
}
};


var cfgp = props.configurations[0];

// include path -------------------------------------------------------------
cfgp.includePath.Add("src/**");
cfgp.includePath.Add(cfg.core.Replace('\\', '/'));



cfgp.includePath.Add("src");

string coresPath = "cores/" + cfg.selectedBoard.core;
if (cfg.coreStrategy == LibStrategy.link)
{
coresPath = cfg.coreBase.path + "/" + coresPath;
}
cfgp.includePath.Add(coresPath.Replace('\\', '/'));


foreach (var lib in cfg.sharedLibs)
{
cfgp.includePath.Add(Path.Combine(lib.sourceUri.LocalPath, "**").Replace('\\', '/'));
{
string basePath = lib.sourceUri.LocalPath.Replace('\\', '/');
cfgp.includePath.Add(basePath);

var utiliyPath = basePath + "/utility";
if (Directory.Exists(utiliyPath)) cfgp.includePath.Add(utiliyPath);

var srcPath = basePath + "/src";
if(Directory.Exists(srcPath)) cfgp.includePath.Add(srcPath);
}

foreach (var lib in cfg.localLibs)
{
cfgp.includePath.Add(Path.Combine("lib",lib.targetFolder, "**").Replace('\\', '/'));
string basePath = "lib/" + lib.targetFolder.Replace('\\', '/');
cfgp.includePath.Add(basePath);

var utiliyPath = basePath + "/utility";
if (Directory.Exists(utiliyPath)) cfgp.includePath.Add(utiliyPath);

var srcPath = basePath + "/src";
if (Directory.Exists(srcPath)) cfgp.includePath.Add(srcPath);
}

// Compiler switches ----------------------------------------------------------
Expand All @@ -71,7 +92,7 @@ public static string generate(IProject project, SetupData setup, LibManager libM
addConfigOption(options, props, "LAYOUT_", "build.keylayout");
props.configurations[0].defines.Add("ARDUINO=10813");


return JsonConvert.SerializeObject(props, Formatting.Indented);
}

Expand Down

0 comments on commit ea80358

Please sign in to comment.