Skip to content

Commit bb5254a

Browse files
authored
use g++ when provide compilerPath for cpptools
1 parent 6cd3696 commit bb5254a

3 files changed

Lines changed: 28 additions & 19 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"homepage": "https://em-ide.com",
3939
"license": "MIT",
4040
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
41-
"version": "3.19.6",
41+
"version": "3.19.7",
4242
"preview": false,
4343
"engines": {
4444
"vscode": "^1.67.0"

src/EIDEProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3957,7 +3957,7 @@ class EIDEProject extends AbstractProject {
39573957
includePath: this.cppToolsConfig.includePath,
39583958
defines: this.cppToolsConfig.defines,
39593959
forcedInclude: this.cppToolsConfig.forcedInclude,
3960-
compilerPath: this.cppToolsConfig.compilerPath,
3960+
compilerPath: this.getToolchain().getGccFamilyCompilerPathForCpptools('c++') || "",
39613961
compilerArgs: compilerArgs
39623962
}
39633963
};

src/ToolchainManager.ts

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ export interface IToolchian {
100100

101101
/**
102102
* get gcc c/c++ compiler path for cpptools
103+
* @param type c or c++ compiler
103104
*/
104-
getGccFamilyCompilerPathForCpptools(): string | undefined;
105+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined;
105106

106107
/**
107108
* get compiler internal defines (for static check)
@@ -472,7 +473,7 @@ class KeilC51 implements IToolchian {
472473
return new KeilC51();
473474
}
474475

475-
getGccFamilyCompilerPathForCpptools(): string | undefined {
476+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
476477
//const gcc = File.fromArray([this.getToolchainDir().path, 'BIN', `C51${platform.exeSuffix()}`]);
477478
//return gcc.path;
478479
return undefined;
@@ -662,7 +663,7 @@ class SDCC implements IToolchian {
662663
}
663664
}
664665

665-
getGccFamilyCompilerPathForCpptools(): string | undefined {
666+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
666667
//const gcc = File.fromArray([this.getToolchainDir().path, 'bin', `sdcc${platform.exeSuffix()}`]);
667668
//return gcc.path;
668669
return undefined;
@@ -909,7 +910,7 @@ class SDCC implements IToolchian {
909910
// return new SDCC();
910911
// }
911912

912-
// getGccFamilyCompilerPathForCpptools(): string | undefined {
913+
// getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
913914
// //const gcc = File.fromArray([this.getToolchainDir().path, 'bin', `sdcc${platform.exeSuffix()}`]);
914915
// //return gcc.path;
915916
// return undefined;
@@ -1117,7 +1118,7 @@ class COSMIC_STM8 implements IToolchian {
11171118
return new COSMIC_STM8();
11181119
}
11191120

1120-
getGccFamilyCompilerPathForCpptools(): string | undefined {
1121+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
11211122
// not support
11221123
return undefined;
11231124
}
@@ -1449,7 +1450,7 @@ class AC5 implements IToolchian {
14491450
return new AC5();
14501451
}
14511452

1452-
getGccFamilyCompilerPathForCpptools(): string | undefined {
1453+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
14531454
//const armccFile = File.fromArray([this.getToolchainDir().path, 'bin', `armcc${platform.exeSuffix()}`]);
14541455
//return armccFile.path;
14551456
return undefined;
@@ -1681,7 +1682,7 @@ class AC6 implements IToolchian {
16811682
return new AC6();
16821683
}
16831684

1684-
getGccFamilyCompilerPathForCpptools(): string | undefined {
1685+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
16851686
const armclang = File.fromArray([this.getToolchainDir().path, 'bin', `armclang${platform.exeSuffix()}`]);
16861687
return armclang.path;
16871688
}
@@ -1911,8 +1912,10 @@ class GCC implements IToolchian {
19111912
return new GCC();
19121913
}
19131914

1914-
getGccFamilyCompilerPathForCpptools(): string | undefined {
1915-
const gcc = File.fromArray([this.getToolchainDir().path, 'bin', this.getToolPrefix() + `gcc${platform.exeSuffix()}`]);
1915+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
1916+
const gcc = File.from(
1917+
this.getToolchainDir().path, 'bin',
1918+
this.getToolPrefix() + `${type == 'c++' ? 'g++' : 'gcc'}${platform.exeSuffix()}`);
19161919
return gcc.path;
19171920
}
19181921

@@ -2134,7 +2137,7 @@ class IARARM implements IToolchian {
21342137
return new IARARM();
21352138
}
21362139

2137-
getGccFamilyCompilerPathForCpptools(): string | undefined {
2140+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
21382141
return undefined;
21392142
}
21402143

@@ -2272,7 +2275,7 @@ class IARSTM8 implements IToolchian {
22722275
return new IARSTM8();
22732276
}
22742277

2275-
getGccFamilyCompilerPathForCpptools(): string | undefined {
2278+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
22762279
//const gcc = File.fromArray([this.getToolchainDir().path, 'stm8', 'bin', `iccstm8${platform.exeSuffix()}`]);
22772280
//return gcc.path;
22782281
return undefined;
@@ -2487,8 +2490,10 @@ class MTI_GCC implements IToolchian {
24872490
}
24882491
}
24892492

2490-
getGccFamilyCompilerPathForCpptools(): string | undefined {
2491-
const gcc = File.fromArray([this.getToolchainDir().path, 'bin', this.getToolPrefix() + `gcc${platform.exeSuffix()}`]);
2493+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
2494+
const gcc = File.from(
2495+
this.getToolchainDir().path, 'bin',
2496+
this.getToolPrefix() + `${type == 'c++' ? 'g++' : 'gcc'}${platform.exeSuffix()}`);
24922497
return gcc.path;
24932498
}
24942499

@@ -2760,8 +2765,10 @@ class RISCV_GCC implements IToolchian {
27602765
}
27612766
}
27622767

2763-
getGccFamilyCompilerPathForCpptools(): string | undefined {
2764-
const gcc = File.fromArray([this.getToolchainDir().path, 'bin', this.getToolPrefix() + `gcc${platform.exeSuffix()}`]);
2768+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
2769+
const gcc = File.from(
2770+
this.getToolchainDir().path, 'bin',
2771+
this.getToolPrefix() + `${type == 'c++' ? 'g++' : 'gcc'}${platform.exeSuffix()}`);
27652772
return gcc.path;
27662773
}
27672774

@@ -2977,8 +2984,10 @@ class AnyGcc implements IToolchian {
29772984
return new AnyGcc();
29782985
}
29792986

2980-
getGccFamilyCompilerPathForCpptools(): string | undefined {
2981-
const gcc = File.fromArray([this.getToolchainDir().path, 'bin', this.getToolPrefix() + `gcc${platform.exeSuffix()}`]);
2987+
getGccFamilyCompilerPathForCpptools(type: 'c' | 'c++' | undefined): string | undefined {
2988+
const gcc = File.from(
2989+
this.getToolchainDir().path, 'bin',
2990+
this.getToolPrefix() + `${type == 'c++' ? 'g++' : 'gcc'}${platform.exeSuffix()}`);
29822991
return gcc.path;
29832992
}
29842993

0 commit comments

Comments
 (0)