fixed cmake, fixed the bug when compile on windows using mingw64

This commit is contained in:
VisualGMQ 2022-02-19 14:00:42 +08:00
parent 36a6a133e4
commit ceab72d3a4
3 changed files with 6 additions and 3 deletions

View File

@ -28,6 +28,7 @@ target_include_directories(
) )
option(USE_GLEW "use glew rather than glad" OFF) option(USE_GLEW "use glew rather than glad" OFF)
option(BUILD_TEST "build unittests" OFF)
if (USE_GLEW) if (USE_GLEW)
message(STATUS "use glew to load opengl functions") message(STATUS "use glew to load opengl functions")
@ -42,7 +43,7 @@ if (USE_GLEW)
PUBLIC $<$<BOOL:"${USE_GLEW}">:TINYENGINE_USE_GLEW> PUBLIC $<$<BOOL:"${USE_GLEW}">:TINYENGINE_USE_GLEW>
) )
else() 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( target_include_directories(
${ENGINE_NAME} ${ENGINE_NAME}
PUBLIC libs/glad/include PUBLIC libs/glad/include
@ -106,7 +107,7 @@ add_custom_target(
COMMAND ${CMAKE_COMMAND} -E remove_directory output COMMAND ${CMAKE_COMMAND} -E remove_directory output
COMMAND ${CMAKE_COMMAND} -E make_directory output COMMAND ${CMAKE_COMMAND} -E make_directory output
COMMAND ${CMAKE_COMMAND} -E make_directory output/game 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 $<IF:$<STREQUAL:$<PLATFORM_ID>,"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 copy_directory ./assets output/game/assets
COMMAND ${CMAKE_COMMAND} -E remove_directory ./output/game/assets/test COMMAND ${CMAKE_COMMAND} -E remove_directory ./output/game/assets/test
COMMAND ${CMAKE_COMMAND} -E copy ./HowToPlay.md output/ COMMAND ${CMAKE_COMMAND} -E copy ./HowToPlay.md output/

View File

@ -63,7 +63,7 @@ T Random(const T& low, const T& high) {
static_assert(std::is_floating_point<T>::value || std::is_integral<T>::value); static_assert(std::is_floating_point<T>::value || std::is_integral<T>::value);
std::random_device device; std::random_device device;
if (std::is_floating_point<T>::value) { if constexpr (std::is_floating_point<T>::value) {
std::uniform_real_distribution<T> dist(low, high); std::uniform_real_distribution<T> dist(low, high);
return dist(device); return dist(device);
} else { } else {

View File

@ -26,6 +26,8 @@
#include <utility> #include <utility>
#include <limits> #include <limits>
#include <cassert> #include <cassert>
#include <functional>
#include <cstring>
#include "miniaudio.h" #include "miniaudio.h"
#include "stb_image.h" #include "stb_image.h"