From d3927723cfeb70c0d157e2ce53739d51f671ed93 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sun, 23 Jul 2023 18:42:38 +0900 Subject: [PATCH] Fix CMakeLists.txt, fix warnings --- CMakeLists.txt | 23 +++++++++++++---------- src/raygui.cpp | 2 ++ src/shape.cpp | 2 ++ src/shape.hpp | 2 ++ src/state.cpp | 13 +++++++++++++ src/state.hpp | 2 ++ src/unittest/test_helpers.cpp | 2 ++ 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 573025c..a1bd6eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,16 +28,6 @@ set(Triangles_LIB_SOURCES src/raygui.cpp ) -if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "/Od /Zi") - set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG") -else() - set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Wsuggest-override") - set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -D NDEBUG") -endif() - add_library(TrianglesLib STATIC ${Triangles_LIB_SOURCES}) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") @@ -46,6 +36,19 @@ else() add_executable(Triangles ${Triangles_MAIN_SOURCES}) endif() +target_compile_options(TrianglesLib PRIVATE + -Wall -Wextra -Wpedantic + -Wsuggest-override + $<$:-Weffc++> + $<$:-O0> +) +target_compile_options(Triangles PRIVATE + -Wall -Wextra -Wpedantic + -Wsuggest-override + $<$:-Weffc++> + $<$:-O0> +) + target_link_libraries(Triangles PUBLIC TrianglesLib) target_compile_features(TrianglesLib PUBLIC cxx_std_17) diff --git a/src/raygui.cpp b/src/raygui.cpp index 339d3a2..3351693 100644 --- a/src/raygui.cpp +++ b/src/raygui.cpp @@ -5,6 +5,8 @@ #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wenum-compare" #pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Weffc++" #define RAYGUI_IMPLEMENTATION #include diff --git a/src/shape.cpp b/src/shape.cpp index d5b37b8..8e08c34 100644 --- a/src/shape.cpp +++ b/src/shape.cpp @@ -1,7 +1,9 @@ #include "shape.hpp" +#pragma GCC diagnostic ignored "-Weffc++" #include #include +#pragma GCC diagnostic pop Tri::Shape::Shape() : transform(glm::identity()), diff --git a/src/shape.hpp b/src/shape.hpp index 090cd2f..df7f7bc 100644 --- a/src/shape.hpp +++ b/src/shape.hpp @@ -3,8 +3,10 @@ #include +#pragma GCC diagnostic ignored "-Weffc++" #include #include +#pragma GCC diagnostic pop namespace Tri { diff --git a/src/state.cpp b/src/state.cpp index 3821210..1837357 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -12,18 +12,30 @@ #define STARTING_HELP_FADE_RATE 0.2f +#pragma GCC diagnostic ignored "-Wunused-parameter" Tri::State::State(int argc, char **argv) : +flags(), width(DEFAULT_WIDTH), height(DEFAULT_HEIGHT), dt(1.0f/60.0f), notificationAlpha(1.0f), +notificationText(), +tris(), trisIndex(0), +currentTri(), currentTri_state(CurrentState::NONE), currentTri_maxState(CurrentState::NONE), +pointCircle(), colorPickerColor{1.0f, 1.0f, 1.0f, 1.0f}, bgColorPickerColor{0.0f, 0.0f, 0.0f}, bgColor(BLACK), +saveFilenameBuffer(), +failedMessage(), +drawCache(), pi(std::acos(-1.0f)), +selectedTri(), +selectedTriColor(), +selectedTriBlinkTimer(), inputWidth(800), inputHeight(600) { @@ -47,6 +59,7 @@ inputHeight(600) GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0x303030); } +#pragma GCC diagnostic pop Tri::State::~State() { UnloadRenderTexture(drawCache); diff --git a/src/state.hpp b/src/state.hpp index 0a09c33..c84e1b5 100644 --- a/src/state.hpp +++ b/src/state.hpp @@ -7,7 +7,9 @@ #include #include +#pragma GCC diagnostic ignored "-Weffc++" #include "glm/glm.hpp" +#pragma GCC diagnostic pop #include "triangle.hpp" #include "circle.hpp" diff --git a/src/unittest/test_helpers.cpp b/src/unittest/test_helpers.cpp index f3cecd3..e5a46b1 100644 --- a/src/unittest/test_helpers.cpp +++ b/src/unittest/test_helpers.cpp @@ -1,4 +1,6 @@ +#pragma GCC diagnostic ignored "-Weffc++" #include "catch_amalgamated.hpp" +#pragma GCC diagnostic pop #include "helpers.hpp" #include "triangle.hpp"