diff options
Diffstat (limited to 'vcpkg/ports/fftw3')
| -rw-r--r-- | vcpkg/ports/fftw3/aligned_malloc.patch | 38 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/bigobj.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/fftw3_arch_fix.patch | 39 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/fix-openmp.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/fix-wrong-version.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/install-subtargets.patch | 18 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/neon.patch | 73 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/portfile.cmake | 78 | ||||
| -rw-r--r-- | vcpkg/ports/fftw3/vcpkg.json | 46 |
9 files changed, 331 insertions, 0 deletions
diff --git a/vcpkg/ports/fftw3/aligned_malloc.patch b/vcpkg/ports/fftw3/aligned_malloc.patch new file mode 100644 index 0000000..447ded6 --- /dev/null +++ b/vcpkg/ports/fftw3/aligned_malloc.patch @@ -0,0 +1,38 @@ +diff --git a/cmake.config.h.in b/cmake.config.h.in +index 1f4c505..fd763cc 100644 +--- a/cmake.config.h.in ++++ b/cmake.config.h.in +@@ -112,6 +112,10 @@ + you don't. */ + #cmakedefine01 HAVE_DECL_POSIX_MEMALIGN + ++/* Define to 1 if you have the declaration of `_aligned_malloc', and to 0 if you ++ don't. */ ++#cmakedefine01 HAVE_DECL_ALIGNED_MALLOC ++ + /* Define to 1 if you have the declaration of `sinl', and to 0 if you don't. + */ + #cmakedefine01 HAVE_DECL_SINL +@@ -184,6 +188,9 @@ + /* Define to 1 if you have the `memalign' function. */ + #cmakedefine HAVE_MEMALIGN 1 + ++/* Define to 1 if you have the `_aligned_malloc' function. */ ++#cmakedefine HAVE_ALIGNED_MALLOC 1 ++ + /* Define to 1 if you have the `memmove' function. */ + #cmakedefine HAVE_MEMMOVE 1 + +diff --git a/kernel/kalloc.c b/kernel/kalloc.c +index e42f6f3..ffc2257 100644 +--- a/kernel/kalloc.c ++++ b/kernel/kalloc.c +@@ -103,7 +103,7 @@ void *X(kernel_malloc)(size_t n) + # undef real_free + # define real_free _mm_free + +-# elif defined(_MSC_VER) ++# elif defined(_MSC_VER) || defined (HAVE_ALIGNED_MALLOC) + /* MS Visual C++ 6.0 with a "Processor Pack" supports SIMD + and _aligned_malloc/free (uses malloc.h) */ + p = (void *) _aligned_malloc(n, MIN_ALIGNMENT); diff --git a/vcpkg/ports/fftw3/bigobj.patch b/vcpkg/ports/fftw3/bigobj.patch new file mode 100644 index 0000000..1ca3865 --- /dev/null +++ b/vcpkg/ports/fftw3/bigobj.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 64db20b6a..ce438a379 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -315,7 +315,7 @@ endif () + add_library (${fftw3_lib} ${SOURCEFILES}) + target_include_directories (${fftw3_lib} INTERFACE $<INSTALL_INTERFACE:include>) + if (MSVC AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Intel")) +- target_compile_definitions (${fftw3_lib} PRIVATE /bigobj) ++ target_compile_options (${fftw3_lib} PRIVATE "/bigobj") + endif () + if (HAVE_SSE) + target_compile_options (${fftw3_lib} PRIVATE ${SSE_FLAG}) diff --git a/vcpkg/ports/fftw3/fftw3_arch_fix.patch b/vcpkg/ports/fftw3/fftw3_arch_fix.patch new file mode 100644 index 0000000..53fd7c0 --- /dev/null +++ b/vcpkg/ports/fftw3/fftw3_arch_fix.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 49be67d..ef69fa6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -66,6 +66,7 @@ check_prototype_definition (cosl "long double cosl( long double arg )" "0" math.
+ check_prototype_definition (sinl "long double sinl( long double arg )" "0" math.h HAVE_DECL_SINL)
+ check_prototype_definition (memalign "void *memalign(size_t alignment, size_t size)" "0" malloc.h HAVE_DECL_MEMALIGN)
+ check_prototype_definition (posix_memalign "int posix_memalign(void **memptr, size_t alignment, size_t size)" "0" stdlib.h HAVE_DECL_POSIX_MEMALIGN)
++check_prototype_definition (_aligned_malloc "void* __cdecl _aligned_malloc(size_t _Size, size_t _Alignment)" "0" malloc.h HAVE_DECL_ALIGNED_MALLOC)
+
+ include (CheckSymbolExists)
+ check_symbol_exists (clock_gettime time.h HAVE_CLOCK_GETTIME)
+@@ -75,6 +76,7 @@ check_symbol_exists (drand48 stdlib.h HAVE_DRAND48)
+ check_symbol_exists (srand48 stdlib.h HAVE_SRAND48)
+ check_symbol_exists (memalign malloc.h HAVE_MEMALIGN)
+ check_symbol_exists (posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
++check_symbol_exists (_aligned_malloc malloc.h HAVE_ALIGNED_MALLOC)
+ check_symbol_exists (mach_absolute_time mach/mach_time.h HAVE_MACH_ABSOLUTE_TIME)
+ check_symbol_exists (alloca alloca.h HAVE_ALLOCA)
+ if (NOT HAVE_ALLOCA)
+@@ -131,6 +133,7 @@ endif ()
+
+ include (CheckCCompilerFlag)
+
++#All those checks fail due to linkage errors so we directly set HAVE_<ARCH> in the PORTFILE! We assume the user knows what (s)he is doing!
+ if (ENABLE_SSE)
+ foreach (FLAG "-msse" "/arch:SSE")
+ unset (HAVE_SSE CACHE)
+@@ -180,8 +183,9 @@ if (ENABLE_AVX2)
+ endif ()
+
+ # AVX2 codelets require FMA support as well
++# AVX2 implicitly includes FMA using Visual Studio (also definition __FMA__ is not set)
+ if (ENABLE_AVX2)
+- foreach (FLAG "-mfma" "/arch:FMA")
++ foreach (FLAG "-mfma" "/arch:AVX2")
+ unset (HAVE_FMA CACHE)
+ unset (HAVE_FMA)
+ check_c_compiler_flag (${FLAG} HAVE_FMA)
diff --git a/vcpkg/ports/fftw3/fix-openmp.patch b/vcpkg/ports/fftw3/fix-openmp.patch new file mode 100644 index 0000000..27b8748 --- /dev/null +++ b/vcpkg/ports/fftw3/fix-openmp.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ce438a3..43c74be 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -356,7 +356,7 @@ if (OPENMP_FOUND) + target_link_libraries (${fftw3_lib}_omp ${fftw3_lib}) + target_link_libraries (${fftw3_lib}_omp ${CMAKE_THREAD_LIBS_INIT}) + list (APPEND subtargets ${fftw3_lib}_omp) +- target_compile_options (${fftw3_lib}_omp PRIVATE ${OpenMP_C_FLAGS}) ++ target_link_libraries (${fftw3_lib}_omp OpenMP::OpenMP_C) + endif () + + foreach(subtarget ${subtargets}) diff --git a/vcpkg/ports/fftw3/fix-wrong-version.patch b/vcpkg/ports/fftw3/fix-wrong-version.patch new file mode 100644 index 0000000..b4bacb2 --- /dev/null +++ b/vcpkg/ports/fftw3/fix-wrong-version.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bc150c6..39a49fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -283,7 +283,7 @@ if (HAVE_AVX2) + list (APPEND SOURCEFILES ${fftw_dft_simd_avx2_SOURCE} ${fftw_rdft_simd_avx2_SOURCE}) + endif () + +-set (FFTW_VERSION 3.3.9) ++set (FFTW_VERSION 3.3.10) + + set (PREC_SUFFIX) + if (ENABLE_FLOAT) diff --git a/vcpkg/ports/fftw3/install-subtargets.patch b/vcpkg/ports/fftw3/install-subtargets.patch new file mode 100644 index 0000000..c313d3f --- /dev/null +++ b/vcpkg/ports/fftw3/install-subtargets.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d1e4dff..ea5d579 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -361,12 +361,8 @@ endif () + + foreach(subtarget ${subtargets}) + set_target_properties (${subtarget} PROPERTIES SOVERSION 3.6.9 VERSION 3) +- install (TARGETS ${subtarget} +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endforeach () +-install(TARGETS ${fftw3_lib} ++install(TARGETS ${subtargets} + EXPORT FFTW3LibraryDepends + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/vcpkg/ports/fftw3/neon.patch b/vcpkg/ports/fftw3/neon.patch new file mode 100644 index 0000000..0d53000 --- /dev/null +++ b/vcpkg/ports/fftw3/neon.patch @@ -0,0 +1,73 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db20caa7..48e724f3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -25,6 +25,7 @@ option (ENABLE_SSE "Compile with SSE instruction set support" OFF)
+ option (ENABLE_SSE2 "Compile with SSE2 instruction set support" OFF)
+ option (ENABLE_AVX "Compile with AVX instruction set support" OFF)
+ option (ENABLE_AVX2 "Compile with AVX2 instruction set support" OFF)
++option (ENABLE_NEON "Compile with NEON instruction set support" OFF)
+
+ option (DISABLE_FORTRAN "Disable Fortran wrapper routines" OFF)
+
+@@ -203,9 +204,20 @@ if (ENABLE_AVX2)
+ endforeach ()
+ endif ()
+
++if (ENABLE_NEON)
++ if (ENABLE_LONG_DOUBLE)
++ message (FATAL_ERROR "NEON only works in single or double precision, please disable long double support")
++ endif ()
++ if (ENABLE_QUAD_PRECISION)
++ message (FATAL_ERROR "NEON only works in single or double precision, please disable quad precision support")
++ endif ()
++ set (HAVE_NEON TRUE)
++endif ()
++
+ if (HAVE_SSE2 OR HAVE_AVX)
+ set (HAVE_SIMD TRUE)
+ endif ()
++
+ file(GLOB fftw_api_SOURCE api/*.c api/*.h)
+ file(GLOB fftw_dft_SOURCE dft/*.c dft/*.h)
+ file(GLOB fftw_dft_scalar_SOURCE dft/scalar/*.c dft/scalar/*.h)
+@@ -215,6 +227,7 @@ file(GLOB fftw_dft_simd_SOURCE dft/simd/*.c dft/simd
+ file(GLOB fftw_dft_simd_sse2_SOURCE dft/simd/sse2/*.c dft/simd/sse2/*.h)
+ file(GLOB fftw_dft_simd_avx_SOURCE dft/simd/avx/*.c dft/simd/avx/*.h)
+ file(GLOB fftw_dft_simd_avx2_SOURCE dft/simd/avx2/*.c dft/simd/avx2/*.h dft/simd/avx2-128/*.c dft/simd/avx2-128/*.h)
++file(GLOB fftw_dft_simd_neon_SOURCE dft/simd/neon/*.c dft/simd/neon/*.h)
+ file(GLOB fftw_kernel_SOURCE kernel/*.c kernel/*.h)
+ file(GLOB fftw_rdft_SOURCE rdft/*.c rdft/*.h)
+ file(GLOB fftw_rdft_scalar_SOURCE rdft/scalar/*.c rdft/scalar/*.h)
+@@ -230,6 +243,7 @@ file(GLOB fftw_rdft_simd_SOURCE rdft/simd/*.c rdft/sim
+ file(GLOB fftw_rdft_simd_sse2_SOURCE rdft/simd/sse2/*.c rdft/simd/sse2/*.h)
+ file(GLOB fftw_rdft_simd_avx_SOURCE rdft/simd/avx/*.c rdft/simd/avx/*.h)
+ file(GLOB fftw_rdft_simd_avx2_SOURCE rdft/simd/avx2/*.c rdft/simd/avx2/*.h rdft/simd/avx2-128/*.c rdft/simd/avx2-128/*.h)
++file(GLOB fftw_rdft_simd_neon_SOURCE rdft/simd/neon/*.c rdft/simd/neon/*.h)
+
+ file(GLOB fftw_reodft_SOURCE reodft/*.c reodft/*.h)
+ file(GLOB fftw_simd_support_SOURCE simd-support/*.c simd-support/*.h)
+@@ -283,6 +297,10 @@ if (HAVE_AVX2)
+ list (APPEND SOURCEFILES ${fftw_dft_simd_avx2_SOURCE} ${fftw_rdft_simd_avx2_SOURCE})
+ endif ()
+
++if (HAVE_NEON)
++ list (APPEND SOURCEFILES ${fftw_dft_simd_neon_SOURCE} ${fftw_rdft_simd_neon_SOURCE})
++endif ()
++
+ set (FFTW_VERSION 3.3.10)
+
+ set (PREC_SUFFIX)
+ diff --git a/cmake.config.h.in b/cmake.config.h.in
+index 1f4c5055..8c61b38f 100644
+--- a/cmake.config.h.in
++++ b/cmake.config.h.in
+@@ -211,7 +211,7 @@
+ /* #undef HAVE_MPI */
+
+ /* Define to enable ARM NEON optimizations. */
+-/* #undef HAVE_NEON */
++#cmakedefine HAVE_NEON 1
+
+ /* Define if OpenMP is enabled */
+ #cmakedefine HAVE_OPENMP
diff --git a/vcpkg/ports/fftw3/portfile.cmake b/vcpkg/ports/fftw3/portfile.cmake new file mode 100644 index 0000000..e689ed3 --- /dev/null +++ b/vcpkg/ports/fftw3/portfile.cmake @@ -0,0 +1,78 @@ +vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.fftw.org/fftw-3.3.10.tar.gz"
+ FILENAME "fftw-3.3.10.tar.gz"
+ SHA512 2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ fftw3_arch_fix.patch
+ aligned_malloc.patch
+ bigobj.patch
+ fix-openmp.patch
+ install-subtargets.patch
+ fix-wrong-version.patch # https://github.com/FFTW/fftw3/commit/0842f00ae6b6e1f3aade155bc0edd17a7313fa6a
+ neon.patch # https://github.com/FFTW/fftw3/pull/275/commits/262f5cfe23af54930b119bd3653bc25bf2d881da
+)
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ openmp ENABLE_OPENMP
+ openmp CMAKE_REQUIRE_FIND_PACKAGE_OpenMP
+ threads ENABLE_THREADS
+ threads WITH_COMBINED_THREADS
+ avx2 ENABLE_AVX2
+ avx ENABLE_AVX
+ sse2 ENABLE_SSE2
+ sse ENABLE_SSE
+)
+
+set(package_names fftw3 fftw3f fftw3l)
+set(fftw3_options "")
+set(fftw3f_options -DENABLE_FLOAT=ON)
+set(fftw3l_options -DENABLE_LONG_DOUBLE=ON -DENABLE_AVX2=OFF -DENABLE_AVX=OFF -DENABLE_SSE2=OFF)
+
+if("neon" IN_LIST FEATURES)
+ list(APPEND fftw3f_options -DENABLE_NEON=ON)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ list(APPEND fftw3_options -DENABLE_NEON=ON)
+ endif()
+endif()
+
+foreach(package_name IN LISTS package_names)
+ message(STATUS "${package_name}...")
+ vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ LOGFILE_BASE "config-${package_name}-${TARGET_TRIPLET}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ ${${package_name}_options} # may override FEATURE_OPTIONS
+ -DBUILD_TESTS=OFF
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_REQUIRE_FIND_PACKAGE_OpenMP
+ )
+ vcpkg_cmake_build(
+ LOGFILE_BASE "install-${package_name}"
+ TARGET install
+ )
+ vcpkg_copy_pdbs()
+
+ vcpkg_cmake_config_fixup(PACKAGE_NAME "${package_name}" CONFIG_PATH "lib/cmake/${package_name}")
+endforeach()
+vcpkg_fixup_pkgconfig()
+
+file(READ "${SOURCE_PATH}/api/fftw3.h" _contents)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "defined(FFTW_DLL)" "0" _contents "${_contents}")
+else()
+ string(REPLACE "defined(FFTW_DLL)" "1" _contents "${_contents}")
+endif()
+file(WRITE "${SOURCE_PATH}/include/fftw3.h" "${_contents}")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/fftw3/vcpkg.json b/vcpkg/ports/fftw3/vcpkg.json new file mode 100644 index 0000000..5be2465 --- /dev/null +++ b/vcpkg/ports/fftw3/vcpkg.json @@ -0,0 +1,46 @@ +{ + "name": "fftw3", + "version": "3.3.10", + "port-version": 10, + "description": "FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).", + "homepage": "https://www.fftw.org/", + "license": "GPL-2.0-or-later", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "avx": { + "description": "Builds part of the library with avx, sse2, sse", + "supports": "!arm" + }, + "avx2": { + "description": "Builds part of the library with avx2, fma, avx, sse2, sse", + "supports": "!arm" + }, + "neon": { + "description": "Builds part of the library with neon", + "supports": "(linux | android) & arm" + }, + "openmp": { + "description": "Builds openmp enabled lib" + }, + "sse": { + "description": "Builds part of the library with sse", + "supports": "!arm" + }, + "sse2": { + "description": "Builds part of the library with sse2, sse", + "supports": "!arm" + }, + "threads": { + "description": "Enable threads in fftw3" + } + } +} |