diff --git a/cmake/ClangToolchain.cmake b/cmake/ClangToolchain.cmake index d781bab86..b5ae35af2 100644 --- a/cmake/ClangToolchain.cmake +++ b/cmake/ClangToolchain.cmake @@ -2,12 +2,13 @@ if ($ENV{CLANG_VERSION}) SET (CLANG_VERSION "-$ENV{CLANG_VERSION}") 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_FLAGS "-pedantic -Wall -std=gnu99" CACHE STRING "") -SET (CMAKE_C_FLAGS_DEBUG "-g" CACHE STRING "") -SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING "") -SET (CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" CACHE STRING "") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "") +SET (CMAKE_C_FLAGS ${CLANG_WARNINGS} CACHE STRING "") + +SET (CMAKE_CXX_COMPILER "/usr/bin/clang++${CLANG_VERSION}" CACHE PATH "") +SET (CMAKE_CXX_FLAGS ${CLANG_WARNINGS} CACHE STRING "") SET (CMAKE_AR "/usr/bin/llvm-ar${CLANG_VERSION}" CACHE PATH "") SET (CMAKE_LINKER "/usr/bin/llvm-link${CLANG_VERSION}" CACHE PATH "") diff --git a/tools/build-clang.sh b/tools/build-clang.sh new file mode 100755 index 000000000..c5e721021 --- /dev/null +++ b/tools/build-clang.sh @@ -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