diff --git a/.github/workflows/autoroll.yml b/.github/workflows/autoroll.yml new file mode 100644 index 000000000..e55cecb70 --- /dev/null +++ b/.github/workflows/autoroll.yml @@ -0,0 +1,66 @@ +# Copyright 2023 The Shaderc Authors. All rights reserved. +# +# 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 +# +# http://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,s either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Update dependencies +permissions: + contents: read + +on: + schedule: + - cron: '0 2 * * *' + workflow_dispatch: + +jobs: + update-dependencies: + permissions: + contents: write + pull-requests: write + name: Update dependencies + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Checkout the depot tools they are needed by roll_deps.sh + - name: Checkout depot tools + run: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + + - name: Update PATH + run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH + + - name: Download dependencies + run: python3 utils/git-sync-deps + + - name: Setup git user information + run: | + git config user.name "GitHub Actions[bot]" + git config user.email "<>" + git checkout -b roll_deps + + - name: Update dependencies + run: | + utils/roll-deps + if [[ `git diff HEAD..origin/main --name-only | wc -l` == 0 ]]; then + echo "changed=false" >> $GITHUB_OUTPUT + else + echo "changed=true" >> $GITHUB_OUTPUT + fi + id: update_dependencies + - name: Push changes and create PR + if: steps.update_dependencies.outputs.changed == 'true' + run: | + git push --force --set-upstream origin roll_deps + gh pr create --label 'kokoro:run' --base main -f || true + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/CHANGES b/CHANGES index 43bedcfd4..2cd55c574 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,19 @@ Revision history for Shaderc -v2023.5-dev 2022-05-24 +v2023.7-dev 2023-08-09 + - Start v2023.7 development + +v2023.6 2023-08-09 + - Update dependencies, including SPIRV-Tools v2023.4.rc2 + +v2023.5 2023-07-19 + - Update dependencies + - Update to Android NDK r25c + - Update Android API level for test project (#1333) - For testing, add a dependency on Abseil's C++ library + - Fix MSVC runtime library linking in CMake (#1339) -v2023.4 2022-05-24 +v2023.4 2023-05-24 - Refresh Glslang, SPIRV-Tools, SPIRV-Headers - Android.mk: - Require NDK 21d or later @@ -12,16 +22,16 @@ v2023.4 2022-05-24 - glslc and APIs: - Add options to control mesh shading limits -v2023.3 2022-03-17 +v2023.3 2023-03-17 - Shaderc now requires C++17 - Drop support for VS 2015 - Add glslc option -fpreserve-bindings - Refresh Glslang, SPIRV-Tools -v2023.2 2022-01-18 +v2023.2 2023-01-18 - Update DEPS to pull in SPIRV-Tools bugfix #5049 -v2023.1 2022-01-13 +v2023.1 2023-01-13 - General/Build - Removed support for GCC-based code coverage builds - Update minimum CMake to 3.17.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 633c2448d..075641e4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,6 @@ cmake_minimum_required(VERSION 3.17.2) -if (POLICY CMP00091) - # Enable MSVC Runtime Library Property - cmake_policy(SET CMP0091 NEW) -endif() - project(shaderc) enable_testing() @@ -114,17 +109,12 @@ add_custom_target(add-copyright if(MSVC) option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" - ${SHADERC_ENABLE_SHARED_CRT}) - if (NOT SHADERC_ENABLE_SHARED_CRT) - # Link executables statically by replacing /MD with /MT everywhere. - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - endif(NOT SHADERC_ENABLE_SHARED_CRT) + OFF) + if (SHADERC_ENABLE_SHARED_CRT) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() endif(MSVC) diff --git a/DEPS b/DEPS index c8e0966e6..0684ff24b 100644 --- a/DEPS +++ b/DEPS @@ -5,13 +5,13 @@ vars = { 'google_git': 'https://github.com/google', 'khronos_git': 'https://github.com/KhronosGroup', - 'abseil_revision': '79ca5d7aad63973c83a4962a66ab07cd623131ea', - 'effcee_revision' : '66edefd2bb641de8a2f46b476de21f227fc03a28', - 'glslang_revision': '9fbc561947f6b5275289a1985676fb7267273e09', - 'googletest_revision': 'd9c309fdab807b716c2cf4d4a42989b8c34f712a', + 'abseil_revision': '5be22f98733c674d532598454ae729253bc53e82', + 'effcee_revision' : '19b4aa87af25cb4ee779a071409732f34bfc305c', + 'glslang_revision': '76b52ebf77833908dc4c0dd6c70a9c357ac720bd', + 'googletest_revision': 'c541e7c11044b1e0303103ef8a47d7a9632c479b', 're2_revision': 'c9cba76063cf4235c1a15dd14a24a4ef8d623761', - 'spirv_headers_revision': 'bdbfd019be6952fd8fa9bd5606a8798a7530c853', - 'spirv_tools_revision': 'e7c6084fd1d6d6f5ac393e842728d8be309688ca', + 'spirv_headers_revision': '124a9665e464ef98b8b718d572d5f329311061eb', + 'spirv_tools_revision': '8e3da01b45806fbacbb9e6fce9c5f9ae49f60e42', } deps = { diff --git a/README.md b/README.md index b6031327e..3f54dedd0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Shaderc has been shipping in the [Android NDK](https://developer.android.com/ndk/index.html) since version r12b. (The NDK build uses sources from https://android.googlesource.com/platform/external/shaderc/. Those repos are downstream from GitHub.) -We currently require r21d. +We currently require r25c. For licensing terms, please see the [`LICENSE`](LICENSE) file. If interested in contributing to this project, please see [`CONTRIBUTING.md`](CONTRIBUTING.md). @@ -140,14 +140,11 @@ ctest -C {Release|Debug|MinSizeRel|RelWithDebInfo} ``` 4c) Or build with MinGW on Linux for Windows: -(Skip building threaded unit tests due to -[Googletest bug 606](https://github.com/google/googletest/issues/606)) ```sh cd $BUILD_DIR cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR \ - -DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/linux-mingw-toolchain.cmake \ - -Dgtest_disable_pthreads=ON + -DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/linux-mingw-toolchain.cmake ninja ``` @@ -167,6 +164,7 @@ API in your project. For building, testing, and profiling Shaderc, the following tools should be installed regardless of your OS: +- A C++17 compiler. Recent versions of Clang, GCC, and MSVC work. - [CMake](http://www.cmake.org/) 3.14 or later: for generating compilation targets. - Shaderc is tested with cmake 3.17.2 - [Python 3](http://www.python.org/): for utility scripts and running the test suite. @@ -174,6 +172,7 @@ installed regardless of your OS: On Linux, if cross compiling to Windows: - [`mingw`](http://www.mingw.org): A GCC-based cross compiler targeting Windows so that generated executables use the Microsoft C runtime libraries. + The MinGW compiler must support C++17. On Windows, the following tools should be installed and available on your path: diff --git a/kokoro/android-release/build-docker.sh b/kokoro/android-release/build-docker.sh index b05e6e740..8bd5215f5 100755 --- a/kokoro/android-release/build-docker.sh +++ b/kokoro/android-release/build-docker.sh @@ -27,7 +27,7 @@ set -x using cmake-3.17.2 using ninja-1.10.0 -using ndk-r21d # Sets ANDROID_NDK_HOME, pointing at the NDK's root dir +using ndk-r25c # Sets ANDROID_NDK_HOME, pointing at the NDK's root dir cd $ROOT_DIR ./utils/git-sync-deps @@ -49,7 +49,7 @@ cmake \ -DANDROID_NDK=$ANDROID_NDK_HOME .. echo $(date): Build glslang... -ninja glslangValidator +ninja glslang-standalone echo $(date): Build everything... ninja diff --git a/kokoro/linux/build-docker.sh b/kokoro/linux/build-docker.sh index d91af15de..7d71b6123 100755 --- a/kokoro/linux/build-docker.sh +++ b/kokoro/linux/build-docker.sh @@ -53,7 +53,7 @@ then ADDITIONAL_CMAKE_FLAGS="-DDISABLE_EXCEPTIONS=ON -DDISABLE_RTTI=ON" elif [ $CONFIG = "RELEASE_MINGW" ] then - ADDITIONAL_CMAKE_FLAGS="-Dgtest_disable_pthreads=ON -DCMAKE_TOOLCHAIN_FILE=$ROOT_DIR/cmake/linux-mingw-toolchain.cmake" + ADDITIONAL_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$ROOT_DIR/cmake/linux-mingw-toolchain.cmake" SKIP_TESTS="True" fi @@ -69,7 +69,7 @@ echo $(date): Starting build... cmake -GNinja -DCMAKE_INSTALL_PREFIX=$KOKORO_ARTIFACTS_DIR/install -DRE2_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ADDITIONAL_CMAKE_FLAGS .. echo $(date): Build glslang... -ninja glslangValidator +ninja glslang-standalone echo $(date): Build everything... ninja diff --git a/kokoro/linux/presubmit_mingw_release.cfg b/kokoro/linux/presubmit_mingw_release.cfg new file mode 100644 index 000000000..bfc53adc0 --- /dev/null +++ b/kokoro/linux/presubmit_mingw_release.cfg @@ -0,0 +1,16 @@ +# Copyright (C) 2017 Google Inc. +# +# 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 +# +# http://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. + +# Presubmit build configuration. +build_file: "shaderc/kokoro/linux/build_mingw_release.sh" diff --git a/kokoro/macos/build.sh b/kokoro/macos/build.sh index 6383e8c1a..c39c9b45d 100644 --- a/kokoro/macos/build.sh +++ b/kokoro/macos/build.sh @@ -43,7 +43,7 @@ echo $(date): Starting build... cmake -GNinja -DCMAKE_INSTALL_PREFIX=$KOKORO_ARTIFACTS_DIR/install -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. echo $(date): Build glslang... -ninja glslangValidator +ninja glslang-standalone echo $(date): Build everything... ninja diff --git a/kokoro/ndk-build/build-docker.sh b/kokoro/ndk-build/build-docker.sh index e86cc37a3..12d178be1 100755 --- a/kokoro/ndk-build/build-docker.sh +++ b/kokoro/ndk-build/build-docker.sh @@ -40,7 +40,7 @@ function clean_dir() { # Get source for dependencies, as specified in the DEPS file /usr/bin/python3 utils/git-sync-deps --treeless -using ndk-r21d +using ndk-r25c clean_dir "$ROOT_DIR/build" cd "$ROOT_DIR/build" diff --git a/kokoro/windows/build.bat b/kokoro/windows/build.bat index 7483af381..a87cfea65 100644 --- a/kokoro/windows/build.bat +++ b/kokoro/windows/build.bat @@ -59,7 +59,7 @@ cmake %CMAKE_FLAGS% .. if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% echo "Build glslang... %DATE% %TIME%" -ninja glslangValidator +ninja glslang-standalone if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% echo "Build everything... %DATE% %TIME%" diff --git a/libshaderc/src/shaderc_cpp_test.cc b/libshaderc/src/shaderc_cpp_test.cc index 31667044c..9cb5e3cbe 100644 --- a/libshaderc/src/shaderc_cpp_test.cc +++ b/libshaderc/src/shaderc_cpp_test.cc @@ -545,7 +545,8 @@ TEST_F(CppInterface, CompileAndOptimizeForVulkan10Failure) { // TODO(antiagainst): the error message can be improved to be more // explicit regarding Vulkan 1.1 HasSubstr("compilation succeeded but failed to optimize: " - "Invalid capability operand")); + "Capability GroupNonUniform is not allowed by Vulkan " + "1.0 specification (or requires extension)")); } TEST_F(CppInterface, CompileAndOptimizeForVulkan11Success) { diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 700f472db..a01f31eaf 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -65,6 +65,16 @@ if (NOT TARGET SPIRV-Tools) add_subdirectory(${SHADERC_EFFCEE_DIR} effcee) endif() add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools) + if (NOT "${SPIRV_SKIP_TESTS}") + if (MSVC) + if (${MSVC_VERSION} LESS 1920) + # VS 2017 requires /bigobj on test_opt + # https://github.com/google/shaderc/issues/1345 + # https://github.com/KhronosGroup/SPIRV-Tools/issues/5335 + target_compile_options(test_opt PRIVATE /bigobj) + endif() + endif() + endif() endif() if (NOT TARGET SPIRV-Tools) message(FATAL_ERROR "SPIRV-Tools was not found - required for compilation") diff --git a/utils/roll-deps b/utils/roll-deps index f579efc6a..8f145c9a9 100755 --- a/utils/roll-deps +++ b/utils/roll-deps @@ -18,18 +18,23 @@ # # Depends on roll-dep from depot_path being in PATH. -effcee_dir="third_party/effcee/" -effcee_trunk="origin/main" -glslang_dir="third_party/glslang/" -glslang_trunk="origin/main" -googletest_dir="third_party/googletest/" -googletest_trunk="origin/master" -re2_dir="third_party/re2/" -re2_trunk="origin/main" -spirv_headers_dir="third_party/spirv-headers/" -spirv_headers_trunk="origin/main" -spirv_tools_dir="third_party/spirv-tools/" -spirv_tools_trunk="origin/main" +set -eo pipefail + +function ExitIfIsInterestingError() { + local return_code=$1 + if [[ ${return_code} -ne 0 && ${return_code} -ne 2 ]]; then + exit ${return_code} + fi + return 0 +} + +dependencies=("third_party/effcee/" + "third_party/glslang/" + "third_party/googletest/" + "third_party/re2/" + "third_party/spirv-headers/" + "third_party/spirv-tools/") +branch="origin/main" # This script assumes it's parent directory is the repo root. repo_path=$(dirname "$0")/.. @@ -41,13 +46,12 @@ if [[ $(git diff --stat) != '' ]]; then exit 1 fi -old_head=$(git rev-parse HEAD) +echo "*** Ignore messages about running 'git cl upload' ***" -roll-dep --ignore-dirty-tree --roll-to="${effcee_trunk}" "${effcee_dir}" -roll-dep --ignore-dirty-tree --roll-to="${glslang_trunk}" "${glslang_dir}" -roll-dep --ignore-dirty-tree --roll-to="${googletest_trunk}" "${googletest_dir}" -roll-dep --ignore-dirty-tree --roll-to="${re2_trunk}" "${re2_dir}" -roll-dep --ignore-dirty-tree --roll-to="${spirv_headers_trunk}" "${spirv_headers_dir}" -roll-dep --ignore-dirty-tree --roll-to="${spirv_tools_trunk}" "${spirv_tools_dir}" +set +e -git rebase --interactive "${old_head}" +for dep in ${dependencies[@]}; do + echo "Rolling $dep" + roll-dep --ignore-dirty-tree --roll-to="${branch}" "${dep}" + ExitIfIsInterestingError $? +done diff --git a/utils/update_build_version.py b/utils/update_build_version.py index 578539079..11ee53e02 100755 --- a/utils/update_build_version.py +++ b/utils/update_build_version.py @@ -75,7 +75,7 @@ def deduce_software_version(directory): # Allow trailing whitespace in the checked-out source code has # unexpected carriage returns on a linefeed-only system such as # Linux. - pattern = re.compile(r'^(v\d+\.\d+(-dev)?) \d\d\d\d-\d\d-\d\d\s*$') + pattern = re.compile(r'^(v\d+\.\d+(-dev|[\.-]rc\d+)?) \d\d\d\d-\d\d-\d\d\s*$') changes_file = os.path.join(directory, 'CHANGES') with open(changes_file, errors='replace') as f: for line in f.readlines():