diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a1690d..d52509d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,4 +203,21 @@ target_link_libraries(LepusUtility_Tests GTest::gtest_main) include(GoogleTest) gtest_discover_tests(LepusGfx_Tests) gtest_discover_tests(LepusSystem_Tests) -gtest_discover_tests(LepusUtility_Tests) \ No newline at end of file +gtest_discover_tests(LepusUtility_Tests) + +# Warnings +if(MSVC) + target_compile_options(LepusEngine PRIVATE /W3 /WX) + target_compile_options(LepusSystem PRIVATE /W3 /WX) + target_compile_options(LepusGfx PRIVATE /W3 /WX) + target_compile_options(LepusSystem_Tests PRIVATE /W3 /WX) + target_compile_options(LepusGfx_Tests PRIVATE /W3 /WX) + target_compile_options(LepusUtility_Tests PRIVATE /W3 /WX) +else() + target_compile_options(LepusEngine PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(LepusSystem PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(LepusGfx PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(LepusSystem_Tests PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(LepusGfx_Tests PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(LepusUtility_Tests PRIVATE -Wall -Wextra -Wpedantic) +endif() \ No newline at end of file diff --git a/src/lepus/engine/ILogger.h b/src/lepus/engine/ILogger.h index 07106e0..af3f53c 100644 --- a/src/lepus/engine/ILogger.h +++ b/src/lepus/engine/ILogger.h @@ -13,6 +13,9 @@ namespace lepus virtual void LogError(char* className, char* funcName, char* message, char* funcParams = "") = 0; virtual void LogInfo(char* className, char* funcName, char* message, char* funcParams = "") = 0; virtual void LogWarning(char* className, char* funcName, char* message, char* funcParams = "") = 0; + + /// @brief Dummy virtual destructor. Unlikely it'll ever be needed but the compiler wants one anyway. + virtual ~ILogger() {} }; } } \ No newline at end of file diff --git a/src/lepus/gfx/GraphicsEngine.h b/src/lepus/gfx/GraphicsEngine.h index 75c0f12..32fc49e 100644 --- a/src/lepus/gfx/GraphicsEngine.h +++ b/src/lepus/gfx/GraphicsEngine.h @@ -56,7 +56,7 @@ m_OutputInfo = {}; \ /// @param options API options used to initialise and create the API library wrapper. These are copied, so it is recommended to create options in stack. void InitApi(GraphicsApiOptions* options); -#undef INIT_DEFAULT() +#undef INIT_DEFAULT enum PixelFormat { diff --git a/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/ApiGL.cpp b/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/ApiGL.cpp index 94a83e0..555583d 100644 --- a/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/ApiGL.cpp +++ b/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/ApiGL.cpp @@ -111,7 +111,7 @@ void GraphicsApiGL::Draw() glBindBuffer(GL_ARRAY_BUFFER, m_Pipeline.vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Pipeline.ibo); - glDrawElements(GL_TRIANGLES, m_CubeGeometry.IndexCount(), GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, (GLsizei)m_CubeGeometry.IndexCount(), GL_UNSIGNED_INT, 0); } void GraphicsApiGL::ClearFrameBuffer(float r, float g, float b) diff --git a/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/Types.h b/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/Types.h index 3f35bfd..90f0155 100644 --- a/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/Types.h +++ b/src/lepus/gfx/GraphicsEngine/Apis/ApiGL/Types.h @@ -13,7 +13,7 @@ namespace lepus template class GLUniformBinding : public lepus::gfx::UniformBinding { public: - GLUniformBinding(size_t location) : UniformBinding(location) + GLUniformBinding(GLint location) : UniformBinding(location) { // TODO: No idea why, but sometimes the location won't assign correctly, so we do this terribleness... this->m_Location = location; diff --git a/tests/LUtility/MathTests/MatrixTests.cpp b/tests/LUtility/MathTests/MatrixTests.cpp index 43845c3..05ac692 100644 --- a/tests/LUtility/MathTests/MatrixTests.cpp +++ b/tests/LUtility/MathTests/MatrixTests.cpp @@ -17,7 +17,7 @@ TEST(MathMatrixTests, MatrixMultipliedByMatrixCorrectly) 13 14 15 16 */ - for (uint8_t i = 0; i < 16; i++) { matA.set(floor((float)i / (float)4), i % 4, float(i + 1)); } + for (uint8_t i = 0; i < 16; i++) { matA.set((i - (i % 4)) / 4, i % 4, float(i + 1)); } /* Matrix B looks like this: @@ -26,7 +26,7 @@ TEST(MathMatrixTests, MatrixMultipliedByMatrixCorrectly) 10 11 12 13 14 15 16 17 */ - for (uint8_t i = 0; i < 16; i++) { matB.set(floor((float)i / (float)4), i % 4, float(i + 2)); } + for (uint8_t i = 0; i < 16; i++) { matB.set((i - (i % 4)) / 4, i % 4, float(i + 2)); } /* Expected results: 100 110 120 130 @@ -44,8 +44,8 @@ TEST(MathMatrixTests, MatrixMultipliedByMatrixCorrectly) lepus::math::Matrix4x4 actual = matA.Multiply(matB); // Make sure the original matrices are still correct - they should not be affected by the multiplication, as it's not in-place. - for (uint8_t i = 0; i < 16; i++) { ASSERT_FLOAT_EQ(matA.get(floor((float)i / (float)4), i % 4), (float)(i + 1)); } - for (uint8_t i = 0; i < 16; i++) { ASSERT_FLOAT_EQ(matB.get(floor((float)i / (float)4), i % 4), (float)(i + 2)); } + for (uint8_t i = 0; i < 16; i++) { ASSERT_FLOAT_EQ(matA.get((i - (i % 4)) / 4, i % 4), (float)(i + 1)); } + for (uint8_t i = 0; i < 16; i++) { ASSERT_FLOAT_EQ(matB.get((i - (i % 4)) / 4, i % 4), (float)(i + 2)); } // Check that the multiplied result is correct. for (uint8_t r = 0; r < 4; r++)