|
| 1 | +# This workflow builds OCCT using vcpkg on multiple platforms (Windows, macOS, Linux). |
| 2 | +# It builds in both Debug and Release modes. |
| 3 | +# All dependencies except the compiler are installed using vcpkg. |
| 4 | +# The workflow includes steps to clone vcpkg, install dependencies, configure and build. |
| 5 | + |
| 6 | +name: Build OCCT with vcpkg |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - 'master' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +env: |
| 18 | + USERNAME: Open-Cascade-SAS |
| 19 | + VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg |
| 20 | + FEED_URL: https://nuget.pkg.github.com/Open-Cascade-SAS/index.json |
| 21 | + VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/Open-Cascade-SAS/index.json,readwrite" |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, windows-2019, macos-15, macos-14, macos-13] |
| 29 | + build_type: [Debug, Release] |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + |
| 34 | + |
| 35 | + - name: Install required packages (Linux) |
| 36 | + if: runner.os == 'Linux' |
| 37 | + run: | |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get install -y build-essential ninja-build curl zip unzip tar nasm autoconf mono-complete |
| 40 | + sudo apt-get install -y libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev |
| 41 | +
|
| 42 | + - name: Install required packages (macOS) |
| 43 | + if: runner.os == 'macOS' |
| 44 | + run: | |
| 45 | + brew update || true |
| 46 | + brew install cmake ninja nasm autoconf mono || true |
| 47 | + # temporary workaround for missing tcl-tk |
| 48 | + brew install tcl-tk || true |
| 49 | + # Force link any conflicting packages |
| 50 | + brew link --overwrite [email protected] || true |
| 51 | + brew link --overwrite [email protected] || true |
| 52 | +
|
| 53 | + - name: Install required packages (Windows) |
| 54 | + if: runner.os == 'Windows' |
| 55 | + |
| 56 | + with: |
| 57 | + arch: x64 |
| 58 | + |
| 59 | + - name: Set up vcpkg (Unix) |
| 60 | + if: runner.os != 'Windows' |
| 61 | + run: | |
| 62 | + git clone https://github.com/microsoft/vcpkg.git |
| 63 | + ./vcpkg/bootstrap-vcpkg.sh |
| 64 | + shell: bash |
| 65 | + |
| 66 | + - name: Set up vcpkg (Windows) |
| 67 | + if: runner.os == 'Windows' |
| 68 | + run: | |
| 69 | + git clone https://github.com/microsoft/vcpkg.git |
| 70 | + .\vcpkg\bootstrap-vcpkg.bat |
| 71 | + shell: cmd |
| 72 | + |
| 73 | + - name: Add NuGet sources |
| 74 | + if: runner.os == 'Windows' |
| 75 | + run: | |
| 76 | + .$(${{ env.VCPKG_EXE }} fetch nuget) ` |
| 77 | + sources add ` |
| 78 | + -Source "${{ env.FEED_URL }}" ` |
| 79 | + -StorePasswordInClearText ` |
| 80 | + -Name GitHubPackages ` |
| 81 | + -UserName "${{ env.USERNAME }}" ` |
| 82 | + -Password "${{ secrets.GITHUB_TOKEN }}" |
| 83 | + .$(${{ env.VCPKG_EXE }} fetch nuget) ` |
| 84 | + setapikey "${{ secrets.GITHUB_TOKEN }}" ` |
| 85 | + -Source "${{ env.FEED_URL }}" |
| 86 | + shell: pwsh |
| 87 | + |
| 88 | + - name: Add NuGet sources |
| 89 | + if: runner.os != 'Windows' |
| 90 | + run: | |
| 91 | + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ |
| 92 | + sources add \ |
| 93 | + -Source "${{ env.FEED_URL }}" \ |
| 94 | + -StorePasswordInClearText \ |
| 95 | + -Name GitHubPackages \ |
| 96 | + -UserName "${{ env.USERNAME }}" \ |
| 97 | + -Password "${{ secrets.GITHUB_TOKEN }}" |
| 98 | + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ |
| 99 | + setapikey "${{ secrets.GITHUB_TOKEN }}" \ |
| 100 | + -Source "${{ env.FEED_URL }}" |
| 101 | + shell: bash |
| 102 | + |
| 103 | + - name: Configure OCCT ${{ matrix.build_type }} (Unix) |
| 104 | + if: runner.os != 'Windows' |
| 105 | + run: | |
| 106 | + mkdir build-${{ matrix.build_type }} |
| 107 | + cd build-${{ matrix.build_type }} |
| 108 | + cmake -G Ninja \ |
| 109 | + -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ |
| 110 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 111 | + -DBUILD_USE_VCPKG=ON \ |
| 112 | + -DUSE_MMGR_TYPE=NATIVE \ |
| 113 | + -DUSE_FREETYPE=ON \ |
| 114 | + -DUSE_TK=OFF \ |
| 115 | + -DBUILD_USE_PCH=ON \ |
| 116 | + -DBUILD_INCLUDE_SYMLINK=ON \ |
| 117 | + -DINSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} \ |
| 118 | + -DUSE_DRACO=ON \ |
| 119 | + -DUSE_FFMPEG=ON \ |
| 120 | + -DUSE_FREEIMAGE=ON \ |
| 121 | + -DUSE_GLES2=OFF \ |
| 122 | + -DUSE_VTK=ON \ |
| 123 | + -DUSE_TBB=ON \ |
| 124 | + -DUSE_RAPIDJSON=ON \ |
| 125 | + -DUSE_OPENGL=ON \ |
| 126 | + -DBUILD_MODULE_Draw=OFF \ |
| 127 | + -DVCPKG_INSTALL_OPTIONS=--clean-buildtrees-after-build \ |
| 128 | + ${{ runner.os != 'macOS' && '-DUSE_OPENVR=ON' || '' }} .. |
| 129 | + shell: bash |
| 130 | + |
| 131 | + - name: Configure OCCT ${{ matrix.build_type }} (Windows) |
| 132 | + if: runner.os == 'Windows' |
| 133 | + run: | |
| 134 | + mkdir build-${{ matrix.build_type }} |
| 135 | + cd build-${{ matrix.build_type }} |
| 136 | + cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ^ |
| 137 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^ |
| 138 | + -DBUILD_USE_VCPKG=ON ^ |
| 139 | + -DUSE_MMGR_TYPE=JEMALLOC ^ |
| 140 | + -DUSE_FREETYPE=ON ^ |
| 141 | + -DUSE_TK=OFF ^ |
| 142 | + -DBUILD_USE_PCH=ON ^ |
| 143 | + -DBUILD_INCLUDE_SYMLINK=ON ^ |
| 144 | + -DINSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} ^ |
| 145 | + -DUSE_DRACO=ON ^ |
| 146 | + -DUSE_FFMPEG=OFF ^ |
| 147 | + -DUSE_FREEIMAGE=ON ^ |
| 148 | + -DUSE_GLES2=ON ^ |
| 149 | + -DUSE_OPENVR=ON ^ |
| 150 | + -DUSE_VTK=ON ^ |
| 151 | + -DUSE_TBB=ON ^ |
| 152 | + -DUSE_RAPIDJSON=ON ^ |
| 153 | + -DVCPKG_INSTALL_OPTIONS=--clean-buildtrees-after-build ^ |
| 154 | + -DUSE_OPENGL=ON .. |
| 155 | + shell: cmd |
| 156 | + |
| 157 | + - name: Build OCCT ${{ matrix.build_type }} (Unix) |
| 158 | + if: runner.os != 'Windows' |
| 159 | + run: | |
| 160 | + cd build-${{ matrix.build_type }} |
| 161 | + cmake --build . --target install --config ${{ matrix.build_type }} |
| 162 | + shell: bash |
| 163 | + |
| 164 | + - name: Build OCCT ${{ matrix.build_type }} (Windows) |
| 165 | + if: runner.os == 'Windows' |
| 166 | + run: | |
| 167 | + cd build-${{ matrix.build_type }} |
| 168 | + cmake --build . --target install --config ${{ matrix.build_type }} |
| 169 | + shell: cmd |
0 commit comments