Skip to content

Commit 0af300e

Browse files
danbevggerganov
authored andcommitted
ggml : suppress Windows compiler warnings (whisper/3075)
* whisper: suppress Windows compiler warnings This commit disables compiler warnings on window using MSVC. The motivation for these changes is that some compilers generate warnings for these conversion, for example Windows MSVC, and there are quite a few of them. This makes it a little difficult to spot new warnings that may be introduced and also can be difficult for users/embedders of ggml where these warnings are hard to separate from their own warnings. * squash! whisper: suppress Windows compiler warnings Move ggml related warnings into ggml. This commit also fixes the indentation and adds a missing whitespace to the if statement.
1 parent 5d22a79 commit 0af300e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,18 @@ write_basic_package_version_file(
360360
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
361361
${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
362362
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml)
363+
364+
if (MSVC)
365+
set(MSVC_WARNING_FLAGS
366+
/wd4005 # Macro redefinition
367+
/wd4244 # Conversion from one type to another type, possible loss of data
368+
/wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
369+
)
370+
function(disable_msvc_warnings target_name)
371+
target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS})
372+
endfunction()
373+
374+
disable_msvc_warnings(ggml-base)
375+
disable_msvc_warnings(ggml)
376+
disable_msvc_warnings(ggml-cpu)
377+
endif()

0 commit comments

Comments
 (0)