Skip to content

Commit 8403bcb

Browse files
committed
[wasm] Use zlib sources from repo instead of emscripten port
1 parent d107593 commit 8403bcb

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/native/libs/System.IO.Compression.Native/CMakeLists.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER)
2121
append_extra_compression_libs(NATIVE_LIBS_EXTRA)
2222

2323
if (CLR_CMAKE_TARGET_BROWSER)
24-
add_definitions(-s USE_ZLIB)
25-
else ()
26-
# Disable implicit fallthrough warning for Brotli
27-
set(FLAGS -Wno-implicit-fallthrough)
24+
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
25+
add_definitions(-DINTERNAL_ZLIB)
26+
set(NATIVECOMPRESSION_SOURCES ${ZLIB_SOURCES} ${NATIVECOMPRESSION_SOURCES})
27+
endif()
2828

29-
# Delete this supression once brotli is upgraded to vNext (current latest v1.0.9
30-
# does not contain upstream fix: https://github.com/google/brotli/commit/0a3944c)
31-
set(FLAGS "${FLAGS} -Wno-vla-parameter")
29+
# Disable implicit fallthrough warning for Brotli
30+
set(FLAGS -Wno-implicit-fallthrough)
3231

33-
set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS ${FLAGS})
34-
endif ()
32+
# Delete this supression once brotli is upgraded to vNext (current latest v1.0.9
33+
# does not contain upstream fix: https://github.com/google/brotli/commit/0a3944c)
34+
set(FLAGS "${FLAGS} -Wno-vla-parameter")
35+
36+
set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS ${FLAGS})
3537

3638
if (GEN_SHARED_LIB)
3739
add_definitions(-DBROTLI_SHARED_COMPILATION)
@@ -88,6 +90,7 @@ else ()
8890
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
8991
endif ()
9092

93+
add_definitions(-DINTERNAL_ZLIB)
9194
set(NATIVECOMPRESSION_SOURCES ${ZLIB_SOURCES} ${NATIVECOMPRESSION_SOURCES})
9295

9396
if (GEN_SHARED_LIB)

src/native/libs/System.IO.Compression.Native/pal_zlib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#include <stdlib.h>
66
#include "pal_zlib.h"
77

8-
#ifdef _WIN32
9-
#define c_static_assert(e) static_assert((e),"")
8+
#ifdef INTERNAL_ZLIB
9+
#ifdef _WIN32
10+
#define c_static_assert(e) static_assert((e),"")
11+
#endif
1012
#include <external/zlib/zlib.h>
1113
#else
1214
#include "pal_utilities.h"

0 commit comments

Comments
 (0)