zlib-ng requires some patches to make it compilable on LLVM-mingw.
1. Add -Wno-pedantic-ms-format only if a toolchain is MinGW GCC.
- llvm-mingw does not support it, causing build to break.
2. Include arm_neon.h instead of arm64_neon.h (aarch64 only).
- arm64_neon.h is MSVC only.
- GCC, Clang does not have arm64_neon.h but arm_neon.h on aarch64.
- Also applied to configure and detect-instrinsics.cmake
endif()
endif()
if(MINGW)
- list(APPEND WARNFLAGS_DISABLE -Wno-pedantic-ms-format)
+ # Add `-Wno-pedantic-ms-format` only if the toolchain is GCC MinGW-w64
+ # llvm-mingw does not support '-Wno-pedantic-ms-format'
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
+ list(APPEND WARNFLAGS_DISABLE -Wno-pedantic-ms-format)
+ endif()
endif()
endif()
#ifndef ARM_NEON_INTRINS_H
#define ARM_NEON_INTRINS_H
-#if defined(_M_ARM64) || defined(_M_ARM64EC)
+#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC))
+/* arm64_neon.h is MSVC specific */
# include <arm64_neon.h>
#else
# include <arm_neon.h>
# Check whether compiler supports loading 4 neon vecs into a register range
set(CMAKE_REQUIRED_FLAGS "${NEONFLAG}")
check_c_source_compiles(
- "#if defined(_M_ARM64) || defined(_M_ARM64EC)
+ "#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC))
# include <arm64_neon.h>
#else
# include <arm_neon.h>
check_neon_ld4_intrinsics() {
cat > $test.c << EOF
-#if defined(_M_ARM64) || defined(_M_ARM64EC)
+#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC))
# include <arm64_neon.h>
#else
# include <arm_neon.h>