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"
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 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_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++17 `
- -D INSTALL_GTEST=ON ${{ inputs.additional-cmake-flags }} ..
+ -D INSTALL_GTEST=ON `
+ ${{ inputs.additional-cmake-flags }} ..
shell: pwsh
- name: Configure OCCT (Windows 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_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 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
-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 (macOS)
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 \
-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)
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 \
-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)
# /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")