From 333fe80b49a3deea5678aa0dbb0c51c3352a7db9 Mon Sep 17 00:00:00 2001 From: Steffen Winter Date: Sat, 2 Dec 2023 00:35:13 +0100 Subject: [PATCH] Add cmake workflow for all platforms --- .github/workflows/cmake-freebsd.yml | 40 ++++++++++++++++ .github/workflows/cmake-linux.yml | 40 ++++++++++++++++ .github/workflows/cmake-macos.yml | 47 +++++++++++++++++++ .../workflows/continuous-build-freebsd.yml | 15 ------ CMakeLists.txt | 4 +- 5 files changed, 129 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/cmake-freebsd.yml create mode 100644 .github/workflows/cmake-linux.yml create mode 100644 .github/workflows/cmake-macos.yml diff --git a/.github/workflows/cmake-freebsd.yml b/.github/workflows/cmake-freebsd.yml new file mode 100644 index 000000000..d8ed3969c --- /dev/null +++ b/.github/workflows/cmake-freebsd.yml @@ -0,0 +1,40 @@ +name: FreeBSD CMake + +on: + push: + branches: main + tags-ignore: '*.*' + paths: + - '.github/workflows/cmake-freebsd.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/freebsd/*pp' + pull_request: + branches: main + paths: + - '.github/workflows/cmake-freebsd.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/freebsd/*pp' + +jobs: + build: + runs-on: ubuntu-22.04 + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + + - name: Compile + uses: vmactions/freebsd-vm@v1 + with: + release: '14.0' + usesh: true + prepare: pkg install -y cmake ninja + run: | + CXX=clang++ cmake -B build -G Ninja -DBTOP_STATIC=ON + cmake --build build --verbose + diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml new file mode 100644 index 000000000..f88f327a0 --- /dev/null +++ b/.github/workflows/cmake-linux.yml @@ -0,0 +1,40 @@ +name: Linux CMake + +on: + push: + branches: main + tags-ignore: '*.*' + paths: + - '.github/workflows/cmake-linux.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/linux/*pp' + pull_request: + branches: main + paths: + - '.github/workflows/cmake-linux.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/linux/*pp' + +jobs: + build: + runs-on: ubuntu-latest + container: alpine:edge + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + + - name: Install build tools + run: apk add --no-cache --update clang cmake lld ninja + + - name: Configure + run: CXX=clang++ LDFLAGS=-fuse-ld=lld cmake -B build -G Ninja -DBTOP_STATIC=ON + + - name: Compile + run: cmake --build build --verbose + diff --git a/.github/workflows/cmake-macos.yml b/.github/workflows/cmake-macos.yml new file mode 100644 index 000000000..68a1f66db --- /dev/null +++ b/.github/workflows/cmake-macos.yml @@ -0,0 +1,47 @@ +name: MacOS CMake + +on: + push: + branches: main + tags-ignore: '*.*' + paths: + - '.github/workflows/cmake-macos.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/osx/*pp' + pull_request: + branches: main + paths: + - '.github/workflows/cmake-macos.yml' + - 'CMakeLists.txt' + - 'include/**' + - 'src/*pp' + - 'src/osx/*pp' + +jobs: + build: + runs-on: macos-latest + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + + - name: Install build tools + run: | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + brew update --quiet + brew install --force --overwrite llvm@17 ninja + + - name: Configure + run: | + export LLVM_PREFIX="$(brew --prefix llvm)" + export CXX="$LLVM_PREFIX/bin/clang++" + export CPPFLAGS="-I$LLVM_PREFIX/include" + export LDFLAGS="-L$LLVM_PREFIX/lib -L$LLVM_PREFIX/lib/c++ -Wl,-rpath,$LLVM_PREFIX/lib/c++ -fuse-ld=$LLVM_PREFIX/bin/ld64.lld" + cmake -B build -G Ninja + + - name: Compile + run: cmake --build build --verbose + diff --git a/.github/workflows/continuous-build-freebsd.yml b/.github/workflows/continuous-build-freebsd.yml index c7b68ab2f..041133fec 100644 --- a/.github/workflows/continuous-build-freebsd.yml +++ b/.github/workflows/continuous-build-freebsd.yml @@ -58,18 +58,3 @@ jobs: path: 'bin/*' if-no-files-found: error - build-freebsd-cmake: - runs-on: ubuntu-22.04 - timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 - - - name: Compile - uses: vmactions/freebsd-vm@v1 - with: - release: '14.0' - usesh: true - prepare: pkg install -y cmake git ninja - run: | - CXX=clang++ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBTOP_STATIC=ON - cmake --build build diff --git a/CMakeLists.txt b/CMakeLists.txt index 6be138ad9..19f7212c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ else() message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported") endif() -check_include_file_cxx(ranges CXX_HAS_RANGES) -if(NOT CXX_HAS_RANGES) +check_include_file_cxx(ranges CXX_HAVE_RANGES) +if(NOT CXX_HAVE_RANGES) message(FATAL_ERROR "The compiler doesn't support ") endif()