Skip to content

Commit fc87ea6

Browse files
committed
ci: add FreeBSD build CI and glog 0.7.x compatibility
Add GitHub Actions workflow for FreeBSD using vmactions/freebsd-vm@v1. This runs cmake + make on FreeBSD 14.2 with system-installed deps. Also add conditional GLOG_USE_GLOG_EXPORT detection for glog >= 0.7 compatibility. This uses check_include_file_cxx to detect glog/export.h (added in glog 0.7) before defining GLOG_USE_GLOG_EXPORT. Safe with older glog versions where the header does not exist. This benefits all platforms, not just FreeBSD.
1 parent 5a2466a commit fc87ea6

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/ci-freebsd.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build on FreeBSD
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore:
7+
- '**.md'
8+
pull_request:
9+
branches: [ master ]
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
compile-with-cmake:
15+
runs-on: ubuntu-latest
16+
name: FreeBSD build
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Build on FreeBSD
22+
uses: vmactions/freebsd-vm@v1
23+
with:
24+
release: "14.3"
25+
usesh: true
26+
prepare: |
27+
pkg install -y cmake protobuf gflags leveldb openssl git
28+
29+
run: |
30+
set -ex
31+
mkdir build && cd build
32+
cmake -DCMAKE_PREFIX_PATH=/usr/local ..
33+
make -j$(sysctl -n hw.ncpu)

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ set(WITH_GLOG_VAL "0")
6464
if(WITH_GLOG)
6565
set(WITH_GLOG_VAL "1")
6666
set(BRPC_WITH_GLOG 1)
67+
# glog >= 0.7 requires GLOG_USE_GLOG_EXPORT to define GLOG_EXPORT/GLOG_NO_EXPORT.
68+
# glog/export.h only exists in glog >= 0.7, so use it as a version check.
69+
include(CheckIncludeFileCXX)
70+
check_include_file_cxx("glog/export.h" GLOG_HAS_EXPORT_H)
71+
if(GLOG_HAS_EXPORT_H)
72+
add_definitions(-DGLOG_USE_GLOG_EXPORT)
73+
endif()
6774
endif()
6875

6976
if(WITH_DEBUG_SYMBOLS)

0 commit comments

Comments
 (0)