mirror of https://github.com/bjornbytes/lovr.git
Fix some windows warnings;
This commit is contained in:
parent
0f99413681
commit
886e3bb42f
|
@ -59,6 +59,8 @@ if(EMSCRIPTEN)
|
|||
set(LOVR_USE_OPENXR OFF)
|
||||
set(LOVR_USE_WEBGPU ON)
|
||||
set(LOVR_USE_VULKAN OFF)
|
||||
elseif(MSVC)
|
||||
add_compile_options(/MP)
|
||||
elseif(ANDROID)
|
||||
find_package(Java REQUIRED)
|
||||
set(LOVR_USE_DESKTOP OFF)
|
||||
|
@ -110,6 +112,11 @@ if(LOVR_USE_LUAJIT AND NOT EMSCRIPTEN)
|
|||
else()
|
||||
add_subdirectory(deps/luajit luajit)
|
||||
set_target_properties(luajit PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||
if(MSVC)
|
||||
target_compile_definitions(libluajit PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(minilua PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(buildvm PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
include_directories(deps/luajit/src ${CMAKE_BINARY_DIR}/luajit)
|
||||
set(LOVR_LUA libluajit)
|
||||
endif()
|
||||
|
@ -623,11 +630,12 @@ if(WIN32)
|
|||
target_sources(lovr PRIVATE src/core/os_win32.c)
|
||||
target_sources(lovr PRIVATE etc/lovr.rc)
|
||||
if (MSVC)
|
||||
set_target_properties(lovr PROPERTIES COMPILE_FLAGS "/wd4244 /MP")
|
||||
set_target_properties(lovr PROPERTIES COMPILE_FLAGS /wd4244)
|
||||
# Excuse anonymous union for type punning
|
||||
set_source_files_properties(src/util.c src/modules/graphics/graphics.c PROPERTIES COMPILE_FLAGS /wd4116)
|
||||
# Excuse unsigned negation for flag-magic bit math
|
||||
set_source_files_properties(src/modules/audio/audio.c PROPERTIES COMPILE_FLAGS /wd4146)
|
||||
set_source_files_properties(src/lib/minimp3/minimp3.c PROPERTIES COMPILE_FLAGS /wd4267)
|
||||
else()
|
||||
set_target_properties(lovr PROPERTIES COMPILE_FLAGS "-MP")
|
||||
endif()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3f77ce6ac70e8e558e18f638a77b5bcbbf31ca06
|
||||
Subproject commit 6f7eda06adc23bc14ca2e14190d69ae1d00f1740
|
|
@ -26,10 +26,11 @@ static int l_lovrBlobGetString(lua_State* L) {
|
|||
uint32_t offset = luax_optu32(L, 2, 0);
|
||||
lovrCheck(offset < blob->size, "Blob byte offset must be less than the size of the Blob");
|
||||
|
||||
uint32_t length = luax_optu32(L, 3, blob->size - offset);
|
||||
lovrCheck(length <= blob->size - offset, "Blob:getString range overflows the length of the Blob");
|
||||
lua_Integer length = luaL_optinteger(L, 3, blob->size - offset);
|
||||
lovrCheck(length >= 0, "Length can not be negative");
|
||||
lovrCheck((size_t) length <= blob->size - offset, "Blob:getString range overflows the length of the Blob");
|
||||
|
||||
lua_pushlstring(L, (char*) blob->data + offset, length);
|
||||
lua_pushlstring(L, (char*) blob->data + offset, (size_t) length);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ static int l_lovrModelDataGetMeshVertex(lua_State* L) {
|
|||
ModelAttribute* attribute = mesh->attributes[i];
|
||||
if (!attribute) continue;
|
||||
|
||||
uint32_t stride = model->buffers[attribute->buffer].stride;
|
||||
size_t stride = model->buffers[attribute->buffer].stride;
|
||||
|
||||
if (!stride) {
|
||||
switch (attribute->type) {
|
||||
|
@ -697,9 +697,9 @@ static int l_lovrModelDataGetAnimationKeyframe(lua_State* L) {
|
|||
uint32_t keyframe = luax_checku32(L, 4) - 1;
|
||||
lovrCheck(keyframe < channel->keyframeCount, "Invalid keyframe index '%d'", keyframe + 1);
|
||||
lua_pushnumber(L, channel->times[keyframe]);
|
||||
size_t counts[] = { [PROP_TRANSLATION] = 3, [PROP_ROTATION] = 4, [PROP_SCALE] = 3 };
|
||||
size_t count = counts[channel->property];
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
int counts[] = { [PROP_TRANSLATION] = 3, [PROP_ROTATION] = 4, [PROP_SCALE] = 3 };
|
||||
int count = counts[channel->property];
|
||||
for (int i = 0; i < count; i++) {
|
||||
lua_pushnumber(L, channel->data[keyframe * count + i]);
|
||||
}
|
||||
return count + 1;
|
||||
|
|
|
@ -45,7 +45,7 @@ void luax_checkvariant(lua_State* L, int index, Variant* variant) {
|
|||
const char* string = lua_tolstring(L, index, &length);
|
||||
if (length <= sizeof(variant->value.ministring.data)) {
|
||||
variant->type = TYPE_MINISTRING;
|
||||
variant->value.ministring.length = length;
|
||||
variant->value.ministring.length = (uint8_t) length;
|
||||
memcpy(variant->value.ministring.data, string, length);
|
||||
} else {
|
||||
variant->type = TYPE_STRING;
|
||||
|
|
|
@ -138,7 +138,7 @@ static bool loadOgg(Sound* sound, Blob* blob, bool decode) {
|
|||
void* data = calloc(1, size);
|
||||
lovrAssert(data, "Out of memory");
|
||||
sound->blob = lovrBlobCreate(data, size, "Sound");
|
||||
if (stb_vorbis_get_samples_float_interleaved(sound->decoder, channels, data, size / sizeof(float)) < (int) sound->frames) {
|
||||
if (stb_vorbis_get_samples_float_interleaved(sound->decoder, channels, data, (int) size / sizeof(float)) < (int) sound->frames) {
|
||||
lovrThrow("Could not decode vorbis from '%s'", blob->name);
|
||||
}
|
||||
stb_vorbis_close(sound->decoder);
|
||||
|
|
Loading…
Reference in New Issue