Fix CMakeLists.txt, fix warnings

This commit is contained in:
Stephen Seo 2023-07-23 18:42:38 +09:00
parent 46461d7ebc
commit d3927723cf
7 changed files with 36 additions and 10 deletions

View file

@ -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
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
$<$<CONFIG:DEBUG>:-O0>
)
target_compile_options(Triangles PRIVATE
-Wall -Wextra -Wpedantic
-Wsuggest-override
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
$<$<CONFIG:DEBUG>:-O0>
)
target_link_libraries(Triangles PUBLIC TrianglesLib)
target_compile_features(TrianglesLib PUBLIC cxx_std_17)

View file

@ -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 <raygui.h>

View file

@ -1,7 +1,9 @@
#include "shape.hpp"
#pragma GCC diagnostic ignored "-Weffc++"
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtx/matrix_transform_2d.hpp>
#pragma GCC diagnostic pop
Tri::Shape::Shape() :
transform(glm::identity<glm::mat3>()),

View file

@ -3,8 +3,10 @@
#include <vector>
#pragma GCC diagnostic ignored "-Weffc++"
#include <raylib.h>
#include <glm/glm.hpp>
#pragma GCC diagnostic pop
namespace Tri {

View file

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

View file

@ -7,7 +7,9 @@
#include <vector>
#include <array>
#pragma GCC diagnostic ignored "-Weffc++"
#include "glm/glm.hpp"
#pragma GCC diagnostic pop
#include "triangle.hpp"
#include "circle.hpp"

View file

@ -1,4 +1,6 @@
#pragma GCC diagnostic ignored "-Weffc++"
#include "catch_amalgamated.hpp"
#pragma GCC diagnostic pop
#include "helpers.hpp"
#include "triangle.hpp"