Add linter and fix issues

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-07-14 01:05:22 +03:00
parent c21397cef5
commit 7dc90058b2
5 changed files with 427 additions and 332 deletions

View File

@@ -8,6 +8,10 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_MODULE_STD 1)
add_compile_options(
-fstack-protector-strong
-fwrapv
)
add_compile_definitions(
WLR_USE_UNSTABLE
XR_USE_PLATFORM_EGL
@@ -16,6 +20,8 @@ add_compile_definitions(
find_package(PkgConfig REQUIRED)
find_package(Boost REQUIRED)
pkg_check_modules(WAYLAND REQUIRED IMPORTED_TARGET GLOBAL wayland-server)
pkg_check_modules(EGL REQUIRED IMPORTED_TARGET egl)
pkg_check_modules(GLES2 REQUIRED IMPORTED_TARGET glesv2)
@@ -44,6 +50,13 @@ set(PLATFORM DRM)
set(BUILD_EXAMPLES OFF)
FetchContent_MakeAvailable(raylib)
FetchContent_Declare(
cpptrace
GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
GIT_TAG v1.0.1
)
FetchContent_MakeAvailable(cpptrace)
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PUBLIC
src/main.cpp
@@ -60,9 +73,17 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
PkgConfig::GLES2
PkgConfig::WLROOTS
PkgConfig::OPENXR
Boost::boost
raylib
cpptrace::cpptrace
)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_CLANG_TIDY "clang-tidy;-header-filter=^${CMAKE_SOURCE_DIR}/src/.*;-checks=*,-some-disabled-checks,misc-const-correctness,modernize-use-nullptr,bugprone-branch-clone,bugprone-use-after-move,performance-unnecessary-value-param,hicpp-no-malloc,cppcoreguidelines-pro-type-const-cast,clang-analyzer-core.NullDereference,-fuchsia-overloaded-operator,-readability-identifier-length,-bugprone-easily-swappable-parameters,-fuchsia-trailing-return,-misc-non-private-member-variables-in-classes,-readability-math-missing-parentheses,-llvmlibc-implementation-in-namespace,-misc-include-cleaner,-modernize-use-std-print,-llvmlibc-restrict-system-libc-headers,-fuchsia-statically-constructed-objects,-cppcoreguidelines-avoid-non-const-global-variables,-llvmlibc-callee-namespace,-misc-use-anonymous-namespace,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-hicpp-uppercase-literal-suffix,-readability-uppercase-literal-suffix,-fuchsia-default-arguments-calls,-altera-unroll-loops,-fuchsia-default-arguments-declarations,-readability-function-cognitive-complexity,-altera-struct-pack-align,-altera-id-dependent-backward-branch,-cppcoreguidelines-pro-type-reinterpret-cast,-boost-use-ranges,-cppcoreguidelines-owning-memory,-readability-redundant-declaration"
)
# Wayland protocol codegen
set(XDG_SHELL_XML
${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml
)