aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin LADEVIE <qladevie@wanadev.fr>2022-03-03 17:50:32 +0100
committerQuentin LADEVIE <qladevie@wanadev.fr>2022-03-03 17:50:32 +0100
commit91ca81ed88bece20c37b6860895ca8aa6bee8e85 (patch)
tree37f70075f6e324f4ce211093e7208f671c61db15
parentbdd35fc2af40496b4cff9121ea5a3a364259642d (diff)
parentf05dcfa134ea0e551da359ecd3486b3b7bf2e5b8 (diff)
Merge branch 'master' of github.com:ladevieq/path-tracer
-rw-r--r--.clang-format38
-rw-r--r--.clangd7
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt29
-rw-r--r--src/CMakeLists.txt3
5 files changed, 71 insertions, 7 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..386c0ac
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,38 @@
+AccessModifierOffset: 0
+AlignAfterOpenBracket: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: true
+AllowShortLoopsOnASingleLine: true
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: true
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyNamespace: true
+ SplitEmptyRecord: true
+ColumnLimit: 120
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+IndentWidth: 4
+Language: Cpp
+MaxEmptyLinesToKeep: 2
+SortIncludes: true
+Standard: c++20
+TabWidth: 4
+UseTab: Never
diff --git a/.clangd b/.clangd
new file mode 100644
index 0000000..18142d9
--- /dev/null
+++ b/.clangd
@@ -0,0 +1,7 @@
+Diagnostics:
+# UnusedIncludes: Strict // clangd 14
+ ClangTidy:
+ Add: [performance*, modernize*, readability*, bugprone*]
+ Remove: [modernize-avoir-c-arrays]
+# InlayHints: // clangd 14
+# Enabled: Yes // clangd 14
diff --git a/.gitignore b/.gitignore
index 208e889..6565d3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
/build
/out
/.vs
-/.clangd
/.cache
compile_commands.json
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6aaa0f0..3b18938 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,21 +6,42 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
-if(WIN32)
+project(path-tracer VERSION 1.0 LANGUAGES CXX)
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(
-msse4.1 -fcolor-diagnostics -fansi-escape-codes # colored output when using ninja
+ # https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#gcc--clang
+ -Wall
+ -Wextra
+ -Wshadow
+ -Wcast-align
+ -Wnon-virtual-dtor
+ -Wpedantic
+ -Wunused
)
endif()
-project(path-tracer VERSION 1.0 LANGUAGES CXX)
-
find_package(imgui CONFIG REQUIRED)
-find_package(Vulkan REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
+find_package(Vulkan REQUIRED)
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
endif()
+find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
+if (CMAKE_CXX_CPPCHECK)
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cppcheck)
+
+ list(
+ APPEND CMAKE_CXX_CPPCHECK
+ "--project=${CMAKE_BINARY_DIR}/compile_commands.json"
+ "--cppcheck-build-dir=${CMAKE_BINARY_DIR}/cppcheck"
+ "--enable=all"
+ "-iinclude/thirdparty"
+ )
+endif()
+
add_subdirectory(src)
add_subdirectory(shaders)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e8bef7e..ff5f034 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,7 +7,7 @@ if(UNIX AND NOT APPLE)
include_directories(${X11_xcb_INCLUDE_PATH})
endif()
-set(LIBRARIES imgui::imgui)
+set(LIBRARIES imgui::imgui nlohmann_json::nlohmann_json)
add_executable(
path-tracer
@@ -32,4 +32,3 @@ if(UNIX AND NOT APPLE)
endif()
target_link_libraries(path-tracer PRIVATE ${LIBRARIES})
-target_link_libraries(path-tracer PRIVATE nlohmann_json nlohmann_json::nlohmann_json)