name: 'Configure OCCT' description: 'Setup vcpkg and configure OCCT on a specific platform without building' inputs: platform: description: 'Platform (windows, macos, linux)' required: true compiler: description: 'Compiler (msvc, clang, gcc)' required: true target-arch: description: 'Target architecture (x64, arm64)' required: false default: 'x64' additional-cmake-flags: description: 'Additional CMake flags' required: false default: '' use-vtk: description: 'Enable VTK' required: false default: 'false' 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' github-token: description: 'GitHub token for vcpkg NuGet package access' required: true runs: using: "composite" steps: - name: Setup vcpkg uses: ./.github/actions/vcpkg-setup with: github-token: ${{ inputs.github-token }} - name: Download and extract Mesa3D (Windows) if: ${{ inputs.platform == 'windows' }} run: | curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z 7z x mesa3d.7z -omesa3d shell: pwsh - name: Run system-wide deployment (Windows) if: ${{ inputs.platform == 'windows' }} run: | cd mesa3d .\systemwidedeploy.cmd 1 .\systemwidedeploy.cmd 5 shell: cmd - name: Install dependencies (Linux) if: ${{ inputs.platform == 'linux' }} run: sudo apt-get update && sudo apt-get install -y cmake ${{ inputs.compiler == 'clang' && 'clang' || 'gcc g++' }} make libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev shell: bash - name: Install required packages (macOS) if: ${{ inputs.platform == 'macos' }} run: | brew update || true # temporary workaround for missing tcl-tk brew install tcl-tk || true # Force link any conflicting packages (only if the keg is installed) brew list python@3.12 >/dev/null 2>&1 && brew link --overwrite python@3.12 || true brew list python@3.13 >/dev/null 2>&1 && brew link --overwrite python@3.13 || true shell: bash - name: Configure OCCT (Windows) if: ${{ inputs.platform == 'windows' }} run: | mkdir build cd build $targetArch = "${{ inputs.target-arch }}" switch ($targetArch) { "x64" { $cmakeArch = "x64" $vcpkgTriplet = "x64-windows" $cmakeToolset = if ("${{ inputs.compiler }}" -eq "msvc") { "host=x64" } else { "ClangCL" } $useTk = "ON" $useOpenVr = "ON" } "arm64" { $cmakeArch = "ARM64" $vcpkgTriplet = "arm64-windows" # Visual Studio ARM64 generators do not accept host=arm64 here. $cmakeToolset = if ("${{ inputs.compiler }}" -eq "msvc") { "" } else { "ClangCL" } $useTk = "OFF" $useOpenVr = "OFF" } default { throw "Unsupported Windows target architecture: $targetArch" } } $cmakeArgs = @( "-A", $cmakeArch, "-D", "USE_FREETYPE=ON", "-D", "USE_TK=$useTk", "-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", "INSTALL_DIR=${{ github.workspace }}/install", "-D", "BUILD_USE_VCPKG=ON", "-D", "VCPKG_TARGET_TRIPLET=$vcpkgTriplet", "-D", "USE_D3D=ON", "-D", "USE_DRACO=ON", "-D", "USE_FFMPEG=ON", "-D", "USE_FREEIMAGE=ON", "-D", "USE_GLES2=ON", "-D", "USE_OPENVR=$useOpenVr", "-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" ) if ($cmakeToolset) { $cmakeArgs = @("-T", $cmakeToolset) + $cmakeArgs } if ("${{ inputs.additional-cmake-flags }}") { $cmakeArgs += "${{ inputs.additional-cmake-flags }}" } $cmakeArgs += ".." & cmake @cmakeArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } echo "Configuration completed successfully for Windows" shell: pwsh - name: Configure OCCT (macOS) if: ${{ inputs.platform == 'macos' }} run: | mkdir -p build cd build 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=${{ 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 INSTALL_DIR=${{ github.workspace }}/install \ -D BUILD_USE_VCPKG=ON \ -D VCPKG_TARGET_TRIPLET=arm64-osx-dynamic \ -D USE_RAPIDJSON=ON \ -D USE_DRACO=ON \ -D USE_FREETYPE=ON \ -D USE_OPENGL=ON \ -D USE_FREEIMAGE=ON \ -D BUILD_GTEST=ON \ -D BUILD_CPP_STANDARD=C++17 \ -D INSTALL_GTEST=ON \ -D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-error=cast-function-type-mismatch" \ ${{ inputs.additional-cmake-flags }} .. echo "Configuration completed successfully for macOS" shell: bash - name: Configure OCCT (Linux) if: ${{ inputs.platform == 'linux' }} run: | mkdir -p build cd build # Set environment to help vcpkg find system libraries export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH" export CMAKE_PREFIX_PATH="/usr:/usr/local:$CMAKE_PREFIX_PATH" 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=${{ inputs.build-use-pch }} \ -D BUILD_INCLUDE_SYMLINK=ON \ -D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \ -D USE_TK=ON \ -D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \ -D INSTALL_DIR=${{ github.workspace }}/install \ -D BUILD_USE_VCPKG=ON \ -D BUILD_LIBRARY_TYPE=Shared \ -D VCPKG_TARGET_TRIPLET=x64-linux-dynamic \ -D USE_FREETYPE=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 }} .. echo "Configuration completed successfully for Linux" shell: bash