Skip to content

Commit

Permalink
Remove WD4242 and WD4244 from zlib-ng.cmake and turn off ZLIB_DEBUG b…
Browse files Browse the repository at this point in the history
…y making it a build option in zlib-ng.
  • Loading branch information
carlossanlop committed Jul 24, 2024
1 parent e75fc27 commit 7def707
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/native/external/zlib-ng.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ set(ZLIB_COMPAT ON)
set(ZLIB_ENABLE_TESTS OFF)
set(ZLIBNG_ENABLE_TESTS OFF)
set(Z_PREFIX ON)
set(ZLIB_DEBUG OFF)

# TODO: Turn back on when Linux kernels with proper RISC-V extension detection (>= 6.5) are more commonplace
set(WITH_RVV OFF)

add_compile_options($<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-unused-command-line-argument>) # clang : error : argument unused during compilation: '-fno-semantic-interposition'
add_compile_options($<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:-Wno-logical-op-parentheses>) # place parentheses around the '&&' expression to silence this warning
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4127>) # warning C4127: conditional expression is constant
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4242>) # 'function': conversion from 'unsigned int' to 'Pos', possible loss of data, in various deflate_*.c files
add_compile_options($<$<COMPILE_LANG_AND_ID:C,MSVC>:/wd4244>) # 'function': conversion from 'unsigned int' to 'Pos', possible loss of data, in various deflate_*.c files

# 'aligned_alloc' is not available in browser/wasi, yet it is set by zlib-ng/CMakeLists.txt.
if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
Expand Down
6 changes: 5 additions & 1 deletion src/native/external/zlib-ng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON)
option(ZLIB_COMPAT "Compile with zlib compatible API" OFF)
option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
option(ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API" ON)
option(ZLIB_DEBUG "Compile using the ZLIB_DEBUG option when building using the Debug configuration" ON)
option(WITH_GTEST "Build gtest_zlib" ON)
option(WITH_FUZZERS "Build test/fuzz" OFF)
option(WITH_BENCHMARKS "Build test/benchmarks" OFF)
Expand Down Expand Up @@ -486,7 +487,9 @@ if(NOT HAVE_PTRDIFF_T)
endif()
endif()

add_compile_options($<$<CONFIG:Debug>:-DZLIB_DEBUG>)
if (ZLIB_DEBUG AND CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DZLIB_DEBUG)
endif()

if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
Expand Down Expand Up @@ -1242,6 +1245,7 @@ add_feature_info(WITH_GZFILEOP WITH_GZFILEOP "Compile with support for gzFile re
add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Compile with zlib compatible API")
add_feature_info(ZLIB_ENABLE_TESTS ZLIB_ENABLE_TESTS "Build test binaries")
add_feature_info(ZLIBNG_ENABLE_TESTS ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API")
add_feature_info(ZLIB_DEBUG ZLIB_DEBUG "Compile using the ZLIB_DEBUG option when building using the Debug configuration")
add_feature_info(WITH_SANITIZER WITH_SANITIZER "Enable sanitizer support")
add_feature_info(WITH_GTEST WITH_GTEST "Build gtest_zlib")
add_feature_info(WITH_FUZZERS WITH_FUZZERS "Build test/fuzz")
Expand Down
1 change: 1 addition & 0 deletions src/native/external/zlib-ng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Build Options
| CMake | configure | Description | Default |
|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------|
| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF |
| ZLIB_DEBUG | | Compile using the ZLIB_DEBUG option when building using the Debug configuration | ON |
| ZLIB_ENABLE_TESTS | | Build test binaries | ON |
| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON |
| WITH_OPTIM | --without-optimizations | Build with optimisations | ON |
Expand Down

0 comments on commit 7def707

Please sign in to comment.