Skip to content

Commit ac31fff

Browse files
committed
CppLinter: fix PCH timestamp check, double -std flag, use portable g++ on Windows
1 parent 20eaa00 commit ac31fff

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

mode/CppMode.jar

13 Bytes
Binary file not shown.

src/java/CppLinter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ private File ensurePch(File runtimeDir, File processingH, String gpp) {
7979
cacheDir.mkdirs();
8080
File gch = new File(cacheDir, "Processing.h.gch");
8181

82-
if (gch.exists() && processingH.lastModified() <= gch.lastModified())
83-
return gch; // still fresh
82+
if (gch.exists()) return gch; // use cached PCH
8483

8584
// Build PCH: g++ -x c++-header -std=c++23 Processing.h -o Processing.h.gch
8685
try {
8786
ProcessBuilder pb = new ProcessBuilder(
88-
gpp, "-x", "c++-header", "-std=c++2c", "-std=c++23",
87+
gpp, "-x", "c++-header", "-std=c++23",
8988
"-I", runtimeDir.getAbsolutePath(),
9089
processingH.getAbsolutePath(),
9190
"-o", gch.getAbsolutePath()
@@ -110,7 +109,10 @@ private void runCheck(Sketch sketch, int currentTab, String liveText) {
110109
if (!processingH.exists()) return;
111110

112111
boolean isWin = System.getProperty("os.name","").toLowerCase().contains("win");
113-
String gpp = isWin ? "g++" : "g++";
112+
String gpp = isWin
113+
? (InstallWizard.getPortableGpp().exists()
114+
? InstallWizard.getPortableGpp().getAbsolutePath() : "g++")
115+
: "g++";
114116

115117
// Ensure PCH is up to date (fast no-op if already fresh)
116118
File gch = ensurePch(runtimeDir, processingH, gpp);

0 commit comments

Comments
 (0)