From 9a6d15ab74c3f9e0257f3ad0594fb9122a537c1a Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:48:06 -0800 Subject: [PATCH] ci: Only use Linux clang for app image build. (#7244) * ci: Only use Linux clang for app image build. * build: Re-add -Wno-attributes for GCC 11. --- .ci/linux.sh | 10 ++++++---- src/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.ci/linux.sh b/.ci/linux.sh index 612aaec1b..58912ba3e 100755 --- a/.ci/linux.sh +++ b/.ci/linux.sh @@ -1,13 +1,15 @@ -#!/bin/sh -ex +#!/bin/bash -ex + +if [ "$TARGET" = "appimage" ]; then + export COMPILER_FLAGS=(-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=/etc/bin/ld.lld) +fi mkdir build && cd build cmake .. -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_LINKER=/etc/bin/ld.lld \ + "${COMPILER_FLAGS[@]}" \ -DENABLE_QT_TRANSLATION=ON \ -DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5f22267e..52fc64711 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,6 +124,12 @@ else() add_compile_options("-stdlib=libc++") endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL GNU) + # GCC may warn when it ignores attributes like maybe_unused, + # which is a problem for older versions (e.g. GCC 11). + add_compile_options("-Wno-attributes") + endif() + if (MINGW) add_definitions(-DMINGW_HAS_SECURE_API) if (COMPILE_WITH_DWARF)