diff --git a/.bazelignore b/.bazelignore
index 27b734b..9f41a28 100644
--- a/.bazelignore
+++ b/.bazelignore
@@ -38,4 +38,8 @@ _build/
.github/
.idea/
.reuse/
-cmake-build-*/
+cmake-build-debug/
+cmake-build-default/
+cmake-build-minsizerel/
+cmake-build-release/
+cmake-build-relwithdebinfo/
diff --git a/.bazelrc b/.bazelrc
index 3e0f87f..0179a67 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -31,13 +31,19 @@
#
#
-build --force_pic=true
+build --@rules_python//python/config_settings:bootstrap_impl=script
+build --incompatible_default_to_explicit_init_py=true
build --remote_upload_local_results=false
build --sandbox_default_allow_network=false
+build:linux --force_pic=true
+
build:macos --apple_generate_dsym=true
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --apple_platform_type=macos
+build:macos --force_pic=true
+
+build:windows --linkopt=/IGNORE:4315
common --enable_platform_specific_config=true
common --heap_dump_on_oom=true
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 50e67d6..5f0cbd0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -44,13 +44,22 @@ on: # yamllint disable-line rule:truthy
schedule:
- cron: '0 5 * * *'
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
bazel-almalinux:
name: bazel almalinux amd64
runs-on: ubuntu-latest
container: almalinux:10
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
dnf makecache -q --refresh || (sleep 15; dnf makecache -q --refresh)
dnf upgrade -q -y
@@ -63,50 +72,45 @@ jobs:
which
dnf clean all
rm -rf /var/cache/yum
- wget -qO /usr/local/bin/bazelisk \
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -qO /usr/local/bin/bazelisk \
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazelisk
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
- shell: bash
-
- bazel-alpine:
- name: bazel alpine linux amd64
- runs-on: ubuntu-latest
- container: alpine:3
- steps:
- - name: setup
run: |
- apk upgrade -q --no-cache
- apk add -q --no-cache \
- ca-certificates \
- g++ \
- git \
- libc6-compat \
- python3 \
- wget \
- which
- wget -qO /usr/local/bin/bazelisk \
- https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
- chmod +x /usr/local/bin/bazelisk
- ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
- shell: sh
- - name: checkout
- uses: actions/checkout@v7
- # - name: build test package
- # run: bazel test --flaky_test_attempts=3 ...
- # shell: sh
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
+ shell: bash
bazel-arch:
name: bazel arch linux amd64
runs-on: ubuntu-latest
container: archlinux:latest
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
pacman --needed --noconfirm --noprogressbar -S -u -y \
ca-certificates \
@@ -118,23 +122,45 @@ jobs:
rm -rf \
/var/cache/pacman/pkg/* \
/var/lib/pacman/sync/*
- wget -qO /usr/local/bin/bazelisk \
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -qO /usr/local/bin/bazelisk \
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazelisk
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: bash
bazel-fedora:
name: bazel fedora linux amd64
runs-on: ubuntu-latest
container: fedora:44
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
dnf makecache -q --refresh || (sleep 15; dnf makecache -q --refresh)
dnf upgrade -q -y
@@ -147,44 +173,84 @@ jobs:
which
dnf clean all
rm -rf /var/cache/yum
- wget -qO /usr/local/bin/bazelisk \
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -qO /usr/local/bin/bazelisk \
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazelisk
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: bash
bazel-macos:
name: bazel macos arm64
runs-on: macos-26
+ timeout-minutes: 30
steps:
- - name: checkout
- uses: actions/checkout@v7
- name: setup
run: |
- brew update -q
- brew bundle install -q
- brew cleanup -q -s
- rm -rf $(brew --cache)
+ brew update -q || (sleep 15; brew update -q)
+ brew install -q \
+ bazelisk \
+ git
env:
+ HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
shell: zsh -efuo pipefail {0}
+ - name: checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/Library/Caches/bazel
+ ~/Library/Caches/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: zsh -efuo pipefail {0}
bazel-opensuse:
name: bazel opensuse leap amd64
runs-on: ubuntu-latest
container: opensuse/leap:16.1
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
zypper -n -q ref || (sleep 15; zypper -n -q ref)
zypper -n -q up
@@ -196,23 +262,45 @@ jobs:
wget \
which
zypper -n -q cc -a
- wget -qO /usr/local/bin/bazelisk \
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -qO /usr/local/bin/bazelisk \
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazelisk
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: bash
bazel-ubuntu:
name: bazel ubuntu amd64
runs-on: ubuntu-latest
container: ubuntu:26.04
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
apt-get -qq -o APT::Acquire::Retries=4 update \
|| (sleep 15; apt-get -qq -o APT::Acquire::Retries=4 update)
@@ -227,24 +315,46 @@ jobs:
wget
apt-get -qq -o Dpkg::Use-Pty=0 autoremove
rm -rf /var/lib/apt/lists/*
- wget -q https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-amd64.deb
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -q https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-amd64.deb
dpkg -i bazelisk-amd64.deb
rm -rf bazelisk-amd64.deb
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
env:
DEBIAN_FRONTEND: noninteractive
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: bash
bazel-ubuntu-arm64:
name: bazel ubuntu arm64
runs-on: ubuntu-26.04-arm
container: ubuntu:26.04
+ timeout-minutes: 30
steps:
- name: setup
+ id: setup
run: |
apt-get -qq -o APT::Acquire::Retries=4 update \
|| (sleep 15; apt-get -qq -o APT::Acquire::Retries=4 update)
@@ -259,22 +369,217 @@ jobs:
wget
apt-get -qq -o Dpkg::Use-Pty=0 autoremove
rm -rf /var/lib/apt/lists/*
- wget -q https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-arm64.deb
+ wget --tries=4 --waitretry=15 --retry-on-http-error=429,500,502,503,504 \
+ -q https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-arm64.deb
dpkg -i bazelisk-arm64.deb
rm -rf bazelisk-arm64.deb
+ . /etc/os-release
+ echo "os=${ID}-${VERSION_ID:-rolling}" >> "$GITHUB_OUTPUT"
+ echo "gcc=$(gcc -dumpfullversion -dumpversion)" >> "$GITHUB_OUTPUT"
env:
DEBIAN_FRONTEND: noninteractive
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~/.cache/bazel
+ ~/.cache/bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.os }}-gcc-${{ steps.setup.outputs.gcc }}-bazel-
- name: build test package
- run: bazel test --flaky_test_attempts=3 ...
+ run: |
+ bazel test \
+ --features=treat_warnings_as_errors \
+ --flaky_test_attempts=3 \
+ ...
shell: bash
+ bazel-windows:
+ name: bazel windows x64
+ runs-on: windows-latest
+ timeout-minutes: 30
+ steps:
+ - name: setup
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $moduleInstalled = $false
+ for ($i = 1; $i -le 3; $i++) {
+ try {
+ if (-not $moduleInstalled) {
+ Install-Module -Force -Name Microsoft.WinGet.Client
+ $moduleInstalled = $true
+ }
+ $package = Get-WinGetPackage -Id Bazel.Bazelisk `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Bazel.Bazelisk `
+ -MatchOption Equals -Mode Silent -Verbose
+ if ($result.Status -ne 'Ok') {
+ Write-Host ($result | Format-List * | Out-String)
+ throw "WinGet install failed: $($result.Status) ($($result.ExtendedErrorCode))"
+ }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Bazel.Bazelisk `
+ -MatchOption Equals -Mode Silent -Verbose
+ if ($result.Status -ne 'Ok') {
+ Write-Host ($result | Format-List * | Out-String)
+ throw "WinGet update failed: $($result.Status) ($($result.ExtendedErrorCode))"
+ }
+ }
+ $package = Get-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ break
+ } catch {
+ if ($i -eq 3) {
+ $diagDir = Join-Path $env:LOCALAPPDATA `
+ 'Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir'
+ Get-ChildItem $diagDir -Filter 'WinGetCOM-*.log' -ErrorAction SilentlyContinue |
+ Sort-Object LastWriteTime -Descending |
+ Select-Object -First 2 |
+ ForEach-Object {
+ Write-Host "=== $($_.Name) ==="
+ Get-Content $_.FullName -Tail 80
+ }
+ throw
+ }
+ if ($moduleInstalled) { try { Repair-WinGetPackageManager -Force -Latest } catch {} }
+ Start-Sleep -Seconds 15
+ }
+ }
+ Add-Content $env:GITHUB_PATH (
+ [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + `
+ [System.Environment]::GetEnvironmentVariable("Path", "User"))
+ shell: pwsh
+ - name: checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~\AppData\Local\bazel-cache
+ ~\AppData\Local\bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-
+ - name: build test package
+ run: |
+ $PSNativeCommandUseErrorActionPreference = $true
+ bazelisk test `
+ --disk_cache="$env:LOCALAPPDATA\bazel-cache\disk" `
+ --features=treat_warnings_as_errors `
+ --repository_cache="$env:LOCALAPPDATA\bazel-cache\repo" `
+ --flaky_test_attempts=3 `
+ ...
+ shell: pwsh
+
+ bazel-windows-arm64:
+ name: bazel windows arm64
+ runs-on: windows-11-arm
+ timeout-minutes: 30
+ steps:
+ - name: setup
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $moduleInstalled = $false
+ for ($i = 1; $i -le 3; $i++) {
+ try {
+ if (-not $moduleInstalled) {
+ Install-Module -Force -Name Microsoft.WinGet.Client
+ $moduleInstalled = $true
+ }
+ $bazeliskDir = Join-Path $env:LOCALAPPDATA 'Programs\bazelisk'
+ $bazeliskExe = Join-Path $bazeliskDir 'bazelisk.exe'
+ if (-not (Test-Path $bazeliskExe)) {
+ $bazeliskTmp = "$bazeliskExe.tmp"
+ New-Item -ItemType Directory -Force -Path $bazeliskDir | Out-Null
+ Invoke-WebRequest `
+ -Uri https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-windows-arm64.exe `
+ -OutFile $bazeliskTmp
+ Move-Item -Force $bazeliskTmp $bazeliskExe
+ }
+ $package = Get-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ break
+ } catch {
+ if ($i -eq 3) {
+ $diagDir = Join-Path $env:LOCALAPPDATA `
+ 'Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir'
+ Get-ChildItem $diagDir -Filter 'WinGetCOM-*.log' -ErrorAction SilentlyContinue |
+ Sort-Object LastWriteTime -Descending |
+ Select-Object -First 2 |
+ ForEach-Object {
+ Write-Host "=== $($_.Name) ==="
+ Get-Content $_.FullName -Tail 80
+ }
+ throw
+ }
+ if ($moduleInstalled) { try { Repair-WinGetPackageManager -Force -Latest } catch {} }
+ Start-Sleep -Seconds 15
+ }
+ }
+ Add-Content $env:GITHUB_PATH (
+ [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + `
+ [System.Environment]::GetEnvironmentVariable("Path", "User"))
+ Add-Content $env:GITHUB_PATH (Join-Path $env:LOCALAPPDATA 'Programs\bazelisk')
+ shell: pwsh
+ - name: checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: cache bazel
+ uses: actions/cache@v6
+ with:
+ path: |
+ ~\AppData\Local\bazel-cache
+ ~\AppData\Local\bazelisk
+ key: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', '**/*.bazel', '**/*.bzl') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ runner.arch }}-bazel-
+ - name: build test package
+ run: |
+ $PSNativeCommandUseErrorActionPreference = $true
+ bazelisk test `
+ --disk_cache="$env:LOCALAPPDATA\bazel-cache\disk" `
+ --features=treat_warnings_as_errors `
+ --repository_cache="$env:LOCALAPPDATA\bazel-cache\repo" `
+ --flaky_test_attempts=3 `
+ ...
+ shell: pwsh
+
cmake-almalinux:
name: cmake almalinux amd64
runs-on: ubuntu-latest
container: almalinux:10
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -298,6 +603,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -324,11 +631,12 @@ jobs:
name: cmake alpine linux amd64
runs-on: ubuntu-latest
container: alpine:3
+ timeout-minutes: 30
steps:
- name: setup
run: |
- apk upgrade -q --no-cache
- apk add -q --no-cache \
+ apk upgrade -q --no-cache || (sleep 15; apk upgrade -q --no-cache)
+ (apk add -q --no-cache \
ca-certificates \
cmake \
doxygen \
@@ -336,10 +644,20 @@ jobs:
git \
graphviz \
make \
- pkgconf
+ pkgconf) || (sleep 15; apk add -q --no-cache \
+ ca-certificates \
+ cmake \
+ doxygen \
+ g++ \
+ git \
+ graphviz \
+ make \
+ pkgconf)
shell: sh
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -366,6 +684,7 @@ jobs:
name: cmake arch linux amd64
runs-on: ubuntu-latest
container: archlinux:latest
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -384,6 +703,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -410,6 +731,7 @@ jobs:
name: cmake fedora linux amd64
runs-on: ubuntu-latest
container: fedora:44
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -431,6 +753,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -456,20 +780,26 @@ jobs:
cmake-macos:
name: cmake macos arm64
runs-on: macos-26
+ timeout-minutes: 30
steps:
- - name: checkout
- uses: actions/checkout@v7
- name: setup
run: |
- brew update -q
- brew bundle install -q
- brew cleanup -q -s
- rm -rf $(brew --cache)
+ brew update -q || (sleep 15; brew update -q)
+ brew install -q \
+ cmake \
+ doxygen \
+ git \
+ graphviz
env:
+ HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
shell: zsh -efuo pipefail {0}
+ - name: checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -496,6 +826,7 @@ jobs:
name: cmake opensuse leap amd64
runs-on: ubuntu-latest
container: opensuse/leap:16.1
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -515,6 +846,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -541,6 +874,7 @@ jobs:
name: cmake ubuntu amd64
runs-on: ubuntu-latest
container: ubuntu:26.04
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -567,6 +901,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -593,6 +929,7 @@ jobs:
name: cmake ubuntu arm64
runs-on: ubuntu-26.04-arm
container: ubuntu:26.04
+ timeout-minutes: 30
steps:
- name: setup
run: |
@@ -619,6 +956,8 @@ jobs:
shell: bash
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
mkdir _build
@@ -644,16 +983,155 @@ jobs:
cmake-windows:
name: cmake windows amd64
runs-on: windows-latest
+ timeout-minutes: 30
steps:
+ - name: setup
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $moduleInstalled = $false
+ for ($i = 1; $i -le 3; $i++) {
+ try {
+ if (-not $moduleInstalled) {
+ Install-Module -Force -Name Microsoft.WinGet.Client
+ $moduleInstalled = $true
+ }
+ $package = Get-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ $package = Get-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ break
+ } catch {
+ if ($i -eq 3) {
+ $diagDir = Join-Path $env:LOCALAPPDATA `
+ 'Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir'
+ Get-ChildItem $diagDir -Filter 'WinGetCOM-*.log' -ErrorAction SilentlyContinue |
+ Sort-Object LastWriteTime -Descending |
+ Select-Object -First 2 |
+ ForEach-Object {
+ Write-Host "=== $($_.Name) ==="
+ Get-Content $_.FullName -Tail 80
+ }
+ throw
+ }
+ if ($moduleInstalled) { try { Repair-WinGetPackageManager -Force -Latest } catch {} }
+ Start-Sleep -Seconds 15
+ }
+ }
+ Add-Content $env:GITHUB_PATH (
+ [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + `
+ [System.Environment]::GetEnvironmentVariable("Path", "User"))
+ shell: pwsh
- name: checkout
uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: build test package
+ run: |
+ $PSNativeCommandUseErrorActionPreference = $true
+ mkdir _build
+ cd _build
+ cmake `
+ -DBUILD_DOCUMENTATION:BOOL=ON `
+ -DBUILD_TESTING:BOOL=ON `
+ -DCMAKE_INSTALL_PREFIX:PATH=install `
+ -DENABLE_HARDENING:BOOL=ON `
+ -DENABLE_INTERPROCEDURAL_OPTIMIZATION:BOOL=ON `
+ -DENABLE_OPENMP:BOOL=OFF `
+ -DOUTPUT_TIME_AND_POSITIONS:BOOL=OFF `
+ -DWARNINGS_AS_ERRORS:BOOL=ON `
+ --warn-uninitialized `
+ ..
+ cmake --build . --config Release
+ ctest . --build-config Release --repeat after-timeout:3
+ cmake --install .
+ cpack -C Release -G ZIP
+ cpack -C Release -G ZIP --config CPackSourceConfig.cmake
+ shell: pwsh
+
+ cmake-windows-arm64:
+ name: cmake windows arm64
+ runs-on: windows-11-arm
+ timeout-minutes: 30
+ steps:
- name: setup
run: |
- choco upgrade cmake.install -r -y --install-arguments=ADD_CMAKE_TO_PATH=System `
- --no-progress
+ $ErrorActionPreference = 'Stop'
+ $moduleInstalled = $false
+ for ($i = 1; $i -le 3; $i++) {
+ try {
+ if (-not $moduleInstalled) {
+ Install-Module -Force -Name Microsoft.WinGet.Client
+ $moduleInstalled = $true
+ }
+ $package = Get-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Git.Git `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ $package = Get-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -ErrorAction SilentlyContinue
+ if (-not $package) {
+ $result = Install-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet install failed: $($result.Status)" }
+ } elseif ($package.IsUpdateAvailable) {
+ $result = Update-WinGetPackage -Id Kitware.CMake `
+ -MatchOption Equals -Mode Silent
+ if ($result.Status -ne 'Ok') { throw "WinGet update failed: $($result.Status)" }
+ }
+ break
+ } catch {
+ if ($i -eq 3) {
+ $diagDir = Join-Path $env:LOCALAPPDATA `
+ 'Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir'
+ Get-ChildItem $diagDir -Filter 'WinGetCOM-*.log' -ErrorAction SilentlyContinue |
+ Sort-Object LastWriteTime -Descending |
+ Select-Object -First 2 |
+ ForEach-Object {
+ Write-Host "=== $($_.Name) ==="
+ Get-Content $_.FullName -Tail 80
+ }
+ throw
+ }
+ if ($moduleInstalled) { try { Repair-WinGetPackageManager -Force -Latest } catch {} }
+ Start-Sleep -Seconds 15
+ }
+ }
+ Add-Content $env:GITHUB_PATH (
+ [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + `
+ [System.Environment]::GetEnvironmentVariable("Path", "User"))
shell: pwsh
+ - name: checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: build test package
run: |
+ $PSNativeCommandUseErrorActionPreference = $true
mkdir _build
cd _build
cmake `
diff --git a/BUILD.bazel b/BUILD.bazel
index 9b77a0b..365015e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -38,7 +38,7 @@ load("@rules_cc//cc:defs.bzl", "cc_shared_library")
load("@rules_license//rules:license.bzl", "license")
load("@rules_license//rules:package_info.bzl", "package_info")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files")
-load("@rules_pkg//pkg:pkg.bzl", "pkg_deb", "pkg_tar")
+load("@rules_pkg//pkg:pkg.bzl", "pkg_deb", "pkg_tar", "pkg_zip")
package(default_package_metadata = [
":license",
@@ -86,97 +86,6 @@ pkg_files(
prefix = "usr/lib",
)
-genrule(
- name = "avo_cps",
- outs = ["AVO.cps"],
- cmd = """
-cat << 'EOF' > $@
-{
- "compat_version": "1",
- "components":
- {
- "AVO":
- {
- "includes": ["@prefix@/include/AVO"],
- "type": "dylib"
- }
- },
- "cps_path": "@prefix@/lib/cps/AVO",
- "cps_version": "0.14.1",
- "default_components": ["AVO"],
- "description": "Reciprocal Collision Avoidance with Acceleration-Velocity Obstacles",
- "license": "Apache-2.0",
- "name": "AVO",
- "version": "1.0.1",
- "version_schema": "simple",
- "website": "https://gamma.cs.unc.edu/AVO/"
-}
-EOF
-""",
-)
-
-genrule(
- name = "avo_release_cps",
- outs = ["AVO@release.cps"],
- cmd = select({
- "@platforms//os:macos": """
-cat << 'EOF' > $@
-{
- "components":
- {
- "AVO":
- {
- "location": "@prefix@/lib/libAVO.dylib"
- }
- },
- "configuration": "Release",
- "name": "AVO"
-}
-EOF
-""",
- "@platforms//os:windows": """
-cat << 'EOF' > $@
-{
- "components":
- {
- "AVO":
- {
- "location": "@prefix@/lib/AVO.dll"
- }
- },
- "configuration": "Release",
- "name": "AVO"
-}
-EOF
-""",
- "//conditions:default": """
-cat << 'EOF' > $@
-{
- "components":
- {
- "AVO":
- {
- "location": "@prefix@/lib/libAVO.so"
- }
- },
- "configuration": "Release",
- "name": "AVO"
-}
-EOF
-""",
- }),
-)
-
-pkg_files(
- name = "cps",
- srcs = [
- "AVO.cps",
- "AVO@release.cps",
- ],
- attributes = pkg_attributes(mode = "0644"),
- prefix = "usr/lib/cps/AVO",
-)
-
# REUSE-IgnoreStart
genrule(
name = "avo_pc",
@@ -229,6 +138,10 @@ Libs: -L$${libdir} -lAVO
Cflags: -I$${includedir}
EOF
""",
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
)
# REUSE-IgnoreEnd
@@ -237,18 +150,25 @@ pkg_files(
srcs = ["AVO.pc"],
attributes = pkg_attributes(mode = "0644"),
prefix = "usr/lib/pkgconfig",
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
)
pkg_tar(
name = "tar",
srcs = [
- ":cps",
":doc",
":lib",
":pkgconfig",
"//src:include",
],
extension = "tar.gz",
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
)
pkg_deb(
@@ -277,3 +197,34 @@ pkg_deb(
triggers = "triggers",
version = "1.0.1",
)
+
+filegroup(
+ name = "implib",
+ srcs = [":AVO"],
+ output_group = "interface_library",
+ target_compatible_with = ["@platforms//os:windows"],
+)
+
+pkg_files(
+ name = "lib_windows",
+ srcs = [
+ ":AVO",
+ ":implib",
+ ],
+ attributes = pkg_attributes(mode = "0644"),
+ prefix = "usr/lib",
+ target_compatible_with = ["@platforms//os:windows"],
+)
+
+pkg_zip(
+ name = "zip",
+ srcs = [
+ ":doc",
+ ":lib_windows",
+ "//src:include",
+ ],
+ target_compatible_with = select({
+ "@platforms//os:windows": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe71644..7253d12 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,7 @@ endif()
option(ENABLE_OPENMP "Enable OpenMP if available" OFF)
if(ENABLE_OPENMP)
- find_package(OpenMP MODULE)
+ find_package(OpenMP 3.0 MODULE)
endif()
option(ENABLE_INTERPROCEDURAL_OPTIMIZATION
@@ -138,6 +138,10 @@ if(ENABLE_HARDENING)
endif()
else()
if(APPLE)
+ if(NOT DEFINED CMAKE_REQUIRED_FLAGS)
+ set(CMAKE_REQUIRED_FLAGS)
+ endif()
+
set(AVO_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
check_cxx_compiler_flag(-Werror=unused-command-line-argument
diff --git a/MODULE.bazel b/MODULE.bazel
index ae0944b..9e3c402 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -67,5 +67,5 @@ python.toolchain(
python_version = "3.14",
)
-bazel_dep(name = "platforms", version = "1.1.0", dev_dependency = True)
-bazel_dep(name = "rules_pkg", version = "1.3.0", dev_dependency = True)
+bazel_dep(name = "platforms", version = "1.1.0")
+bazel_dep(name = "rules_pkg", version = "1.3.0")
diff --git a/QUALITY_DECLARATION.md b/QUALITY_DECLARATION.md
index 70dcf79..fc5e178 100644
--- a/QUALITY_DECLARATION.md
+++ b/QUALITY_DECLARATION.md
@@ -119,9 +119,11 @@ CI is performed via GitHub Actions on every push and pull request to `main`,
and on a daily schedule:
- [`.github/workflows/ci.yml`](.github/workflows/ci.yml): builds and tests
- with both CMake and Bazel on AlmaLinux, Alpine, Arch Linux, Fedora,
- openSUSE, and Ubuntu (amd64 and arm64), and macOS (arm64). CMake builds
- enable `BUILD_TESTING`, `ENABLE_HARDENING`, `ENABLE_OPENMP`, and
+ with CMake and Bazel on AlmaLinux, Arch Linux, Fedora, openSUSE, Ubuntu
+ (amd64 and arm64), macOS (arm64), and Windows (amd64 and arm64),
+ and with CMake on Alpine Linux (amd64). CMake builds
+ enable `BUILD_TESTING`, `ENABLE_HARDENING`,
+ `ENABLE_INTERPROCEDURAL_OPTIMIZATION`, `ENABLE_OPENMP` (on Linux), and
`WARNINGS_AS_ERRORS`.
- [`.github/workflows/codeql.yml`](.github/workflows/codeql.yml): runs GitHub
CodeQL semantic code analysis for C++ on a weekly schedule.
@@ -249,15 +251,16 @@ None.
`AVO2 Library` is built and tested continuously via GitHub Actions on the
following platforms:
-| Platform | Architecture | Build System |
-|----------------|--------------|--------------|
-| AlmaLinux 10 | amd64 | CMake, Bazel |
-| Alpine Linux | amd64 | CMake, Bazel |
-| Arch Linux | amd64 | CMake, Bazel |
-| Fedora | amd64 | CMake, Bazel |
-| openSUSE Leap | amd64 | CMake, Bazel |
-| Ubuntu | amd64, arm64 | CMake, Bazel |
-| macOS | arm64 | CMake, Bazel |
+| Platform | Architecture | Build System |
+|----------------|---------------|--------------|
+| AlmaLinux | amd64 | CMake, Bazel |
+| Alpine Linux | amd64 | CMake |
+| Arch Linux | amd64 | CMake, Bazel |
+| Fedora | amd64 | CMake, Bazel |
+| openSUSE Leap | amd64 | CMake, Bazel |
+| Ubuntu | amd64, arm64 | CMake, Bazel |
+| macOS | arm64 | CMake, Bazel |
+| Windows | amd64, arm64 | CMake, Bazel |
## Security [7]
diff --git a/conditions/BUILD.bazel b/conditions/BUILD.bazel
new file mode 100644
index 0000000..f54fbe6
--- /dev/null
+++ b/conditions/BUILD.bazel
@@ -0,0 +1,67 @@
+# -*- mode: bazel; -*-
+# vi: set ft=bazel:
+
+#
+# conditions/BUILD.bazel
+# AVO2 Library
+#
+# SPDX-FileCopyrightText: 2010 University of North Carolina at Chapel Hill
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Please send all bug reports to .
+#
+# The authors may be contacted via:
+#
+# Jur van den Berg, Jamie Snape, Stephen J. Guy, and Dinesh Manocha
+# Dept. of Computer Science
+# 201 S. Columbia St.
+# Frederick P. Brooks, Jr. Computer Science Bldg.
+# Chapel Hill, N.C. 27599-3175
+# United States of America
+#
+#
+#
+
+config_setting(
+ name = "linux_aarch64",
+ constraint_values = [
+ "@platforms//os:linux",
+ "@platforms//cpu:aarch64",
+ ],
+ visibility = ["//:__subpackages__"],
+)
+
+config_setting(
+ name = "linux_x86_64",
+ constraint_values = [
+ "@platforms//os:linux",
+ "@platforms//cpu:x86_64",
+ ],
+ visibility = ["//:__subpackages__"],
+)
+
+config_setting(
+ name = "linux_opt",
+ constraint_values = ["@platforms//os:linux"],
+ values = {"compilation_mode": "opt"},
+ visibility = ["//:__subpackages__"],
+)
+
+config_setting(
+ name = "macos_opt",
+ constraint_values = ["@platforms//os:macos"],
+ values = {"compilation_mode": "opt"},
+ visibility = ["//:__subpackages__"],
+)
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel
index e71b285..b9c20cc 100644
--- a/examples/BUILD.bazel
+++ b/examples/BUILD.bazel
@@ -46,13 +46,75 @@ cc_test(
size = "medium",
srcs = ["Circle.cc"],
copts = select({
- "@platforms//os:windows": ["/W4"],
- "//conditions:default": [
+ "//conditions:linux_aarch64": [
"-Wall",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
+ "-mbranch-protection=standard",
+ "-std=c++98",
+ "-Werror=conversion",
"-Werror=format-security",
],
+ "//conditions:linux_x86_64": [
+ "-Wall",
+ "-fcf-protection=full",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "@platforms//os:linux": [
+ "-Wall",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "@platforms//os:macos": [
+ "-Wall",
+ "-fno-common",
+ "-fstack-protector-strong",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "@platforms//os:windows": [
+ "/guard:cf",
+ "/guard:ehcont",
+ "/Qspectre",
+ "/sdl",
+ "/W4",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//conditions:linux_opt": [
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=3",
+ ],
+ "//conditions:default": [],
+ }),
+ defines = ["AVO_OUTPUT_TIME_AND_POSITIONS=0"] + select({
+ "//conditions:macos_opt": ["_FORTIFY_SOURCE=3"],
+ "//conditions:default": [],
+ }),
+ dynamic_deps = select({
+ "@platforms//os:windows": ["//:AVO"],
+ "//conditions:default": [],
+ }),
+ linkopts = select({
+ "@platforms//os:linux": [
+ "-Wl,-z,defs",
+ "-Wl,-z,noexecstack",
+ "-Wl,-z,now",
+ "-Wl,-z,relro",
+ ],
+ "//conditions:default": [],
}),
- defines = ["AVO_OUTPUT_TIME_AND_POSITIONS=0"],
tags = ["block-network"],
deps = ["//src:AVO"],
)
diff --git a/src/Agent.cc b/src/Agent.cc
index 9cc98c5..0bb837e 100644
--- a/src/Agent.cc
+++ b/src/Agent.cc
@@ -430,15 +430,15 @@ void Agent::computeNewVelocity(float timeStep) {
const float rSq = accelInterval_ * accelInterval_ * combinedMaxAccel *
combinedMaxAccel;
- for (int i = 0; i < static_cast(boundary.size()) - 1; ++i) {
+ for (std::size_t i = 0U; i + 1U < boundary.size(); ++i) {
const Vector2 p = boundary[i];
- const Vector2 v = boundary[i + 1] - boundary[i];
+ const Vector2 v = boundary[i + 1U] - boundary[i];
const float vSq = absSq(v);
const float detPv = det(p, v);
const float discr2 = rSq * vSq - detPv * detPv;
const float distSq1 = absSq(boundary[i]);
- const float distSq2 = absSq(boundary[i + 1]);
+ const float distSq2 = absSq(boundary[i + 1U]);
if (discr2 > 0.0F && ((distSq1 < rSq && distSq2 > rSq) ||
(distSq1 >= rSq && distSq2 <= rSq) ||
@@ -540,9 +540,9 @@ void Agent::computeNewVelocity(float timeStep) {
float minDistSq = std::numeric_limits::infinity();
std::size_t minSegment = 0U;
- for (int i = 0; i < static_cast(boundary.size()) - 1; ++i) {
+ for (std::size_t i = 0U; i + 1U < boundary.size(); ++i) {
const float distSq =
- distSqPointLineSegment(boundary[i], boundary[i + 1], Vector2());
+ distSqPointLineSegment(boundary[i], boundary[i + 1U], Vector2());
if (distSq < minDistSq) {
minDistSq = distSq;
diff --git a/src/BUILD.bazel b/src/BUILD.bazel
index 3015dbc..62b37ac 100644
--- a/src/BUILD.bazel
+++ b/src/BUILD.bazel
@@ -128,16 +128,78 @@ cc_library(
],
hdrs = [":hdrs"],
copts = select({
- "@platforms//os:windows": ["/W4"],
- "//conditions:default": [
+ "//conditions:linux_aarch64": [
+ "-Wall",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-mbranch-protection=standard",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "//conditions:linux_x86_64": [
+ "-Wall",
+ "-fcf-protection=full",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "@platforms//os:linux": [
+ "-Wall",
+ "-fno-common",
+ "-fstack-clash-protection",
+ "-fstack-protector-strong",
"-fvisibility-inlines-hidden",
"-fvisibility=hidden",
+ "-std=c++98",
+ "-Werror=conversion",
+ "-Werror=format-security",
+ ],
+ "@platforms//os:macos": [
"-Wall",
+ "-fno-common",
+ "-fstack-protector-strong",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ "-std=c++98",
+ "-Werror=conversion",
"-Werror=format-security",
],
+ "@platforms//os:windows": [
+ "/guard:cf",
+ "/guard:ehcont",
+ "/Qspectre",
+ "/sdl",
+ "/W4",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//conditions:linux_opt": [
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=3",
+ ],
+ "//conditions:default": [],
+ }),
+ linkopts = select({
+ "@platforms//os:linux": [
+ "-Wl,-z,defs",
+ "-Wl,-z,noexecstack",
+ "-Wl,-z,now",
+ "-Wl,-z,relro",
+ ],
+ "//conditions:default": [],
}),
local_defines = select({
- "@platforms//os:windows": ["RVO_EXPORTS"],
+ "//conditions:macos_opt": ["_FORTIFY_SOURCE=3"],
+ "@platforms//os:windows": ["AVO_EXPORTS"],
"//conditions:default": [],
}),
strip_include_prefix = "/src",
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e14ffce..7a045a5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -83,6 +83,10 @@ if(WIN32)
target_compile_definitions(${AVO_LIBRARY} PUBLIC NOMINMAX)
endif()
+if(NOT BUILD_SHARED_LIBS)
+ target_compile_definitions(${AVO_LIBRARY} PUBLIC AVO_STATIC_DEFINE)
+endif()
+
if(ENABLE_OPENMP AND OpenMP_FOUND)
target_link_libraries(${AVO_LIBRARY} PRIVATE OpenMP::OpenMP_CXX)
endif()
diff --git a/src/Simulator.cc b/src/Simulator.cc
index 3be2f59..78d4bd3 100644
--- a/src/Simulator.cc
+++ b/src/Simulator.cc
@@ -147,7 +147,7 @@ void Simulator::doStep() {
#ifdef _OPENMP
#pragma omp parallel for
#endif // _OPENMP
- for (int agentNo = 0; agentNo < static_cast(agents_.size()); ++agentNo) {
+ for (std::size_t agentNo = 0U; agentNo < agents_.size(); ++agentNo) {
agents_[agentNo]->computeNeighbors(kdTree_);
agents_[agentNo]->computeNewVelocity(timeStep_);
}
@@ -155,7 +155,7 @@ void Simulator::doStep() {
#ifdef _OPENMP
#pragma omp parallel for
#endif // _OPENMP
- for (int agentNo = 0; agentNo < static_cast(agents_.size()); ++agentNo) {
+ for (std::size_t agentNo = 0U; agentNo < agents_.size(); ++agentNo) {
agents_[agentNo]->update(timeStep_);
}
diff --git a/src/Simulator.h b/src/Simulator.h
index 1311bea..904a1f9 100644
--- a/src/Simulator.h
+++ b/src/Simulator.h
@@ -393,7 +393,14 @@ class AVO_EXPORT Simulator {
KdTree *kdTree_;
float globalTime_;
float timeStep_;
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4251)
+#endif // _MSC_VER
std::vector agents_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
friend class KdTree;
};