Skip to content

build(engine): enforce C++17 in CMake and fix Data target standard#784

Draft
tianjianjiang wants to merge 1 commit intomasterfrom
build/cpp_standard_enforcement
Draft

build(engine): enforce C++17 in CMake and fix Data target standard#784
tianjianjiang wants to merge 1 commit intomasterfrom
build/cpp_standard_enforcement

Conversation

@tianjianjiang
Copy link
Copy Markdown
Member

@tianjianjiang tianjianjiang commented Feb 14, 2026

Summary

  • Add CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF to all three CMakeLists.txt files (Engine, gramambular2, Mandarin) to enforce strict C++17 compliance
  • Change Data target from gnu++0x (C++11 with GNU extensions) to c++17 in both Debug and Release configurations in project.pbxproj

Independent PR (base: master). Previously part of the contextual user model stack; detached as it stands alone.

Test plan

  • C++ engine tests: 100/100 passed
  • grep gnu++0x project.pbxproj returns no matches
  • grep STANDARD_REQUIRED returns 3 hits (one per CMakeLists.txt)
  • Xcode build: pre-existing SPM dependency failure (same on master, unrelated)

Generated with Claude Code

Copilot AI review requested due to automatic review settings February 14, 2026 14:27
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes correctly enforce C++17 standard compliance across all build configurations. No critical issues found - the PR properly:

  • Adds CMAKE_CXX_STANDARD_REQUIRED ON to fail builds if C++17 is unavailable
  • Adds CMAKE_CXX_EXTENSIONS OFF to disable compiler-specific extensions (e.g., GNU extensions)
  • Upgrades Data target from gnu++0x (C++11 with GNU extensions) to c++17

This aligns with CLAUDE.md requirements and prevents accidental use of C++20/C++23 features.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to enforce strict C++17 compliance across the project. The changes correctly update the CMake build system to require C++17 and disable compiler extensions. The Xcode project's Data target is also updated from C++11 with GNU extensions to C++17.

My review identifies some redundant build settings in the subdirectory CMakeLists.txt files. These settings are already defined in the parent CMakeLists.txt and are inherited, so they can be removed from the subdirectory files to improve maintainability. I've added comments to the newly added redundant lines.

Overall, the changes are good and align with the goal of standardizing the C++ version.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enforces strict C++17 compliance across both the CMake-based C++ engine build and the Xcode project build system. Building on the guardrails established in #783, it eliminates outdated C++11 settings and disables GNU extensions to ensure consistent, standards-compliant C++ compilation.

Changes:

  • Add CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF to all three CMakeLists.txt files for strict C++17 enforcement
  • Update Data target from obsolete gnu++0x (C++11 with GNU extensions) to c++17 in Xcode project

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Source/Engine/CMakeLists.txt Add strict C++17 enforcement flags (STANDARD_REQUIRED ON, EXTENSIONS OFF) to main engine CMake configuration
Source/Engine/gramambular2/CMakeLists.txt Add strict C++17 enforcement flags to gramambular2 library CMake configuration
Source/Engine/Mandarin/CMakeLists.txt Add strict C++17 enforcement flags to Mandarin library CMake configuration
McBopomofo.xcodeproj/project.pbxproj Update Data target from gnu++0x to c++17 in both Debug and Release configurations

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No critical issues found. Changes correctly enforce strict C++17 compliance across CMake and Xcode build systems.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes correctly enforce strict C++17 compliance across all CMake files and update the Data target from outdated C++11 with GNU extensions to C++17. The implementation is sound.

One note: verify that the Data target builds successfully with the stricter standard, as it previously used GNU extensions.

@tianjianjiang tianjianjiang force-pushed the build/cpp_standard_enforcement branch from fad05fd to 972339b Compare February 14, 2026 18:35
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No critical issues found. The changes properly enforce C++17 standard compliance across all CMake build files and update the Data target from gnu++0x (C++11 with GNU extensions) to c++17, matching the repository's C++17 requirement documented in CLAUDE.md.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes for C++17 standard enforcement. Found one critical CMake configuration issue that could prevent proper standard enforcement in subdirectories. See inline comment for details.

@tianjianjiang tianjianjiang force-pushed the build/cpp_standard_enforcement branch from 988b086 to 34143ba Compare February 15, 2026 09:03
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No critical issues found. The changes correctly enforce C++17 compliance across all build systems as specified in CLAUDE.md.

@tianjianjiang tianjianjiang self-assigned this Feb 24, 2026
@tianjianjiang tianjianjiang marked this pull request as draft February 24, 2026 04:54
- Add CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF
  to all three CMakeLists.txt files (Engine, gramambular2, Mandarin)
- Change Data target from gnu++0x (C++11) to c++17 in both Debug
  and Release configurations in project.pbxproj

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tianjianjiang tianjianjiang force-pushed the build/cpp_standard_enforcement branch from 34143ba to bd56fc6 Compare February 26, 2026 17:18
@tianjianjiang tianjianjiang changed the base branch from docs/agents_guardrails to master February 26, 2026 17:18
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff and verified the project.pbxproj context. The two changed XCBuildConfiguration objects (6A38BC23 / 6A38BC24) belong to PBXLegacyTarget "Data" only — not project-wide — so the scope matches the PR description.

No critical issues found:

  • CMakeLists.txt (Engine, gramambular2, Mandarin): CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF are correct additions. The former turns a silent compiler downgrade into a hard error; the latter enforces portable ISO C++17 (i.e., -std=c++17 instead of -std=gnu++17). Both are safe on macOS/Clang, and all 100 engine tests continue to pass.

  • project.pbxproj: gnu++0x (C++11 + GNU extensions) → c++17 for the Data target is the right fix to align it with the rest of the project. Note that Data is a PBXLegacyTarget that runs a Makefile/shell script rather than a Clang compilation phase, so CLANG_CXX_LANGUAGE_STANDARD may not be forwarded to the build tool as a compiler flag. The setting is harmless and documents intent, but the Makefile in Source/Data/ is the authoritative place where any C++ compiler invocations would need to respect this standard.

tianjianjiang added a commit that referenced this pull request Mar 1, 2026
The stack consists of 3 stacked PRs (#779, #780, #781)
plus 4 independent PRs (#784, #785, #786, #787) targeting
master directly, not "a stack of 6 PRs each building on
the previous".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants