From d46cd17d701b89f1db23f9d93ec1062a296f628e Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Mon, 30 Aug 2021 19:11:12 -0700 Subject: [PATCH 1/6] Add clangd cache directory to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6176972..c1cb671 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Editors. *.sw* .DS_Store +/.cache /.vscode # Build directory. From bbbb93ab5d549434c2e23b494d23854a49c7da41 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Wed, 1 Sep 2021 09:17:07 -0700 Subject: [PATCH 2/6] Switch CI to GitHub Actions (#55) * Fix Windows CI build. The Windows SDK versions present on our CI options (GitHub Actions hosted runners, AppVeyor) have headers that cause compilation warnings when included with MSVC operating in modern C modes (C11+). This PR disables the compilation warning caused by the Windows SDK headers, so we can get Windows feedback from CI. The warnings can be re-enabled when the Windows SDK used by our CI is upgraded to a version that doesn't trigger warnings. * Switch CI to GitHub Actions. --- .appveyor.yml | 38 -------------- .github/workflows/build.yml | 102 ++++++++++++++++++++++++++++++++++++ .travis.yml | 76 --------------------------- CMakeLists.txt | 6 +++ README.md | 3 +- 5 files changed, 109 insertions(+), 116 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index b23e02e..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Build matrix / environment variables are explained on: -# https://www.appveyor.com/docs/appveyor-yml/ -# This file can be validated on: https://ci.appveyor.com/tools/validate-yaml - -version: "{build}" - -environment: - matrix: - # AppVeyor currently has no custom job name feature. - # http://help.appveyor.com/discussions/questions/1623-can-i-provide-a-friendly-name-for-jobs - - JOB: Visual Studio 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - -platform: - - x86 - - x64 - -configuration: - - RelWithDebInfo - - Debug - -build_script: - - git submodule update --init --recursive - - mkdir build - - cd build - - if "%platform%"=="x86" (set CMAKE_GENERATOR_PLATFORM="Win32") - else (set CMAKE_GENERATOR_PLATFORM="%platform%") - - cmake --version - - cmake .. -G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_PLATFORM%" - -DCMAKE_CONFIGURATION_TYPES="%CONFIGURATION%" -DCRC32C_USE_GLOG=0 - - cmake --build . --config "%CONFIGURATION%" - - cd .. - -test_script: - - build\%CONFIGURATION%\crc32c_tests.exe - - build\%CONFIGURATION%\crc32c_capi_tests.exe - - build\%CONFIGURATION%\crc32c_bench.exe diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8b27b2f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,102 @@ +# Copyright 2021 The CRC32C Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. See the AUTHORS file for names of contributors. + +name: ci +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build-and-test: + name: >- + CI + ${{ matrix.os }} + ${{ matrix.compiler }} + ${{ matrix.optimized && 'release' || 'debug' }} + ${{ matrix.shared_lib && 'shared' || 'static' }} + ${{ matrix.use_glog && 'glog' || 'no-glog' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + compiler: [clang, gcc, msvc] + os: [ubuntu-latest, macos-latest, windows-latest] + optimized: [true, false] + shared_lib: [true, false] + use_glog: [true, false] + exclude: + # Our glog config doesn't work with shared libraries. + - use_glog: true + shared_lib: true + # MSVC only works on Windows. + - os: ubuntu-latest + compiler: msvc + - os: macos-latest + compiler: msvc + # Not testing with GCC on macOS. + - os: macos-latest + compiler: gcc + # Only testing with MSVC on Windows. + - os: windows-latest + compiler: clang + - os: windows-latest + compiler: gcc + # Not testing fringe configurations (glog, shared libraries) on Windows. + - os: windows-latest + use_glog: true + - os: windows-latest + shared_lib: true + include: + - compiler: clang + CC: clang + CXX: clang++ + - compiler: gcc + CC: gcc + CXX: g++ + - compiler: msvc + CC: + CXX: + + env: + CMAKE_BUILD_DIR: ${{ github.workspace }}/build + CMAKE_BUILD_TYPE: ${{ matrix.optimized && 'RelWithDebInfo' || 'Debug' }} + CC: ${{ matrix.CC }} + CXX: ${{ matrix.CXX }} + BINARY_SUFFIX: ${{ startsWith(matrix.os, 'windows') && '.exe' || '' }} + BINARY_PATH: >- + ${{ format( + startsWith(matrix.os, 'windows') && '{0}\build\{1}\' || '{0}/build/', + github.workspace, + matrix.optimized && 'RelWithDebInfo' || 'Debug') }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Generate build config + run: >- + cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} + -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/ + -DBUILD_SHARED_LIBS=${{ matrix.shared_lib && '1' || '0' }} + -DCRC32C_USE_GLOG=${{ matrix.use_glog && '1' || '0' }} + + - name: Build + run: >- + cmake --build "${{ env.CMAKE_BUILD_DIR }}" + --config "${{ env.CMAKE_BUILD_TYPE }}" + + - name: Run C++ API Tests + run: ${{ env.BINARY_PATH }}crc32c_tests${{ env.BINARY_SUFFIX }} + + - name: Run C API Tests + run: ${{ env.BINARY_PATH }}crc32c_capi_tests${{ env.BINARY_SUFFIX }} + + - name: Run Benchmarks + run: ${{ env.BINARY_PATH }}crc32c_bench${{ env.BINARY_SUFFIX }} + + - name: Test CMake installation + run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 183a5fb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -# Build matrix / environment variables are explained on: -# http://about.travis-ci.org/docs/user/build-configuration/ -# This file can be validated on: http://lint.travis-ci.org/ - -language: cpp -dist: bionic -osx_image: xcode12.5 - -compiler: -- gcc -- clang -os: -- linux -- osx - -env: -- GLOG=1 SHARED_LIB=0 BUILD_TYPE=Debug -- GLOG=1 SHARED_LIB=0 BUILD_TYPE=RelWithDebInfo -- GLOG=0 SHARED_LIB=0 BUILD_TYPE=Debug -- GLOG=0 SHARED_LIB=0 BUILD_TYPE=RelWithDebInfo -- GLOG=0 SHARED_LIB=1 BUILD_TYPE=Debug -- GLOG=0 SHARED_LIB=1 BUILD_TYPE=RelWithDebInfo - -addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - clang-12 - - cmake - - gcc-11 - - g++-11 - - ninja-build - homebrew: - packages: - - cmake - - gcc@11 - - llvm@12 - - ninja - update: true - -install: -# The following Homebrew packages aren't linked by default, and need to be -# prepended to the path explicitly. -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then - export PATH="$(brew --prefix llvm)/bin:$PATH"; - fi -# /usr/bin/gcc points to an older compiler on both Linux and macOS. -- if [ "$CXX" = "g++" ]; then export CXX="g++-11" CC="gcc-11"; fi -# /usr/bin/clang points to an older compiler on both Linux and macOS. -# -# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values -# below don't work on macOS. Fortunately, the path change above makes the -# default values (clang and clang++) resolve to the correct compiler on macOS. -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then - if [ "$CXX" = "clang++" ]; then export CXX="clang++-12" CC="clang-12"; fi; - fi -- echo ${CC} -- echo ${CXX} -- ${CXX} --version -- cmake --version - -before_script: -- mkdir -p build && cd build -- cmake .. -G Ninja -DCRC32C_USE_GLOG=$GLOG -DCMAKE_BUILD_TYPE=$BUILD_TYPE - -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_INSTALL_PREFIX=$HOME/.local -- cmake --build . -- cd .. - -script: -- build/crc32c_tests -- build/crc32c_capi_tests -- build/crc32c_bench -- cd build && cmake --build . --target install diff --git a/CMakeLists.txt b/CMakeLists.txt index 6696453..8490728 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,6 +362,12 @@ if(CRC32C_BUILD_TESTS) # Warnings as errors in Visual Studio for this project's targets. if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set_property(TARGET crc32c_capi_tests APPEND PROPERTY COMPILE_OPTIONS "/WX") + + # The Windows SDK version currently on CI produces warnings when some + # headers are #included using C99 compatibity mode or above. This workaround + # can be removed once the Windows SDK on our CI is upgraded. + set_property(TARGET crc32c_capi_tests + APPEND PROPERTY COMPILE_OPTIONS "/wd5105") endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_test(NAME crc32c_capi_tests COMMAND crc32c_capi_tests) diff --git a/README.md b/README.md index 58ba38e..bb64bae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # CRC32C -[![Build Status](https://travis-ci.org/google/crc32c.svg?branch=master)](https://travis-ci.org/google/crc32c) -[![Build Status](https://ci.appveyor.com/api/projects/status/moiq7331pett4xuj/branch/master?svg=true)](https://ci.appveyor.com/project/pwnall/crc32c) +[![Build Status](https://github.com/google/crc32c/actions/workflows/build.yml/badge.svg)](https://github.com/google/crc32c/actions/workflows/build.yml) New file format authors should consider [HighwayHash](https://github.com/google/highwayhash). The initial version of From b9d6e825a1e6783195a6051639179152dac70b3b Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Wed, 1 Sep 2021 09:19:47 -0700 Subject: [PATCH 3/6] Fix Windows CI build. (#54) The Windows SDK versions present on our CI options (GitHub Actions hosted runners, AppVeyor) have headers that cause compilation warnings when included with MSVC operating in modern C modes (C11+). This PR disables the compilation warning caused by the Windows SDK headers, so we can get Windows feedback from CI. The warnings can be re-enabled when the Windows SDK used by our CI is upgraded to a version that doesn't trigger warnings. From 02e65f4fd3065d27b2e29324800ca6d04df16126 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Tue, 5 Oct 2021 12:47:30 -0700 Subject: [PATCH 4/6] Bump deps (#56) --- third_party/benchmark | 2 +- third_party/glog | 2 +- third_party/googletest | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/benchmark b/third_party/benchmark index bf585a2..e991355 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit bf585a2789e30585b4e3ce6baf11ef2750b54677 +Subproject commit e991355c02b93fe17713efe04cbc2e278e00fdbd diff --git a/third_party/glog b/third_party/glog index c8f8135..5652319 160000 --- a/third_party/glog +++ b/third_party/glog @@ -1 +1 @@ -Subproject commit c8f8135a5720aee7de8328b42e4c43f8aa2e60aa +Subproject commit 56523194b3ce1212414c93d55f31832e94677f55 diff --git a/third_party/googletest b/third_party/googletest index 18f8200..3b49be0 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 18f8200e3079b0e54fa00cb7ac55d4c39dcf6da6 +Subproject commit 3b49be074d5c1340eeb447e6a8e78427051e675a From 89f69843a135108ff1fcc82660bb3d784f4f987a Mon Sep 17 00:00:00 2001 From: Munkybooty Date: Thu, 30 Dec 2021 19:18:17 -0500 Subject: [PATCH 5/6] Fix misspelled "Proccess" in comment --- src/crc32c_sse42.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crc32c_sse42.cc b/src/crc32c_sse42.cc index fc0cb07..524b237 100644 --- a/src/crc32c_sse42.cc +++ b/src/crc32c_sse42.cc @@ -174,7 +174,7 @@ uint32_t ExtendSse42(uint32_t crc, const uint8_t* data, size_t size) { } } - // Proccess the data in predetermined block sizes with tables for quickly + // Process the data in predetermined block sizes with tables for quickly // combining the checksum. Experimentally it's better to use larger block // sizes where possible so use a hierarchy of decreasing block sizes. uint64_t l64 = l; From 21fc8ef30415a635e7351ffa0e5d5367943d4a94 Mon Sep 17 00:00:00 2001 From: Dimitris Apostolou Date: Tue, 8 Feb 2022 20:23:15 +0200 Subject: [PATCH 6/6] Fix typo (#59) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8490728..e0b8e7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,8 +364,8 @@ if(CRC32C_BUILD_TESTS) set_property(TARGET crc32c_capi_tests APPEND PROPERTY COMPILE_OPTIONS "/WX") # The Windows SDK version currently on CI produces warnings when some - # headers are #included using C99 compatibity mode or above. This workaround - # can be removed once the Windows SDK on our CI is upgraded. + # headers are #included using C99 compatibility mode or above. This + # workaround can be removed once the Windows SDK on our CI is upgraded. set_property(TARGET crc32c_capi_tests APPEND PROPERTY COMPILE_OPTIONS "/wd5105") endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")