|
| 1 | +name: vcpkg |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + |
| 5 | +# Every time you make a push to your PR, it cancel immediately the previous checks, |
| 6 | +# and start a new one. The other runner will be available more quickly to your PR. |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: ${{ matrix.os }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: windows-latest |
| 20 | + triplet: x64-windows-release |
| 21 | + build_type: Release |
| 22 | + test_target: RUN_TESTS |
| 23 | + binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg\archives |
| 24 | + python: python |
| 25 | + # check_constraint_program fail on windows. should fix it for windows. |
| 26 | + # Remove this excluded test when you fix it for windows. |
| 27 | + ctest_extra_flags: -E check_constraint_program |
| 28 | + - os: ubuntu-latest |
| 29 | + triplet: x64-linux-release |
| 30 | + build_type: Release |
| 31 | + test_target: test |
| 32 | + binary_cache: /home/runner/.cache/vcpkg/archives |
| 33 | + cxxflags: -DCMAKE_CXX_FLAGS="-Wno-error=nonnull -Wno-error=maybe-uninitialized" |
| 34 | + python: python3 |
| 35 | + - os: macos-latest |
| 36 | + triplet: arm64-osx-release |
| 37 | + build_type: Release |
| 38 | + test_target: test |
| 39 | + binary_cache: /Users/runner/.cache/vcpkg/archives |
| 40 | + python: python3 |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Restore cache dependencies |
| 46 | + uses: actions/cache/restore@v3 |
| 47 | + with: |
| 48 | + path: ${{ matrix.binary_cache }} |
| 49 | + key: ${{ matrix.os }} |
| 50 | + restore-keys: ${{ matrix.os }} |
| 51 | + |
| 52 | + - name: Setup msbuild |
| 53 | + if: runner.os == 'Windows' |
| 54 | + uses: ilammy/msvc-dev-cmd@v1 |
| 55 | + with: |
| 56 | + arch: x64 |
| 57 | + toolset: 14.40 |
| 58 | + |
| 59 | + - name: cl version |
| 60 | + if: runner.os == 'Windows' |
| 61 | + shell: cmd |
| 62 | + run: cl |
| 63 | + |
| 64 | + - name: Install vcpkg python dependencies |
| 65 | + if: runner.os == 'Linux' |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + sudo apt-get install autoconf automake autoconf-archive |
| 69 | +
|
| 70 | + - name: Install vcpkg python dependencies |
| 71 | + if: runner.os == 'macOS' |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + brew install autoconf automake autoconf-archive |
| 75 | +
|
| 76 | + - name: "Install dependencies" |
| 77 | + run: > |
| 78 | + vcpkg x-set-installed --triplet ${{ matrix.triplet }} --host-triplet ${{ matrix.triplet }} |
| 79 | + boost-assign |
| 80 | + boost-bimap |
| 81 | + boost-chrono |
| 82 | + boost-date-time |
| 83 | + boost-filesystem |
| 84 | + boost-format |
| 85 | + boost-graph |
| 86 | + boost-math |
| 87 | + boost-program-options |
| 88 | + boost-regex |
| 89 | + boost-serialization |
| 90 | + boost-system |
| 91 | + boost-thread |
| 92 | + boost-timer |
| 93 | + eigen3 |
| 94 | + metis |
| 95 | + tbb |
| 96 | + pybind11 |
| 97 | + geographiclib |
| 98 | +
|
| 99 | + - name: copy files for hash |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + VCPKG_BASH_PATH=${VCPKG_INSTALLATION_ROOT//\\//} |
| 103 | + echo $VCPKG_BASH_PATH |
| 104 | + mkdir -p vcpkg-info |
| 105 | + find $VCPKG_BASH_PATH/installed/ -type f -name 'vcpkg_abi_info.txt' | \ |
| 106 | + while read filepath; do |
| 107 | + triplet=$(echo "$filepath" | awk -F/ '{print $(NF-3)}') |
| 108 | + port=$(echo "$filepath" | awk -F/ '{print $(NF-1)}') |
| 109 | + cp "$filepath" "vcpkg-info/${triplet}_${port}.txt" |
| 110 | + done |
| 111 | +
|
| 112 | + - name: Save cache dependencies |
| 113 | + uses: actions/cache/save@v4 |
| 114 | + with: |
| 115 | + path: ${{ matrix.binary_cache }} |
| 116 | + key: ${{ matrix.os }}-${{ hashFiles('vcpkg-info/*') }} |
| 117 | + |
| 118 | + - name: Install python packages |
| 119 | + shell: bash |
| 120 | + run: | |
| 121 | + $VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}/tools/python3/${{ matrix.python }} -m ensurepip --upgrade |
| 122 | + $VCPKG_INSTALLATION_ROOT/installed/${{ matrix.triplet }}/tools/python3/${{ matrix.python }} -m pip install -r python/dev_requirements.txt |
| 123 | +
|
| 124 | + - name: cmake config |
| 125 | + if: success() |
| 126 | + shell: bash |
| 127 | + run: | |
| 128 | + export CL=-openmp:experimental |
| 129 | +
|
| 130 | + # This is due an error in linux: |
| 131 | + # error: argument 2 null where non-null expected [-Werror=nonnull] |
| 132 | + # return __builtin_memcmp(__first1, __first2, sizeof(_Tp) * __num); |
| 133 | + # Remove `${{ matrix.cxxflags }}` when the compilation error solved |
| 134 | +
|
| 135 | + cmake . -B build -G Ninja \ |
| 136 | + -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake \ |
| 137 | + -DVCPKG_INSTALLED_DIR=$VCPKG_INSTALLATION_ROOT/installed \ |
| 138 | + -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ |
| 139 | + -DVCPKG_HOST_TRIPLET=${{ matrix.triplet }} \ |
| 140 | + -DCMAKE_BUILD_TYPE=Release \ |
| 141 | + -DGTSAM_BUILD_EXAMPLES_ALWAYS=ON \ |
| 142 | + -DGTSAM_ROT3_EXPMAP=ON \ |
| 143 | + -DGTSAM_POSE3_EXPMAP=ON \ |
| 144 | + -DGTSAM_BUILD_PYTHON=ON \ |
| 145 | + -DGTSAM_BUILD_TESTS=ON \ |
| 146 | + -DGTSAM_BUILD_UNSTABLE=OFF \ |
| 147 | + -DGTSAM_USE_SYSTEM_EIGEN=ON \ |
| 148 | + -DGTSAM_USE_SYSTEM_METIS=ON \ |
| 149 | + -DGTSAM_USE_SYSTEM_PYBIND=ON \ |
| 150 | + -DGTSAM_SUPPORT_NESTED_DISSECTION=ON \ |
| 151 | + -DCTEST_EXTRA_ARGS="${{ matrix.ctest_extra_flags }}" \ |
| 152 | + ${{ matrix.cxxflags }} |
| 153 | +
|
| 154 | + - name: cmake build |
| 155 | + shell: bash |
| 156 | + run: | |
| 157 | + cmake --build build --config Release |
| 158 | +
|
| 159 | + - name: Run Python tests |
| 160 | + shell: bash |
| 161 | + run: | |
| 162 | + cmake --build build --target python-install |
| 163 | + cmake --build build --target python-test |
| 164 | +
|
| 165 | + - name: Run tests |
| 166 | + shell: bash |
| 167 | + run: | |
| 168 | + cmake --build build --target check |
0 commit comments