From: Nathan Moinvaziri Date: Sun, 13 Jun 2021 22:39:58 +0000 (-0700) Subject: Separate option and add_feature_info in cases where intrinsics are not available... X-Git-Tag: 2.1.0-beta1~557 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31e6377a8205cc53be5d90d8f840942ca3e08966;p=thirdparty%2Fzlib-ng.git Separate option and add_feature_info in cases where intrinsics are not available we can report feature is disabled. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c69b93bbe..b477ff37a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,46 +70,42 @@ endif() # # Options parsing # -macro(add_option name description value) - option(${name} ${description} ${value}) - add_feature_info(${name} ${name} ${description}) -endmacro() - -add_option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) -add_option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) -add_option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -add_option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) -add_option(WITH_FUZZERS "Build test/fuzz" OFF) -add_option(WITH_OPTIM "Build with optimisation" ON) -add_option(WITH_NEW_STRATEGIES "Use new strategies" ON) -add_option(WITH_NATIVE_INSTRUCTIONS +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(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) +option(WITH_FUZZERS "Build test/fuzz" OFF) +option(WITH_OPTIM "Build with optimisation" ON) +option(WITH_NEW_STRATEGIES "Use new strategies" ON) +option(WITH_NATIVE_INSTRUCTIONS "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) -add_option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) -add_option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) -add_option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) -add_option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) -add_option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) +option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) +option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) +option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) +option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) +option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) # Add multi-choice option set(WITH_SANITIZER AUTO CACHE STRING "Enable sanitizer support") set_property(CACHE WITH_SANITIZER PROPERTY STRINGS "Memory" "Address" "Undefined" "Thread") if(BASEARCH_ARM_FOUND) - add_option(WITH_ACLE "Build with ACLE" ON) - add_option(WITH_NEON "Build with NEON intrinsics" ON) + option(WITH_ACLE "Build with ACLE" ON) + option(WITH_NEON "Build with NEON intrinsics" ON) elseif(BASEARCH_PPC_FOUND) - add_option(WITH_POWER8 "Build with optimisations for POWER8" ON) + option(WITH_POWER8 "Build with optimisations for POWER8" ON) elseif(BASEARCH_S360_FOUND) - add_option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF) - add_option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF) + option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF) + option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF) elseif(BASEARCH_X86_FOUND) - add_option(WITH_AVX2 "Build with AVX2" ON) - add_option(WITH_SSE2 "Build with SSE2" ON) - add_option(WITH_SSSE3 "Build with SSSE3" ON) - add_option(WITH_SSE4 "Build with SSE4" ON) - add_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) + option(WITH_AVX2 "Build with AVX2" ON) + option(WITH_SSE2 "Build with SSE2" ON) + option(WITH_SSSE3 "Build with SSSE3" ON) + option(WITH_SSE4 "Build with SSE4" ON) + option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) endif() -add_option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) + +option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) mark_as_advanced(FORCE ZLIB_DUAL_LINK @@ -150,6 +146,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Intel") endif() if(WITH_NATIVE_INSTRUCTIONS) message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") + set(WITH_NATIVE_INSTRUCTIONS OFF) endif() elseif(MSVC) # Minimum supported MSVC version is 1800 = Visual Studio 12.0/2013 @@ -172,6 +169,7 @@ elseif(MSVC) endif() if(WITH_NATIVE_INSTRUCTIONS) message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") + set(WITH_NATIVE_INSTRUCTIONS OFF) endif() elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") # Enable warnings in GCC and Clang @@ -218,6 +216,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") else() if(WITH_NATIVE_INSTRUCTIONS) message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration") + set(WITH_NATIVE_INSTRUCTIONS OFF) endif() endif() @@ -569,7 +568,11 @@ if(WITH_OPTIM) set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG} ${NOLTOFLAG}") list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS}) add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"") + else() + set(WITH_ACLE OFF) endif() + else() + set(WITH_ACLE OFF) endif() if(WITH_NEON) check_neon_intrinsics() @@ -583,6 +586,8 @@ if(WITH_OPTIM) endif() add_feature_info(NEON_ADLER32 1 "Support NEON instructions in adler32, using \"${NEONFLAG}\"") add_feature_info(NEON_SLIDEHASH 1 "Support NEON instructions in slide_hash, using \"${NEONFLAG}\"") + else() + set(WITH_NEON OFF) endif() endif() elseif(BASEARCH_PPC_FOUND) @@ -598,6 +603,8 @@ if(WITH_OPTIM) set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/slide_power8.c) list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS}) set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG} ${NOLTOFLAG}") + else() + set(WITH_POWER8 OFF) endif() endif() elseif(BASEARCH_S360_FOUND) @@ -633,6 +640,8 @@ if(WITH_OPTIM) add_feature_info(AVX2_ADLER32 1 "Support AVX2-accelerated adler32, using \"${AVX2FLAG}\"") list(APPEND ZLIB_ARCH_SRCS ${AVX2_SRCS}) set_property(SOURCE ${AVX2_SRCS} PROPERTY COMPILE_FLAGS "${AVX2FLAG} ${NOLTOFLAG}") + else() + set(WITH_AVX2 OFF) endif() endif() if(WITH_SSE4) @@ -654,6 +663,9 @@ if(WITH_OPTIM) list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG} ${NOLTOFLAG}") endif() + if(NOT HAVE_SSE42CRC_INLINE_ASM AND NOT HAVE_SSE42CRC_INTRIN AND NOT HAVE_SSE42CMPSTR_INTRIN) + set(WITH_SSE4 OFF) + endif() endif() if(WITH_SSE2) check_sse2_intrinsics() @@ -668,6 +680,8 @@ if(WITH_OPTIM) add_definitions(-DX86_NOCHECK_SSE2) endif() endif() + else() + set(WITH_SSE2 OFF) endif() endif() if(WITH_SSSE3) @@ -678,6 +692,8 @@ if(WITH_OPTIM) add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}") + else() + set(WITH_SSSE3 OFF) endif() endif() if(WITH_PCLMULQDQ AND WITH_SSSE3 AND WITH_SSE4) @@ -688,7 +704,11 @@ if(WITH_OPTIM) add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG}\"") list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG} ${NOLTOFLAG}") + else() + set(WITH_PCLMULQDQ OFF) endif() + else() + set(WITH_PCLMULQDQ OFF) endif() endif() endif() @@ -1240,4 +1260,38 @@ if(ZLIB_ENABLE_TESTS) add_simple_test_executable(hash_head_0) endif() +add_feature_info(WITH_GZFILEOP WITH_GZFILEOP "Compile with support for gzFile related functions") +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(ZLIB_DUAL_LINK ZLIB_DUAL_LINK "Dual link tests against system zlib") +add_feature_info(WITH_SANITIZER WITH_SANITIZER "Enable sanitizer support") +add_feature_info(WITH_FUZZERS WITH_FUZZERS "Build test/fuzz") +add_feature_info(WITH_OPTIM WITH_OPTIM "Build with optimisation") +add_feature_info(WITH_NEW_STRATEGIES WITH_NEW_STRATEGIES "Use new strategies") +add_feature_info(WITH_NATIVE_INSTRUCTIONS WITH_NATIVE_INSTRUCTIONS + "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)") +add_feature_info(WITH_MAINTAINER_WARNINGS WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings") +add_feature_info(WITH_CODE_COVERAGE WITH_CODE_COVERAGE "Enable code coverage reporting") +add_feature_info(WITH_INFLATE_STRICT WITH_INFLATE_STRICT "Build with strict inflate distance checking") +add_feature_info(WITH_INFLATE_ALLOW_INVALID_DIST WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances") +add_feature_info(WITH_UNALIGNED WITH_UNALIGNED "Support unaligned reads on platforms that support it") + +if(BASEARCH_ARM_FOUND) + add_feature_info(WITH_ACLE WITH_ACLE "Build with ACLE") + add_feature_info(WITH_NEON WITH_NEON "Build with NEON intrinsics") +elseif(BASEARCH_PPC_FOUND) + add_feature_info(WITH_POWER8 WITH_POWER8 "Build with optimisations for POWER8") +elseif(BASEARCH_S360_FOUND) + add_feature_info(WITH_DFLTCC_DEFLATE WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z") + add_feature_info(WITH_DFLTCC_INFLATE WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z") +elseif(BASEARCH_X86_FOUND) + add_feature_info(WITH_AVX2 WITH_AVX2 "Build with AVX2") + add_feature_info(WITH_SSE2 WITH_SSE2 "Build with SSE2") + add_feature_info(WITH_SSSE3 WITH_SSSE3 "Build with SSSE3") + add_feature_info(WITH_SSE4 WITH_SSE4 "Build with SSE4") + add_feature_info(WITH_PCLMULQDQ WITH_PCLMULQDQ "Build with PCLMULQDQ") +endif() + +add_feature_info(INSTALL_UTILS INSTALL_UTILS "Copy minigzip and minideflate during install") + FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES)