diff --git a/CMakeLists.txt b/CMakeLists.txt index e3f5fde..ed2842d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.17) +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "toolchain.cmake") + find_package(Git QUIET) if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") # Update submodules as needed diff --git a/lib/Blinky.cpp b/lib/Blinky.cpp index c864f06..69aee36 100644 --- a/lib/Blinky.cpp +++ b/lib/Blinky.cpp @@ -8,7 +8,7 @@ Blinky::Blinky() pos = initialPosition(); } -double Blinky::speed(const GameState & gameState) const { +double Blinky::speed(const GameState &) const { if (state == State::Eyes) return 2; if (state == State::Frightened) diff --git a/lib/Clyde.cpp b/lib/Clyde.cpp index 346fb08..07986ff 100644 --- a/lib/Clyde.cpp +++ b/lib/Clyde.cpp @@ -8,7 +8,7 @@ Clyde::Clyde() pos = initialPosition(); } -double Clyde::speed(const GameState & gameState) const { +double Clyde::speed(const GameState &) const { if (state == State::Eyes) return 2; if (state == State::Frightened) diff --git a/lib/Inky.cpp b/lib/Inky.cpp index 075eefe..9593ee2 100644 --- a/lib/Inky.cpp +++ b/lib/Inky.cpp @@ -8,7 +8,7 @@ Inky::Inky() pos = initialPosition(); } -double Inky::speed(const GameState & gameState) const { +double Inky::speed(const GameState &) const { if (state == State::Eyes) return 2; if (state == State::Frightened) diff --git a/lib/Pinky.cpp b/lib/Pinky.cpp index e372359..1b855f1 100644 --- a/lib/Pinky.cpp +++ b/lib/Pinky.cpp @@ -8,7 +8,7 @@ Pinky::Pinky() pos = initialPosition(); } -double Pinky::speed(const GameState & gameState) const { +double Pinky::speed(const GameState &) const { if (state == State::Eyes) return 2; if (state == State::Frightened) diff --git a/toolchain.cmake b/toolchain.cmake new file mode 100644 index 0000000..bd1e543 --- /dev/null +++ b/toolchain.cmake @@ -0,0 +1,23 @@ +#compile with warnings +if(MSVC) + add_compile_options(/W4 /WX) +else() + add_compile_options(-Wall -Wextra -pedantic -Werror) +endif() + +#enable asan in debug +if(MSVC) + add_compile_options("$<$:-fsanitize=address>") +else() + add_compile_options("$<$:-fsanitize=address>") + add_link_options("$<$:-fsanitize=address>") +endif() + + +#enable ubsan in debug + +if(NOT MSVC) + add_compile_options("$<$:-fsanitize=undefined>" + "$<$:-fno-omit-frame-pointer>") + add_link_options("$<$:-fsanitize=undefined>") +endif()