Skip to content

Commit

Permalink
Add cmake workflow for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
imwints committed Dec 3, 2023
1 parent dbb85d8 commit 333fe80
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 17 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/cmake-freebsd.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
@@ -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

47 changes: 47 additions & 0 deletions .github/workflows/cmake-macos.yml
Original file line number Diff line number Diff line change
@@ -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

15 changes: 0 additions & 15 deletions .github/workflows/continuous-build-freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ranges>")
endif()

Expand Down

0 comments on commit 333fe80

Please sign in to comment.