Configuration - Modernize compiler flags for C++17 and add Production optimizations#867
Merged
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom Nov 30, 2025
Merged
Conversation
…n optimizations
- Remove obsolete SSE2 check for VS 2005-2010 (C++17 requires VS 2017+)
- Remove obsolete GCC 4.6 deprecation check (C++17 requires GCC 8+)
- Fix duplicate /fp:precise flag for MSVC
- Replace deprecated CMAKE_COMPILER_IS_GNUCC/GNUCXX with CMAKE_CXX_COMPILER_ID
- Fix C++ standard options syntax in CMakeLists.txt ("C++23" "C++26")
MSVC improvements:
- Add /Zc:__cplusplus for correct C++ standard reporting
- Add /permissive- for strict C++ conformance
- Add /Zc:inline to remove unreferenced COMDAT sections (Production)
- Add /Ob3 for aggressive inlining on VS 2019+ (Production)
- Add /OPT:REF and /OPT:ICF linker optimizations (Production)
GCC/Clang improvements:
- Add -fdata-sections for better dead code elimination (Production)
- Add -fno-plt for faster function calls (Production)
- Add -fno-semantic-interposition for GCC 10+ (Production)
- Add -Wl,--as-needed to link only needed libraries (Production, Linux)
- Add -Wl,-z,relro,-z,now for security hardening (Production, Linux)
There was a problem hiding this comment.
Pull request overview
This PR modernizes OCCT's compiler configuration by removing obsolete checks for legacy compilers and adds production-grade optimizations for MSVC, GCC, and Clang. The changes ensure proper C++17 standard compliance and improve build performance.
Key Changes:
- Removes obsolete compiler version checks (SSE2 for VS 2005-2010, GCC 4.6 deprecation warnings)
- Replaces deprecated CMake variables
CMAKE_COMPILER_IS_GNUCC/GNUCXXwith modernCMAKE_CXX_COMPILER_ID - Adds production optimizations: aggressive inlining, linker optimizations, and security hardening flags
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| adm/cmake/qt_macro.cmake | Updates GCC compiler detection to use modern CMake variable |
| adm/cmake/occt_toolkit.cmake | Removes obsolete GCC 4.6 deprecation warning handling |
| adm/cmake/occt_macros.cmake | Consolidates GCC compiler detection and removes duplicate version checks |
| adm/cmake/occt_defs_flags.cmake | Major refactoring: removes obsolete checks, adds MSVC conformance flags, implements production optimizations for all compilers |
| CMakeLists.txt | Fixes C++ standard options syntax by separating "C++23" and "C++26" |
dpasukhi
added a commit
to dpasukhi/OCCT
that referenced
this pull request
Dec 3, 2025
…roduction optimizations (Open-Cascade-SAS#867)" This reverts commit 9edeecb.
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.
MSVC improvements:
GCC/Clang improvements: