From cfa21d936ba7317d260f0e343e4bc98aacb9aa4a Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 12 Aug 2024 17:54:25 +0200 Subject: [PATCH] C.I.: Resolve Android GitHub CI failure --- .github/workflows/ci.yml | 37 +++++++++++++++++++------------------ CMakeLists.txt | 16 ++++++++++++++++ scripts/known_good.json | 2 +- scripts/update_deps.py | 19 ++++++++++++++++++- 4 files changed, 54 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aae81f8..8533a789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,39 +68,40 @@ jobs: run: cmake --install build --prefix build/install --config ${{matrix.config}} android: - env: - CMAKE_C_COMPILER_LAUNCHER: ccache - CMAKE_CXX_COMPILER_LAUNCHER: ccache runs-on: ubuntu-22.04 + strategy: + matrix: + abi: [ armeabi-v7a ] + build_tests: [ "OFF" ] + stl_type: ["c++_static"] + steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install jsonschema - run: python3 -m pip install jsonschema + - uses: lukka/get-cmake@latest + - name: CMake version + run: cmake --version - name: Setup ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: android-ccache - - uses: lukka/get-cmake@latest + key: android-${{ matrix.abi }}-${{ matrix.build_tests }}-${{ matrix.stl_type }} - name: Configure + env: + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache run: | cmake -S . -B build/ --toolchain $ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \ -D ANDROID_PLATFORM=26 \ - -D CMAKE_ANDROID_ARCH_ABI=x86_64 \ - -D CMAKE_ANDROID_STL_TYPE=c++_static \ - -D CMAKE_ANDROID_RTTI=YES \ - -D CMAKE_ANDROID_EXCEPTIONS=YES \ + -D CMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }} \ + -D CMAKE_ANDROID_STL_TYPE=${{ matrix.stl_type }} \ -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ - -D BUILD_WERROR=ON \ -D CMAKE_BUILD_TYPE=Debug \ + -D BUILD_TESTS=${{ matrix.build_tests }} \ -D UPDATE_DEPS=ON \ - -D BUILD_TESTS=OFF + -D BUILD_WERROR=ON - name: Build - run: cmake --build build + run: cmake --build build/ - name: Install - run: cmake --install build --prefix build/install + run: cmake --install build/ --prefix build/install windows-latest: runs-on: windows-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 920ba18e..65b41577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,19 @@ +# ~~~ +# Copyright (c) 2014-2024 Valve Corporation +# Copyright (c) 2014-2024 LunarG, 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. +# ~~~ cmake_minimum_required(VERSION 3.17.2) project(VULKAN_PROFILES LANGUAGES CXX C) diff --git a/scripts/known_good.json b/scripts/known_good.json index 6c2c0554..c200d619 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -68,7 +68,7 @@ "sub_dir": "valijson", "build_dir": "valijson/build", "install_dir": "valijson/build/install", - "commit": "v1.0.1" + "commit": "v1.0.2" }, { "name": "googletest", diff --git a/scripts/update_deps.py b/scripts/update_deps.py index 55375479..0ec4eba0 100644 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -281,6 +281,9 @@ def command_output(cmd, directory): if VERBOSE: print('In {d}: {cmd}'.format(d=directory, cmd=cmd)) + # errors='replace' affects only how the text output is decoded, and indicates that + # 8-bit characters that aren't recognized by the UTF decoder will be replaced with + # an "unknown character" glyph instead of crashing. result = subprocess.run(cmd, cwd=directory, capture_output=True, text=True, errors='replace') if result.returncode != 0: @@ -493,6 +496,13 @@ def CMakeConfig(self, repos): # Set build config for single-configuration generators (this is a no-op on multi-config generators) cmake_cmd.append(f'-D CMAKE_BUILD_TYPE={CONFIG_MAP[self._args.config]}') + # Optionally build dependencies with ASAN enabled + if self._args.asan: + cmake_cmd.append(f'-D CMAKE_CXX_FLAGS=-fsanitize=address') + cmake_cmd.append(f'-D CMAKE_C_FLAGS=-fsanitize=address') + if platform.system() != 'Windows': + os.environ['LDFLAGS'] = '-fsanitize=address' + # Use the CMake -A option to select the platform architecture # without needing a Visual Studio generator. if platform.system() == 'Windows' and self._args.generator != "Ninja": @@ -554,7 +564,7 @@ def Build(self, repos, repo_dict): total_time = time.time() - start - print(f"Installed {self.name} ({self.commit}) in {total_time} seconds", flush=True) + print(f"Installed {self.name} ({self.commit}) in {total_time:.3f} seconds", flush=True) def IsOptional(self, opts): return len(self.optional.intersection(opts)) > 0 @@ -717,6 +727,12 @@ def main(): metavar='VAR[=VALUE]', help="Add CMake command line option -D'VAR'='VALUE' to the CMake generation command line; may be used multiple times", default=[]) + parser.add_argument( + '--asan', + dest='asan', + action='store_true', + help="Build dependencies with ASAN enabled", + default=False) args = parser.parse_args() save_cwd = os.getcwd() @@ -799,3 +815,4 @@ def main(): if __name__ == '__main__': main() +