Skip to content

Configuration - Modernize compiler flags for C++17 and add Production optimizations#867

Merged
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:comp_flags
Nov 30, 2025
Merged

Configuration - Modernize compiler flags for C++17 and add Production optimizations#867
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:comp_flags

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

  • 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)

…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)
@dpasukhi dpasukhi added this to the Release 8.0 milestone Nov 30, 2025
@dpasukhi dpasukhi requested a review from Copilot November 30, 2025 09:31
@dpasukhi dpasukhi self-assigned this Nov 30, 2025
@dpasukhi dpasukhi added the 1. Configuration CMake/QMake processes of OCCT or samples label Nov 30, 2025
Copy link
Copy Markdown

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 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/GNUCXX with modern CMAKE_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"

Comment thread adm/cmake/occt_defs_flags.cmake
Comment thread adm/cmake/occt_defs_flags.cmake Outdated
@dpasukhi dpasukhi requested a review from Copilot November 30, 2025 10:58
Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread adm/cmake/occt_defs_flags.cmake
@dpasukhi dpasukhi marked this pull request as ready for review November 30, 2025 12:13
@dpasukhi dpasukhi merged commit 9edeecb into Open-Cascade-SAS:IR Nov 30, 2025
23 checks passed
@dpasukhi dpasukhi deleted the comp_flags branch November 30, 2025 14:39
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Nov 30, 2025
dpasukhi added a commit to dpasukhi/OCCT that referenced this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Configuration CMake/QMake processes of OCCT or samples

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants