add toolchain file

This commit is contained in:
Corentin Jabot 2021-08-02 14:29:25 +02:00
parent c10eb99336
commit 2cc15c6dcb
6 changed files with 29 additions and 4 deletions

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

23
toolchain.cmake Normal file
View file

@ -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("$<$<CONFIG:DEBUG>:-fsanitize=address>")
else()
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
endif()
#enable ubsan in debug
if(NOT MSVC)
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=undefined>"
"$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer>")
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=undefined>")
endif()