TMP / wip clang-tidy

This commit is contained in:
OLEGSHA 2022-11-30 15:08:21 +03:00
parent 556b15cce9
commit 678025b803
3 changed files with 37 additions and 8 deletions

View File

@ -2,6 +2,24 @@ cmake_minimum_required(VERSION 3.12)
project(progressia) project(progressia)
set(VERSION "0.0.1") set(VERSION "0.0.1")
add_executable(progressia)
# Options
option(DEV_MODE "Enable additional functionality required for development.")
string(CONCAT BUILD_ID_expl
"Build ID or \"dev\".\n"
"Set to a unique identifying string if you intend to publish your builds.")
set(BUILD_ID "dev" CACHE STRING "${BUILD_ID_expl}")
string(CONCAT VULKAN_ERROR_CHECKING_expl
"Enable Vulkan validation layers to detect Vulkan API usage errors "
"at runtime.\n"
"Requires Vulkan SDK. This will lead to decreased performance.")
option(VULKAN_ERROR_CHECKING "${VULKAN_ERROR_CHECKING_expl}")
# Tools
set(tools ${PROJECT_SOURCE_DIR}/tools) set(tools ${PROJECT_SOURCE_DIR}/tools)
set(generated ${PROJECT_BINARY_DIR}/generated) set(generated ${PROJECT_BINARY_DIR}/generated)
@ -10,13 +28,10 @@ file(MAKE_DIRECTORY "${generated}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/")
include(embed/embed) include(embed/embed)
include(glslc) include(glslc)
include(clang-tidy/clang-tidy)
# Options
option(BUILD_ID "Build ID. Set to \"dev\" unless building a release that you intend to publish" "dev")
option(VULKAN_ERROR_CHECKING "Enable Vulkan validation layers to detect Vulkan API usage errors at runtime")
# Source files # Source files
add_executable(progressia target_sources(progressia PRIVATE
desktop/main.cpp desktop/main.cpp
desktop/graphics/glfw_mgmt.cpp desktop/graphics/glfw_mgmt.cpp
desktop/graphics/vulkan_common.cpp desktop/graphics/vulkan_common.cpp
@ -51,6 +66,9 @@ target_include_directories(progressia PRIVATE ${generated}/embedded_resources)
# Compilation settings # Compilation settings
set_property(TARGET progressia PROPERTY CXX_STANDARD 17)
set_property(TARGET progressia PROPERTY CXX_STANDARD_REQUIRED ON)
# Determine command line style # Determine command line style
if (DEFINED compiler_cl_dialect) if (DEFINED compiler_cl_dialect)
# Do nothing # Do nothing
@ -73,9 +91,6 @@ else()
set(compiler_cl_dialect "GCC") set(compiler_cl_dialect "GCC")
endif() endif()
set_property(TARGET progressia PROPERTY CXX_STANDARD 17)
set_property(TARGET progressia PROPERTY CXX_STANDARD_REQUIRED ON)
# Do Windows-specific tweaks for release builds # Do Windows-specific tweaks for release builds
if (WIN32 AND NOT BUILD_ID STREQUAL "dev") if (WIN32 AND NOT BUILD_ID STREQUAL "dev")
set_target_properties(progressia PROPERTIES WIN32_EXECUTABLE true) set_target_properties(progressia PROPERTIES WIN32_EXECUTABLE true)

View File

@ -0,0 +1,12 @@
if (DEV_MODE)
find_program(clang_tidy_EXECUTABLE NAMES clang-tidy-13 clang-tidy)
#list(APPEND clang_tidy_command "${clang_tidy_EXECUTABLE}")
message(NOTICE ${clang_tidy_EXECUTABLE})
add_custom_command(TARGET progressia PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E echo
"Clang-tidy is enabled")
endif()

View File

@ -0,0 +1,2 @@
#!/usr/bin/env python3