diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9924bf3..755d4f0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,34 +8,21 @@ jobs: - name: Build and install Google Test if: always() run: make gtest install-gtest - - name: Install abseil library - run: | - git clone https://github.com/abseil/abseil-cpp.git - cd abseil-cpp - mkdir build && cd build - sudo apt install cmake - cmake .. - sudo cmake --build . --target install + - name: Build and install Abseil + if: always() + run: make abseil install-abseil - name: Cache protobuf library id: cache-protobuf uses: actions/cache@v1 with: path: protobuf key: ${{ runner.os }}-protobuf - - name: Build protobuf library - if: steps.cache-protobuf.outputs.cache-hit != 'true' - run: | - git clone https://github.com/protocolbuffers/protobuf.git - cd protobuf - git submodule update --init --recursive - cmake . -DCMAKE_CXX_STANDARD=14 - cmake --build . + - name: Build Protobuf + if: always() + run: make protobuf - name: Install protobuf library if: always() - run: | - cd protobuf - sudo make install - sudo ldconfig + run: make install-protobuf - name: Build and test ADAK if: always() run: make build-and-test USE_CORES=1 diff --git a/Makefile b/Makefile index c37e89d..9a133d2 100644 --- a/Makefile +++ b/Makefile @@ -54,20 +54,17 @@ lint : # -------------- # Build protobuf # -------------- -PROTOBUF_INSTALL_DIR = ~/protobuf protobuf : clean-protobuf git clone https://github.com/protocolbuffers/protobuf.git cd protobuf && \ git submodule update --init --recursive - cd protobuf && cmake . -DCMAKE_CXX_STANDARD=14 \ - -DCMAKE_INSTALL_PREFIX=$(PROTOBUF_INSTALL_DIR) \ - -Dprotobuf_ABSL_PROVIDER=package \ - -DCMAKE_PREFIX_PATH=$(ABSEIL_INSTALL_DIR) + cd protobuf && cmake . -DCMAKE_CXX_STANDARD=14 cd protobuf && cmake --build . -j $(USE_CORES) - mkdir -p $(PROTOBUF_INSTALL_DIR) - cd protobuf && make install -clean-protobuf : +install-protobuf : FORCE + cd protobuf && sudo make install && sudo ldconfig + +clean-protobuf : FORCE rm -rf protobuf $(PROTOBUF_INSTALL_DIR) # ------------------------------ @@ -89,16 +86,17 @@ clean-gtest : FORCE # ------------------------------------------------------------------- # Build abseil rather than depending on whatever is already installed # ------------------------------------------------------------------- -ABSEIL_INSTALL_DIR = ~/abseil abseil : clean-abseil git clone https://github.com/abseil/abseil-cpp.git cd abseil-cpp && mkdir build - cd abseil-cpp/build && cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON \ - -DCMAKE_CXX_STANDARD=14 -DCMAKE_INSTALL_PREFIX=$(ABSEIL_INSTALL_DIR) .. + cd abseil-cpp/build && cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=14 .. + cd abseil-cpp/build && cmake --build . -j $(USE_CORES) + +install-abseil : FORCE cd abseil-cpp/build && cmake --build . --target install -j $(USE_CORES) -clean-abseil : - rm -rf abseil-cpp $(ABSEIL_INSTALL_DIR) +clean-abseil : FORCE + rm -rf abseil-cpp # ---------------------------------------------- # This is the most comprehensive automated