[cmake] update clang toolchain

This commit is contained in:
akallabeth 2023-05-23 08:41:25 +02:00 committed by Martin Fleisz
parent 3626981d8e
commit b5fc019c64
2 changed files with 29 additions and 5 deletions

View File

@ -2,12 +2,13 @@ if ($ENV{CLANG_VERSION})
SET (CLANG_VERSION "-$ENV{CLANG_VERSION}") SET (CLANG_VERSION "-$ENV{CLANG_VERSION}")
endif() endif()
SET (CLANG_WARNINGS "-pedantic -Weverything -Wno-padded -Wno-covered-switch-default -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-cast-align")
SET (CMAKE_C_COMPILER "/usr/bin/clang${CLANG_VERSION}" CACHE PATH "") SET (CMAKE_C_COMPILER "/usr/bin/clang${CLANG_VERSION}" CACHE PATH "")
SET (CMAKE_C_FLAGS "-pedantic -Wall -std=gnu99" CACHE STRING "") SET (CMAKE_C_FLAGS ${CLANG_WARNINGS} CACHE STRING "")
SET (CMAKE_C_FLAGS_DEBUG "-g" CACHE STRING "")
SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING "") SET (CMAKE_CXX_COMPILER "/usr/bin/clang++${CLANG_VERSION}" CACHE PATH "")
SET (CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" CACHE STRING "") SET (CMAKE_CXX_FLAGS ${CLANG_WARNINGS} CACHE STRING "")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "")
SET (CMAKE_AR "/usr/bin/llvm-ar${CLANG_VERSION}" CACHE PATH "") SET (CMAKE_AR "/usr/bin/llvm-ar${CLANG_VERSION}" CACHE PATH "")
SET (CMAKE_LINKER "/usr/bin/llvm-link${CLANG_VERSION}" CACHE PATH "") SET (CMAKE_LINKER "/usr/bin/llvm-link${CLANG_VERSION}" CACHE PATH "")

23
tools/build-clang.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash -xe
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
cmake \
-GNinja \
-DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/../cmake/ClangToolchain.cmake" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a;.so" \
-DBUILD_SHARED_LIBS=OFF \
-Bclang \
-S"$SCRIPT_PATH/.." \
-DCMAKE_INSTALL_PREFIX=/tmp/xxx \
-DWITH_SERVER=ON \
-DWITH_SAMPLE=ON \
-DWITH_CAIRO=ON \
-DWITH_FFMPEG=ON \
-DWITH_DSP_FFMPEG=ON \
-DWITH_PKCS11=ON \
-DWITH_SOZR=ON \
-DWITH_WAYLAND=ON \
-DWITH_WEBVIEW=ON \
-DWITH_SWSCALE=ON