Skip to content

Commit 9e5099a

Browse files
committed
Add bundled GLFW/GLEW headers to all compile commands (PCH, precompile, main)
1 parent d3a1c0a commit 9e5099a

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

mode/CppMode.jar

78 Bytes
Binary file not shown.

src/java/CppBuild.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,13 +3013,18 @@ private List<String> buildCommand(String gpp, File src, File bin, boolean win, b
30133013
// Intel Macs — neither is guaranteed to be on g++'s default search path,
30143014
// so add both explicitly. Harmless if a path doesn't exist.
30153015
String homebrewPrefix = null;
3016+
// Bundled headers (GLFW, GLEW) ship with the mode on all platforms.
3017+
File bundledInclude = new File(runtimeDir.getParentFile(), "libs/include");
30163018
if (mac) {
30173019
if (new File("/opt/homebrew/include").exists()) homebrewPrefix = "/opt/homebrew";
30183020
else if (new File("/usr/local/include").exists()) homebrewPrefix = "/usr/local";
30193021
if (homebrewPrefix != null) {
30203022
cmd.add("-I" + homebrewPrefix + "/include");
30213023
}
30223024
}
3025+
// Always add bundled headers -- takes precedence over system headers
3026+
// on Windows, supplements Homebrew on macOS, supplements pkg on Linux.
3027+
if (bundledInclude.exists()) cmd.add("-I" + bundledInclude.getAbsolutePath());
30233028

30243029
// ── Cached precompiled objects ──────────────────────────────────────────
30253030
// Processing.cpp takes ~9s to compile. Cache the .o and reuse it.
@@ -3052,6 +3057,7 @@ private List<String> buildCommand(String gpp, File src, File bin, boolean win, b
30523057
pchCmd.add(gpp); pchCmd.add("-std=c++2c"); pchCmd.add("-O2");
30533058
if (!mac) pchCmd.add("-march=x86-64");
30543059
if (homebrewPrefix != null) pchCmd.add("-I" + homebrewPrefix + "/include");
3060+
if (bundledInclude.exists()) pchCmd.add("-I" + bundledInclude.getAbsolutePath());
30553061
pchCmd.add("-I" + runtimeDir.getAbsolutePath());
30563062
pchCmd.add("-DPROCESSING_HAS_STB_IMAGE");
30573063
pchCmd.add("-DPROCESSING_HAS_STB_TRUETYPE");
@@ -3067,6 +3073,7 @@ private List<String> buildCommand(String gpp, File src, File bin, boolean win, b
30673073
preCmd.add(gpp); preCmd.add("-std=c++2c"); preCmd.add("-O2");
30683074
if (!mac) preCmd.add("-march=native");
30693075
if (homebrewPrefix != null) preCmd.add("-I" + homebrewPrefix + "/include");
3076+
if (bundledInclude.exists()) preCmd.add("-I" + bundledInclude.getAbsolutePath());
30703077
preCmd.add("-I" + runtimeDir.getAbsolutePath());
30713078
preCmd.add("-DPROCESSING_HAS_STB_IMAGE");
30723079
preCmd.add("-DPROCESSING_HAS_STB_TRUETYPE");
@@ -3091,6 +3098,7 @@ private List<String> buildCommand(String gpp, File src, File bin, boolean win, b
30913098
preCmd2.add(gpp); preCmd2.add("-std=c++2c"); preCmd2.add("-O2");
30923099
if (!mac) preCmd2.add("-march=native");
30933100
if (homebrewPrefix != null) preCmd2.add("-I" + homebrewPrefix + "/include");
3101+
if (bundledInclude.exists()) preCmd2.add("-I" + bundledInclude.getAbsolutePath());
30943102
preCmd2.add("-I" + runtimeDir.getAbsolutePath());
30953103
preCmd2.add("-DPROCESSING_HAS_STB_IMAGE");
30963104
preCmd2.add("-DPROCESSING_HAS_STB_TRUETYPE");

0 commit comments

Comments
 (0)