Allow custom C++/Java compiler executable (#21) - #24
Open
HamzaHassanain wants to merge 1 commit into
Open
HamzaHassanain wants to merge 1 commit into
HamzaHassanain wants to merge 1 commit into
Conversation
The C++ compiler was hardcoded to g++. Resolve it from POLYMAN_CXX, then an optional `compiler.cpp` field in Config.json, then g++. Same for javac via POLYMAN_JAVAC / `compiler.javac`. `compiler.flags` appends extra flags to every C++ compile. Executables are shell-quoted so paths with spaces work. Closes #21 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GpqwzMj4fWWDcyfAT6WWq9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #21.
The C++ compiler executable was hardcoded to
g++incompileCPP. It is now resolved in this order:POLYMAN_CXXenvironment variablecompiler.cppinConfig.jsong++The same applies to Java:
POLYMAN_JAVAC, thencompiler.javac, thenjavac.An optional
compiler.flagsarray appends extra flags to every C++ compile, sog++-15with-std=c++23works without touching the system default compiler.{ "compiler": { "cpp": "g++-15", "flags": ["-O2", "-std=c++23"] } }The block is local only and never sent to Polygon (Polygon uses
sourceType). Executables are shell-quoted so absolute paths with spaces work.Changes
src/helpers/utils.ts:resolveCppCompiler,resolveCppFlags,resolveJavaCompiler;compileCPP/compileJavause them.src/types.d.ts: newCompilerConfigtype and optionalcompilerfield onConfigFile.template/instructions/config.md,GUIDE.md,README.md.tests/helpers/utils.test.tscovers default, config, env precedence, blank/malformed values, flags passthrough, and quoting.Verification
npm run build,npm run lint,npm run format:check,npm test(779 tests) all pass.POLYMAN_CXXpointing at a wrapper script againstdist/; the wrapper was invoked and the binary ran.🤖 Generated with Claude Code
https://claude.ai/code/session_01GpqwzMj4fWWDcyfAT6WWq9