Skip to content

Commit

Permalink
C.I.: Resolve Android GitHub CI failure
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Aug 13, 2024
1 parent 899a49e commit cfa21d9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion scripts/known_good.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion scripts/update_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -799,3 +815,4 @@ def main():

if __name__ == '__main__':
main()

0 comments on commit cfa21d9

Please sign in to comment.