aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorSergiu Deitsch <sergiud@users.noreply.github.com>2022-02-14 11:48:53 +0100
committerGitHub <noreply@github.com>2022-02-14 10:48:53 +0000
commit9e47d070fe736010bc0a40f3fc3ece6f8ade6f7e (patch)
tree96ffebe0b933ae128450462dffad6928dbe4344b /.github
parent6e51dcbcc3965b3f4b13d4bab5e43895c1a73290 (diff)
downloadgoogle-benchmark-9e47d070fe736010bc0a40f3fc3ece6f8ade6f7e.tar.gz
google-benchmark-9e47d070fe736010bc0a40f3fc3ece6f8ade6f7e.zip
annotate and export public symbols (#1321)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build-and-test.yml127
1 files changed, 115 insertions, 12 deletions
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 6ff6f49..d7406a7 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -10,7 +10,7 @@ jobs:
# TODO: add coverage build (requires lcov)
# TODO: add clang + libc++ builds for ubuntu
job:
- name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.compiler }}
+ name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -18,28 +18,39 @@ jobs:
os: [ubuntu-latest, ubuntu-20.04, macos-latest]
build_type: ['Release', 'Debug']
compiler: [g++, clang++]
- include:
- - displayTargetName: windows-latest-release
- os: windows-latest
- build_type: 'Release'
- - displayTargetName: windows-latest-debug
- os: windows-latest
- build_type: 'Debug'
+ lib: ['shared', 'static']
+
steps:
- uses: actions/checkout@v2
- 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 }}
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: >
- cmake $GITHUB_WORKSPACE
+ cmake -C ${{ github.workspace }}/compiler-cache.cmake
+ $GITHUB_WORKSPACE
-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
@@ -51,6 +62,57 @@ jobs:
working-directory: ${{ runner.workspace }}/_build
run: ctest -C ${{ matrix.build_type }} -VV
+ msvc:
+ name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msvc }}
+ runs-on: ${{ matrix.os }}
+ defaults:
+ run:
+ shell: powershell
+ strategy:
+ fail-fast: false
+ matrix:
+ msvc:
+ - VS-16-2019
+ - VS-17-2022
+ arch:
+ - x64
+ build_type:
+ - Debug
+ - Release
+ lib:
+ - shared
+ - static
+ include:
+ - msvc: VS-16-2019
+ os: windows-2019
+ generator: 'Visual Studio 16 2019'
+ - msvc: VS-17-2022
+ os: windows-2022
+ generator: 'Visual Studio 17 2022'
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: configure cmake
+ run: >
+ cmake -S . -B _build/
+ -A ${{ matrix.arch }}
+ -G "${{ matrix.generator }}"
+ -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
+ -DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
+
+ - name: build
+ run: cmake --build _build/ --config ${{ matrix.build_type }}
+
+ - name: setup test environment
+ # Make sure gmock and benchmark DLLs can be found
+ run: >
+ echo "$((Get-Item .).FullName)/_build/bin/${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;
+ echo "$((Get-Item .).FullName)/_build/src/${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;
+
+ - 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]
@@ -71,15 +133,34 @@ jobs:
- 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 $GITHUB_WORKSPACE
+ 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
@@ -126,16 +207,38 @@ jobs:
- 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 $GITHUB_WORKSPACE
+ 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 }}
- -DBENCHMARK_DOWNLOAD_DEPENDENCIES=${{ matrix.run_tests }}
+ -DCMAKE_CXX_VISIBILITY_PRESET=hidden
+ -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON
- name: build
shell: bash