bump cmake dep and docs (#1468)

* bump cmake dep and docs
This commit is contained in:
Dominic Hamon 2022-09-14 15:11:37 +01:00 committed by GitHub
parent 9265511257
commit 49aa374da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 211 deletions

View File

@ -14,7 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
# ubuntu-18.04 is deprecated but included for best-effort
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
build_type: ['Release', 'Debug']
steps:
- uses: actions/checkout@v2
@ -23,9 +24,10 @@ jobs:
run: sudo apt -y install libpfm4-dev
- name: setup cmake
if: matrix.os == 'ubuntu-18.04'
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.5.1'
cmake-version: '3.16.3'
- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build
@ -52,46 +54,3 @@ jobs:
# working-directory: ${{ runner.workspace }}/_build
# run: ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure
ubuntu-16_04:
name: ubuntu-16.04.${{ matrix.build_type }}
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
build_type: ['Release', 'Debug']
container: ubuntu:16.04
steps:
- uses: actions/checkout@v2
- name: install required bits
run: |
apt update
apt -y install clang cmake g++ git
- name: install libpfm
run: apt -y install libpfm4-dev
- name: create build environment
run: cmake -E make_directory $GITHUB_WORKSPACE/_build
- name: configure cmake
shell: bash
working-directory: ${{ github.workspace }}/_build
run: >
cmake $GITHUB_WORKSPACE
-DBENCHMARK_ENABLE_LIBPFM=1
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: build
shell: bash
working-directory: ${{ github.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}
# Skip testing, for now. It seems perf_event_open does not succeed on the
# hosting machine, very likely a permissions issue.
# TODO(mtrofin): Enable test.
# - name: test
# shell: bash
# working-directory: ${{ runner.workspace }}/_build
# run: ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure

View File

@ -1,8 +1,10 @@
name: build-and-test
on:
push: {}
pull_request: {}
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# TODO: add 32-bit builds (g++ and clang++) for ubuntu
@ -15,7 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04, macos-latest]
# ubuntu-18.04 is deprecated but included for best-effort support
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, macos-latest]
build_type: ['Release', 'Debug']
compiler: [g++, clang++]
lib: ['shared', 'static']
@ -23,21 +26,18 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: setup cmake
if: matrix.os == 'ubuntu-18.04'
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.16.3'
- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build
- name: setup cmake initial cache
run: touch compiler-cache.cmake
- name: setup lto
# Workaround for enabling -flto on old GCC versions
if: matrix.build_type == 'Release' && startsWith(matrix.compiler, 'g++') && matrix.os != 'macos-latest'
run: >
echo 'set (CMAKE_CXX_FLAGS -flto CACHE STRING "")' >> compiler-cache.cmake;
echo 'set (CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE FILEPATH "")' >> compiler-cache.cmake;
echo 'set (CMAKE_AR /usr/bin/gcc-ar CACHE FILEPATH "")' >> compiler-cache.cmake;
echo 'set (CMAKE_NM /usr/bin/gcc-nm CACHE FILEPATH "")' >> compiler-cache.cmake;
- name: configure cmake
env:
CXX: ${{ matrix.compiler }}
@ -113,140 +113,4 @@ jobs:
- name: test
run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV
ubuntu-16_04:
name: ubuntu-16.04.${{ matrix.build_type }}.${{ matrix.compiler }}
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
build_type: ['Release', 'Debug']
compiler: [g++, clang++]
container: ubuntu:16.04
steps:
- uses: actions/checkout@v2
- name: install required bits
run: |
apt update
apt -y install clang cmake g++ git
- name: create build environment
run: cmake -E make_directory $GITHUB_WORKSPACE/_build
- name: setup cmake initial cache
run: touch compiler-cache.cmake
- name: setup lto
# Workaround for enabling -flto on old GCC versions
# -Wl,--no-as-needed is needed to avoid the following linker error:
#
# /usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so: undefined reference to `pthread_create'
#
if: matrix.build_type == 'Release' && startsWith(matrix.compiler, 'g++')
run: >
echo 'set (CMAKE_CXX_FLAGS "-Wl,--no-as-needed -flto" CACHE STRING "")' >> compiler-cache.cmake;
echo 'set (CMAKE_RANLIB "/usr/bin/gcc-ranlib" CACHE FILEPATH "")' >> compiler-cache.cmake;
echo 'set (CMAKE_AR "/usr/bin/gcc-ar" CACHE FILEPATH "")' >> compiler-cache.cmake;
echo 'set (CMAKE_NM "/usr/bin/gcc-nm" CACHE FILEPATH "")' >> compiler-cache.cmake;
- name: configure cmake
env:
CXX: ${{ matrix.compiler }}
shell: bash
working-directory: ${{ github.workspace }}/_build
run: >
cmake -C ../compiler-cache.cmake ..
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON
- name: build
shell: bash
working-directory: ${{ github.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}
- name: test
shell: bash
working-directory: ${{ github.workspace }}/_build
run: ctest -C ${{ matrix.build_type }} -VV
ubuntu-14_04:
name: ubuntu-14.04.${{ matrix.build_type }}.${{ matrix.compiler }}
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
build_type: ['Release', 'Debug']
compiler: [g++-4.8, clang++-3.6]
include:
- compiler: g++-6
build_type: 'Debug'
run_tests: true
- compiler: g++-6
build_type: 'Release'
run_tests: true
container: ubuntu:14.04
steps:
- uses: actions/checkout@v2
- name: install required bits
run: |
sudo apt update
sudo apt -y install clang-3.6 cmake3 g++-4.8 git
- name: install other bits
if: ${{ matrix.compiler }} == g++-6
run: |
sudo apt -y install software-properties-common
sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test"
sudo apt update
sudo apt -y install g++-6
- name: create build environment
run: cmake -E make_directory $GITHUB_WORKSPACE/_build
- name: setup cmake initial cache
run: touch compiler-cache.cmake
- name: setup lto
# Workaround for enabling -flto on old GCC versions
# -Wl,--no-as-needed is needed to avoid the following linker error:
#
# /usr/lib/gcc/x86_64-linux-gnu/6/libstdc++.so: undefined reference to `pthread_create'
#
if: matrix.build_type == 'Release' && startsWith(matrix.compiler, 'g++')
run: >
COMPILER=${{ matrix.compiler }};
VERSION=${COMPILER#g++-};
PREFIX=/usr/bin/gcc;
echo "set (CMAKE_CXX_FLAGS \"-Wl,--no-as-needed -flto\" CACHE STRING \"\")" >> compiler-cache.cmake;
echo "set (CMAKE_RANLIB \"$PREFIX-ranlib-$VERSION\" CACHE FILEPATH \"\")" >> compiler-cache.cmake;
echo "set (CMAKE_AR \"$PREFIX-ar-$VERSION\" CACHE FILEPATH \"\")" >> compiler-cache.cmake;
echo "set (CMAKE_NM \"$PREFIX-nm-$VERSION\" CACHE FILEPAT \"\")" >> compiler-cache.cmake;
- name: configure cmake
env:
CXX: ${{ matrix.compiler }}
shell: bash
working-directory: ${{ github.workspace }}/_build
run: >
cmake -C ../compiler-cache.cmake ..
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=${{ matrix.run_tests }}
-DBENCHMARK_ENABLE_TESTING=${{ matrix.run_tests }}
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON
- name: build
shell: bash
working-directory: ${{ github.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}
- name: test
if: ${{ matrix.run_tests }}
shell: bash
working-directory: ${{ github.workspace }}/_build
run: ctest -C ${{ matrix.build_type }} -VV

View File

@ -13,13 +13,15 @@ jobs:
steps:
- name: Fetching sources
uses: actions/checkout@v2
- name: Installing build dependencies
run: |
sudo apt update
sudo apt install cmake doxygen gcc git
sudo apt install doxygen gcc git
- name: Creating build directory
run: |
mkdir build
run: mkdir build
- name: Building HTML documentation with Doxygen
run: |
cmake -S . -B build -DBENCHMARK_ENABLE_TESTING:BOOL=OFF -DBENCHMARK_ENABLE_DOXYGEN:BOOL=ON -DBENCHMARK_INSTALL_DOCS:BOOL=ON

View File

@ -17,10 +17,12 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint pylint-exit conan
- name: Run pylint
run: |
pylint `find . -name '*.py'|xargs` || pylint-exit $?

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.5.1)
cmake_minimum_required (VERSION 3.16.3)
foreach(p
CMP0048 # OK to clear PROJECT_VERSION on project()
@ -6,6 +6,7 @@ foreach(p
CMP0056 # export EXE_LINKER_FLAGS to try_run
CMP0057 # Support no if() IN_LIST operator
CMP0063 # Honor visibility properties for all targets
CMP0067 # Honor language standard in try_compile() source file signature
CMP0077 # Allow option() overrides in importing projects
)
if(POLICY ${p})
@ -137,6 +138,16 @@ if (BENCHMARK_BUILD_32_BITS)
add_required_cxx_compiler_flag(-m32)
endif()
if (MSVC)
set(BENCHMARK_CXX_STANDARD 14)
else()
set(BENCHMARK_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD ${BENCHMARK_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS OFF)
if (MSVC)
# Turn compiler warnings up to 11
string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@ -169,13 +180,6 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG")
endif()
else()
# Try and enable C++11. Don't use C++14 because it doesn't work in some
# configurations.
add_cxx_compiler_flag(-std=c++11)
if (NOT HAVE_CXX_FLAG_STD_CXX11)
add_cxx_compiler_flag(-std=c++0x)
endif()
# Turn compiler warnings up to 11
add_cxx_compiler_flag(-Wall)
add_cxx_compiler_flag(-Wextra)

View File

@ -7,13 +7,15 @@ still allow forward progress, we require any build tooling to be available for:
* The last two Ubuntu LTS releases
Currently, this means using build tool versions that are available for Ubuntu
18.04 (Bionic Beaver), Ubuntu 20.04 (Focal Fossa), and Debian 11 (bullseye).
Ubuntu 20.04 (Focal Fossa), Ubuntu 22.04 (Jammy Jellyfish) and Debian 11.4 (bullseye).
_Note, CI also runs ubuntu-16.04 and ubuntu-14.04 to ensure best effort support
for older versions._
_Note, CI also runs ubuntu-18.04 to attempt best effort support for older versions._
## cmake
The current supported version is cmake 3.5.1 as of 2018-06-06.
The current supported version is cmake 3.16.3 as of 2022-08-10.
* _3.10.2 (ubuntu 18.04)_
* 3.16.3 (ubuntu 20.04)
* 3.18.4 (debian 11.4)
* 3.22.1 (ubuntu 22.04)
_Note, this version is also available for Ubuntu 14.04, an older Ubuntu LTS
release, as `cmake3`._

View File

@ -69,7 +69,6 @@ set_target_properties(benchmark_main PROPERTIES
)
target_link_libraries(benchmark_main PUBLIC benchmark::benchmark)
set(generated_dir "${PROJECT_BINARY_DIR}")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")