Skip to content

Commit

Permalink
fix msvcrtd/msvcrt & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniTurtle committed Jun 10, 2024
1 parent 15bd486 commit 284e7a8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
24 changes: 19 additions & 5 deletions source/Irrlicht/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
endif()

elseif(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrtd.lib")
else()
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrt.lib") # ???? fuck off
endif()
# if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# message("HELLO WORLD")
# string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrtd.lib")
# else()
# message("HELLO WORLD2")
# string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrt.lib") # ???? fuck off
# endif()

# string(APPEND CMAKE_CXX_STANDARD_LIBRARIES
# "$<$<CONFIG:Debug>: msvcrtd.lib>"
# "$<$<CONFIG:Release>: msvcrt.lib>")

add_compile_options(/GR- /Zl)

Expand Down Expand Up @@ -547,8 +553,16 @@ target_link_libraries(IrrlichtMt PRIVATE
"$<$<PLATFORM_ID:Windows>:winmm>"
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
"$<$<CONFIG:DEBUG>:msvcrtd.lib>"
"$<$<CONFIG:RELEASE>:msvcrt.lib>"
)

if (CMAKE_CONFIGURATION_TYPES)
foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
message(STATUS "Configuration Type: ${config_type}")
endforeach()
endif()

if(WIN32)
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
endif()
Expand Down
6 changes: 3 additions & 3 deletions source/Irrlicht/COpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,11 @@ void COpenGLDriver::renderArray(const void* indexList, u32 primitiveCount,
}

u32 indexCount = primitiveCount * 3;
u32 drawCount = std::ceil((double)indexCount / maxVertexBufferSize);
u32 drawCount = (u32)std::ceil((double)indexCount / maxVertexBufferSize);
if (drawCount == 0)
return;

bool useDrawRangeElements = drawCount > 1;
bool useDrawOffsets = drawCount > 1;
u32 add_primitive_count = indexCount / drawCount;
if (add_primitive_count % 3 != 0) {
add_primitive_count = add_primitive_count - add_primitive_count % 3;
Expand All @@ -1438,7 +1438,7 @@ void COpenGLDriver::renderArray(const void* indexList, u32 primitiveCount,
for (u32 drawIndex = 0; drawIndex < drawCount; drawIndex++) {
u32 start = 0;
u32 end = 0;
if (useDrawRangeElements) {
if (useDrawOffsets) {
start = drawIndex * add_primitive_count;
if (start >= indexCount)
return;
Expand Down

0 comments on commit 284e7a8

Please sign in to comment.