]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Added CI test for dual linking zlib-ng with system zlib.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 2 May 2020 03:01:43 +0000 (20:01 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 6 May 2020 07:46:28 +0000 (09:46 +0200)
.github/workflows/cmake.yml
CMakeLists.txt
README.md

index 45d105e9a4138d4f48c1cacf7b302f30b9bc8867..8540b96ab164d049875cc596624387732cace043 100644 (file)
@@ -10,6 +10,7 @@ jobs:
         name: [
           Ubuntu 18.04 GCC,
           Ubuntu 18.04 GCC OSB -O1,
+          Ubuntu 18.04 GCC Link Zlib,
           Ubuntu 18.04 GCC No AVX2,
           Ubuntu 18.04 GCC No SSE2,
           Ubuntu 18.04 GCC No SSE4,
@@ -65,6 +66,11 @@ jobs:
             codecov: ubuntu_gcc_osb
             cflags: -O1 -g3
 
+          - name: Ubuntu 18.04 GCC Link Zlib
+            os: ubuntu-18.04
+            compiler: gcc
+            cmake-args: -DZLIB_LINK_SYSLIB=ON
+
           - name: Ubuntu 18.04 GCC No AVX2
             os: ubuntu-18.04
             compiler: gcc
index 14a5bef615f6423fa6d2e7339e8a04468aec28db..5d186440d79e2132f8e31bcdccaae4bba727d6bb 100644 (file)
@@ -81,6 +81,7 @@ check_include_file(sys/sdt.h   HAVE_SYS_SDT_H)
 option(WITH_GZFILEOP "Compile with support for gzFile related functions" OFF)
 option(ZLIB_COMPAT "Compile with zlib compatible API" OFF)
 option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
+option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF)
 option(WITH_SANITIZERS "Build with address sanitizer and all supported sanitizers other than memory sanitizer" OFF)
 option(WITH_MSAN "Build with memory sanitizer" OFF)
 option(WITH_FUZZERS "Build test/fuzz" OFF)
@@ -106,7 +107,7 @@ elseif(BASEARCH_X86_FOUND)
     option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON)
 endif()
 
-mark_as_advanced(FORCE WITH_ACLE WITH_NEON WITH_DFLTCC_DEFLATE WITH_DFLTCC_INFLATE
+mark_as_advanced(FORCE ZLIB_DUAL_LINK WITH_ACLE WITH_NEON WITH_DFLTCC_DEFLATE WITH_DFLTCC_INFLATE
     WITH_AVX2 WITH_SSE2 WITH_SSE4 WITH_PCLMULQDQ WITH_INFLATE_STRICT WITH_INFLATE_ALLOW_INVALID_DIST)
 
 add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Provide a zlib-compatible API")
@@ -950,6 +951,12 @@ if (ZLIB_ENABLE_TESTS)
             target_compile_definitions(${target} PUBLIC -DWITH_GZFILEOP)
             target_sources(${target} PRIVATE ${ZLIB_GZFILE_SRCS})
         endif()
+        if(ZLIB_DUAL_LINK)
+            find_package(ZLIB)
+            if(ZLIB_FOUND)
+                target_link_libraries(minigzip ${ZLIB_LIBRARIES})
+            endif()
+        endif()
     endmacro()
 
     add_executable(example test/example.c)
index cd5bebf29f5b28698a2eaea19ae8190470509807..e6c3a6be78b79c3ca47fd9d4b9ea7a3e8386702f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -168,6 +168,7 @@ Advanced Build Options
 
 | CMake                           | configure             | Description                                                         | Default                |
 |:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
+| ZLIB_DUAL_LINK                  |                       | Dual link tests with system zlib                                    | OFF                    |
 | UNALIGNED_OK                    |                       | Allow unaligned reads                                               | ON (x86, arm)          |
 |                                 | --force-sse2          | Assume SSE2 instructions are always available                       | ON (x86), OFF (x86_64) |
 | WITH_AVX2                       |                       | Build with AVX2 intrinsics                                          | ON                     |