Commit 754fa526 by lhchavez

Use an option instead of a flag for USE_BUNDLED_ZLIB

Now `USE_BUNDLED_ZLIB` can be set to the string `Chromium` to enable the
Chromium implementation of zlib.
parent 83265b3e
...@@ -50,8 +50,7 @@ OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" ...@@ -50,8 +50,7 @@ OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)"
OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF) OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF) OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF) OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF) OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF)
OPTION(USE_CHROMIUM_ZLIB "If using the bundled version of zlib, use the Chromium flavor (x86_64 processor with SSE4.2 and CLMUL required)" OFF)
SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.") SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF) OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.") SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
......
...@@ -7,6 +7,7 @@ ENDIF() ...@@ -7,6 +7,7 @@ ENDIF()
ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator") ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator")
INCLUDE(PkgBuildConfig) INCLUDE(PkgBuildConfig)
INCLUDE(SanitizeBool)
# This variable will contain the libraries we need to put into # This variable will contain the libraries we need to put into
# libgit2.pc's Requires.private. That is, what we're linking to or # libgit2.pc's Requires.private. That is, what we're linking to or
...@@ -186,7 +187,12 @@ ELSE() ...@@ -186,7 +187,12 @@ ELSE()
ENDIF() ENDIF()
# Optional external dependency: zlib # Optional external dependency: zlib
IF(NOT USE_BUNDLED_ZLIB) SanitizeBool(USE_BUNDLED_ZLIB)
IF(USE_BUNDLED_ZLIB STREQUAL ON)
SET(USE_BUNDLED_ZLIB "Bundled")
ENDIF()
IF(USE_BUNDLED_ZLIB STREQUAL "OFF")
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS}) LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS})
...@@ -201,18 +207,16 @@ IF(NOT USE_BUNDLED_ZLIB) ...@@ -201,18 +207,16 @@ IF(NOT USE_BUNDLED_ZLIB)
MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." ) MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND) IF(USE_BUNDLED_ZLIB STREQUAL "Chromium")
IF(USE_CHROMIUM_ZLIB) ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/chromium-zlib" "${libgit2_BINARY_DIR}/deps/chromium-zlib")
ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/chromium-zlib" "${libgit2_BINARY_DIR}/deps/chromium-zlib") LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/chromium-zlib")
LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/chromium-zlib") LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:chromium_zlib>)
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:chromium_zlib>) ADD_FEATURE_INFO(zlib ON "using (Chromium) bundled zlib")
ADD_FEATURE_INFO(zlib ON "using (Chromium) bundled zlib") ELSEIF(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
ELSE() ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib")
ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib") LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib")
LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib") LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>) ADD_FEATURE_INFO(zlib ON "using bundled zlib")
ADD_FEATURE_INFO(zlib ON "using bundled zlib")
ENDIF()
ENDIF() ENDIF()
# Optional external dependency: libssh2 # Optional external dependency: libssh2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment