parent
18cef378ea
commit
3a5cf5af9c
@ -1,4 +1,15 @@
|
||||
message("PRELOADING cache")
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
|
||||
set (WITH_SERVER ON CACHE BOOL "qa default")
|
||||
set (WITH_SAMPLE ON CACHE BOOL "qa default")
|
||||
set (WITH_VERBOSE_WINPR_ASSERT OFF CACHE BOOL "qa default")
|
||||
set (BUILD_SHARED_LIBS OFF CACHE BOOL "qa default")
|
||||
|
||||
set (BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "qa default")
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClangDetectTool.cmake)
|
||||
clang_detect_tool(CLANG_EXE clang REQUIRED)
|
||||
clang_detect_tool(CLANG_XX_EXE clang++ REQUIRED)
|
||||
|
||||
set (CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default")
|
||||
|
@ -1,4 +1,5 @@
|
||||
set (BUILD_TESTING ON CACHE BOOL "qa default")
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload")
|
||||
set (WITH_SAMPLE ON CACHE BOOL "qa default")
|
||||
set (WITH_SERVER ON CACHE BOOL "qa default")
|
||||
set (WITH_SHADOW ON CACHE BOOL "qa default")
|
||||
@ -8,10 +9,17 @@ set (WITH_CUPS ON CACHE BOOL "qa default")
|
||||
set (WITH_PCSC ON CACHE BOOL "qa default")
|
||||
set (WITH_SOXR ON CACHE BOOL "qa default")
|
||||
set (WITH_SWSCALE ON CACHE BOOL "qa default")
|
||||
set (WITH_DSP_FFMPEG OFF CACHE BOOL "qa default")
|
||||
set (WITH_FFMPEG OFF CACHE BOOL "qa default")
|
||||
set (WITH_DSP_FFMPEG ON CACHE BOOL "qa default")
|
||||
set (WITH_FFMPEG ON CACHE BOOL "qa default")
|
||||
set (WITH_SANITIZE_ADDRESS ON CACHE BOOL "qa default")
|
||||
set (CMAKE_C_FLAGS "-Weverything" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_FLAGS "-Weverything" CACHE STRING "qa default")
|
||||
set (CMAKE_C_COMPILER "/usr/bin/clang-10" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_COMPILER "/usr/bin/clang++-10" CACHE STRING "qa default")
|
||||
set (CMAKE_C_FLAGS "-Weverything -Wno-exit-time-destructors -Wno-cast-align -Wno-documentation -Wno-documentation-unknown-command -Wno-padded -Wno-covered-switch-default -Wno-declaration-after-statement" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_FLAGS "-Weverything -Wno-exit-time-destructors -Wno-cast-align -Wno-documentation -Wno-documentation-unknown-command -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-covered-switch-default -Wno-declaration-after-statement" CACHE STRING "qa default")
|
||||
|
||||
set (BUILD_WITH_CLANG_TIDY ON CACHE BOOL "qa default")
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClangDetectTool.cmake)
|
||||
clang_detect_tool(CLANG_EXE clang REQUIRED)
|
||||
clang_detect_tool(CLANG_XX_EXE clang++ REQUIRED)
|
||||
|
||||
set (CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default")
|
||||
set (CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default")
|
||||
|
48
cmake/ClangDetectTool.cmake
Normal file
48
cmake/ClangDetectTool.cmake
Normal file
@ -0,0 +1,48 @@
|
||||
function (clang_detect_tool VAR NAME OPTS)
|
||||
set(NAMES "")
|
||||
foreach(CNT RANGE 12 22)
|
||||
list(APPEND NAMES "${NAME}-${CNT}")
|
||||
endforeach()
|
||||
list(REVERSE NAMES)
|
||||
list(APPEND NAMES ${NAME})
|
||||
|
||||
find_program(${VAR}
|
||||
NAMES ${NAMES}
|
||||
${OPTS}
|
||||
)
|
||||
if (NOT ${VAR})
|
||||
message(WARNING "clang tool ${NAME} (${VAR}) not detected, skipping")
|
||||
unset(${VAR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${${VAR}} "--version"
|
||||
OUTPUT_VARIABLE _CLANG_TOOL_VERSION
|
||||
RESULT_VARIABLE _CLANG_TOOL_VERSION_FAILED
|
||||
)
|
||||
|
||||
if (_CLANG_TOOL_VERSION_FAILED)
|
||||
message(WARNING "A problem was encounterd with ${${VAR}}")
|
||||
message(WARNING "${_CLANG_TOOL_VERSION_FAILED}")
|
||||
unset(${VAR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "([7-9]|[1-9][0-9])\\.[0-9]\\.[0-9]" CLANG_TOOL_VERSION
|
||||
"${_CLANG_TOOL_VERSION}")
|
||||
|
||||
if (NOT CLANG_TOOL_VERSION)
|
||||
message(WARNING "problem parsing ${NAME} version for ${${VAR}}")
|
||||
unset(${VAR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_CLANG_TOOL_MINIMUM_VERSION "12.0.0")
|
||||
if (${CLANG_TOOL_VERSION} VERSION_LESS ${_CLANG_TOOL_MINIMUM_VERSION})
|
||||
message(WARNING "clang-format version ${CLANG_TOOL_VERSION} not supported")
|
||||
message(WARNING "Minimum version required: ${_CLANG_TOOL_MINIMUM_VERSION}")
|
||||
unset(${VAR})
|
||||
return()
|
||||
endif()
|
||||
endfunction()
|
@ -1,43 +1,12 @@
|
||||
# get all project files
|
||||
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.c *.h *.m *.java)
|
||||
# minimum version required
|
||||
set(_CLANG_FORMAT_MINIMUM_VERSION 7.0.0)
|
||||
|
||||
find_program(CLANG_FORMAT
|
||||
NAMES
|
||||
clang-format-8
|
||||
clang-format-7
|
||||
clang-format
|
||||
)
|
||||
include(ClangDetectTool)
|
||||
clang_detect_tool(CLANG_FORMAT clang-format "")
|
||||
|
||||
if (NOT CLANG_FORMAT)
|
||||
message(WARNING "clang-format not found in path! code format target not available.")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${CLANG_FORMAT} "--version"
|
||||
OUTPUT_VARIABLE _CLANG_FORMAT_VERSION
|
||||
RESULT_VARIABLE _CLANG_FORMAT_VERSION_FAILED
|
||||
)
|
||||
|
||||
if (_CLANG_FORMAT_VERSION_FAILED)
|
||||
message(WARNING "A problem was encounterd with ${CLANG_FORMAT}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "([7-9]|[1-9][0-9])\\.[0-9]\\.[0-9]" CLANG_FORMAT_VERSION
|
||||
"${_CLANG_FORMAT_VERSION}")
|
||||
|
||||
if (NOT CLANG_FORMAT_VERSION)
|
||||
message(WARNING "problem parsing clang-fromat version for ${CLANG_FORMAT}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (${CLANG_FORMAT_VERSION} VERSION_LESS ${_CLANG_FORMAT_MINIMUM_VERSION})
|
||||
message(WARNING "clang-format version ${CLANG_FORMAT_VERSION} not supported")
|
||||
message(WARNING "Minimum version required: ${_CLANG_FORMAT_MINIMUM_VERSION}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
clangformat
|
||||
COMMAND ${CLANG_FORMAT}
|
||||
|
Loading…
Reference in New Issue
Block a user