1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Testing - Add a new compilation on Clang without PCH #540

Updated a main workflow to validate the header and more precise warnings.
No PCH helps to validate missed headers.
Fixed PCH issue for mac os
Extend the parameters for occt build action.
This commit is contained in:
Pasukhin Dmitry
2025-05-17 21:08:49 +01:00
committed by GitHub
parent c5256dcf70
commit e668a0d228
3 changed files with 91 additions and 47 deletions

View File

@@ -19,6 +19,18 @@ inputs:
description: 'Enable VTK'
required: false
default: 'true'
build-use-pch:
description: 'Enable precompiled headers'
required: false
default: 'true'
build-opt-profile:
description: 'Build optimization profile'
required: false
default: 'Production'
cmake-build-type:
description: 'CMake build type (Release, Debug, etc)'
required: false
default: 'Release'
runs:
using: "composite"
@@ -82,41 +94,10 @@ runs:
cmake -T host=x64 `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} `
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=Release `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ inputs.use-vtk }} `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON ${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (Windows Clang)
if: ${{ inputs.platform == 'windows' && inputs.compiler == 'clang' }}
run: |
mkdir build
cd build
cmake -G "Ninja" `
-D CMAKE_C_COMPILER=clang `
-D CMAKE_CXX_COMPILER=clang++ `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
@@ -132,8 +113,39 @@ runs:
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON `
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wno-unknown-warning-option" `
-D CMAKE_C_FLAGS="-Werror -Wall -Wextra -Wno-unknown-warning-option" ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (Windows Clang)
if: ${{ inputs.platform == 'windows' && inputs.compiler == 'clang' }}
run: |
mkdir build
cd build
cmake -G "Ninja" `
-D CMAKE_C_COMPILER=clang `
-D CMAKE_CXX_COMPILER=clang++ `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} `
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ inputs.use-vtk }} `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON `
${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (macOS)
@@ -144,9 +156,10 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=ON \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_RAPIDJSON=ON \
@@ -158,7 +171,7 @@ runs:
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" \
-D CMAKE_C_FLAGS="-Werror -Wall -Wextra" ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: bash
- name: Configure OCCT (Linux)
@@ -169,11 +182,11 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=ON \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D USE_TK=OFF \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_FREETYPE=ON \
@@ -189,7 +202,7 @@ runs:
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
${{ inputs.compiler == 'clang' && '-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" -D CMAKE_C_FLAGS="-Werror -Wall -Wextra"' || '' }} ${{ inputs.additional-cmake-flags }} ..
${{ inputs.additional-cmake-flags }} ..
shell: bash
- name: Build OCCT (Windows)

View File

@@ -122,6 +122,25 @@ jobs:
compiler: clang
artifact-name: install-linux-clang-x64
prepare-and-build-macos-clang-no-pch:
name: Prepare and Build on macOS with Clang (No PCH)
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Build OCCT
uses: ./.github/actions/build-occt
with:
platform: macos
compiler: clang
artifact-name: install-macos-clang-no-pch
build-use-pch: 'false'
build-opt-profile: 'Default'
additional-cmake-flags: '-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" -D CMAKE_C_FLAGS="-Werror -Wall -Wextra"'
cmake-build-type: 'Debug'
prepare-and-build-linux-gcc-x64:
name: Prepare and Build on Ubuntu with GCC (x64)
runs-on: ubuntu-24.04

View File

@@ -151,15 +151,27 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
# /GL (whole program optimization) is similar to -flto (Link Time Optimization) in GCC/Clang.
# /GF (eliminate duplicate strings) doesn't have a direct equivalent in GCC/Clang, but the compilers do string pooling automatically.
# /Gy (enable function-level linking) is similar to -ffunction-sections in GCC/Clang.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
# Apply LTO optimization on all platforms
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
# Apply function sections only on non-macOS platforms
if (NOT APPLE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections")
endif()
# Link-Time Code Generation(LTCG) is requared for Whole Program Optimisation(GL)
# Link-Time Code Generation (LTCG) is required for Whole Program Optimization
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto")
if (NOT WIN32)
# Add garbage collection sections only on Linux (not on macOS or Windows)
if (NOT WIN32 AND NOT APPLE)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")