|
| 1 | +name: macOS |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build-macos: |
| 7 | + name: AppleClang-C++${{matrix.std}}-${{matrix.build_type}} |
| 8 | + runs-on: macos-12 |
| 9 | + permissions: |
| 10 | + actions: read |
| 11 | + contents: read |
| 12 | + security-events: write |
| 13 | + strategy: |
| 14 | + fail-fast: true |
| 15 | + matrix: |
| 16 | + std: [17, 20] |
| 17 | + include: |
| 18 | + - generator: Ninja |
| 19 | + - build_type: Debug |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Setup Dependencies |
| 25 | + run: | |
| 26 | + brew install ninja |
| 27 | +
|
| 28 | + - name: Cache jsoncpp |
| 29 | + id: cache-jsoncpp |
| 30 | + uses: actions/cache@v3 |
| 31 | + with: |
| 32 | + path: jsoncpp/ |
| 33 | + key: ${{runner.os}}-jsoncpp-1.9.5 |
| 34 | + |
| 35 | + - name: Download jsoncpp |
| 36 | + shell: bash |
| 37 | + if: steps.cache-jsoncpp.outputs.cache-hit != 'true' |
| 38 | + run: | |
| 39 | + wget https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz |
| 40 | + tar xvf 1.9.5.tar.gz |
| 41 | +
|
| 42 | + - name: Build jsoncpp |
| 43 | + if: steps.cache-jsoncpp.outputs.cache-hit != 'true' |
| 44 | + run: | |
| 45 | + cmake -S jsoncpp-1.9.5 -B build-jsoncpp \ |
| 46 | + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ |
| 47 | + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/jsoncpp \ |
| 48 | + -DBUILD_OBJECT_LIBS=OFF \ |
| 49 | + -DJSONCPP_WITH_TESTS=OFF \ |
| 50 | + -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \ |
| 51 | + -DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF \ |
| 52 | + -G "${{matrix.generator}}" |
| 53 | + cmake --build build-jsoncpp --target install |
| 54 | +
|
| 55 | + - name: Cache gflags |
| 56 | + id: cache-gflags |
| 57 | + uses: actions/cache@v3 |
| 58 | + with: |
| 59 | + path: gflags/ |
| 60 | + key: ${{runner.os}}-gflags-2.2.2 |
| 61 | + |
| 62 | + - name: Download gflags |
| 63 | + shell: bash |
| 64 | + if: steps.cache-gflags.outputs.cache-hit != 'true' |
| 65 | + run: | |
| 66 | + wget https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz |
| 67 | + tar xvf v2.2.2.tar.gz |
| 68 | +
|
| 69 | + - name: Build gflags |
| 70 | + if: steps.cache-gflags.outputs.cache-hit != 'true' |
| 71 | + run: | |
| 72 | + cmake -S gflags-2.2.2 -B build-gflags \ |
| 73 | + -DBUILD_SHARED_LIBS=ON \ |
| 74 | + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ |
| 75 | + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gflags \ |
| 76 | + -G "${{matrix.generator}}" |
| 77 | + cmake --build build-gflags --target install |
| 78 | +
|
| 79 | + - name: Cache glog |
| 80 | + id: cache-glog |
| 81 | + uses: actions/cache@v3 |
| 82 | + with: |
| 83 | + path: glog/ |
| 84 | + key: ${{runner.os}}-glog-0.6.0 |
| 85 | + |
| 86 | + - name: Download glog |
| 87 | + shell: bash |
| 88 | + if: steps.cache-glog.outputs.cache-hit != 'true' |
| 89 | + run: | |
| 90 | + wget https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz |
| 91 | + tar xvf v0.6.0.tar.gz |
| 92 | +
|
| 93 | + - name: Build glog |
| 94 | + if: steps.cache-glog.outputs.cache-hit != 'true' |
| 95 | + run: | |
| 96 | + cmake -S glog-0.6.0 -B build-glog \ |
| 97 | + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ |
| 98 | + -DWITH_PKGCONFIG=OFF \ |
| 99 | + -DWITH_GTEST=OFF \ |
| 100 | + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/glog \ |
| 101 | + -DCMAKE_PREFIX_PATH="${{github.workspace}}/gflags" \ |
| 102 | + -G "${{matrix.generator}}" |
| 103 | + cmake --build build-glog --target install |
| 104 | +
|
| 105 | + - name: Configure |
| 106 | + run: | |
| 107 | + cmake -S . -B build_${{matrix.build_type}} \ |
| 108 | + -DCMAKE_CXX_EXTENSIONS=OFF \ |
| 109 | + -DCMAKE_CXX_STANDARD=${{matrix.std}} \ |
| 110 | + -DCMAKE_CXX_STANDARD_REQUIRED=ON \ |
| 111 | + -DMYFRAME_USE_CV=ON \ |
| 112 | + -DCMAKE_PREFIX_PATH="${{github.workspace}}/jsoncpp;${{github.workspace}}/glog;${{github.workspace}}/gflags" \ |
| 113 | + -G "${{matrix.generator}}" |
| 114 | +
|
| 115 | + - name: Build |
| 116 | + run: | |
| 117 | + cmake --build build_${{matrix.build_type}} \ |
| 118 | + --config ${{matrix.build_type}} |
0 commit comments