From ceab72d3a41e9d49a0aae4df4fa013f4a1232c70 Mon Sep 17 00:00:00 2001 From: VisualGMQ <2142587070@qq.com> Date: Sat, 19 Feb 2022 14:00:42 +0800 Subject: [PATCH] fixed cmake, fixed the bug when compile on windows using mingw64 --- CMakeLists.txt | 5 +++-- include/tinyengine/libmath.hpp | 2 +- include/tinyengine/pch.hpp | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3944979..c786329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ target_include_directories( ) option(USE_GLEW "use glew rather than glad" OFF) +option(BUILD_TEST "build unittests" OFF) if (USE_GLEW) message(STATUS "use glew to load opengl functions") @@ -42,7 +43,7 @@ if (USE_GLEW) PUBLIC $<$:TINYENGINE_USE_GLEW> ) else() - message(STATUS "use glad to load opengl functions, this only work on MacOS") + message(STATUS "use glad to load opengl functions") target_include_directories( ${ENGINE_NAME} PUBLIC libs/glad/include @@ -106,7 +107,7 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E remove_directory output COMMAND ${CMAKE_COMMAND} -E make_directory output COMMAND ${CMAKE_COMMAND} -E make_directory output/game - COMMAND ${CMAKE_COMMAND} -E copy ./build/${PROJECT_NAME} output/game/${PROJECT_NAME} + COMMAND ${CMAKE_COMMAND} -E copy $,"Windows">,./build/${PROJECT_NAME}.exe,./build/${PROJECT_NAME}> output/game/${PROJECT_NAME} COMMAND ${CMAKE_COMMAND} -E copy_directory ./assets output/game/assets COMMAND ${CMAKE_COMMAND} -E remove_directory ./output/game/assets/test COMMAND ${CMAKE_COMMAND} -E copy ./HowToPlay.md output/ diff --git a/include/tinyengine/libmath.hpp b/include/tinyengine/libmath.hpp index 87d683a..d7ce95a 100644 --- a/include/tinyengine/libmath.hpp +++ b/include/tinyengine/libmath.hpp @@ -63,7 +63,7 @@ T Random(const T& low, const T& high) { static_assert(std::is_floating_point::value || std::is_integral::value); std::random_device device; - if (std::is_floating_point::value) { + if constexpr (std::is_floating_point::value) { std::uniform_real_distribution dist(low, high); return dist(device); } else { diff --git a/include/tinyengine/pch.hpp b/include/tinyengine/pch.hpp index 79700d0..153838b 100644 --- a/include/tinyengine/pch.hpp +++ b/include/tinyengine/pch.hpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "miniaudio.h" #include "stb_image.h"