mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-23 19:29:49 +00:00
fix find_package for fftw3 and add arch features (#4783)
* fix find_package for fftw3 * the patch took care of moving the files * Additional Patch to add Suffix to LibraryDepends * fixed minsizerel and relwithdebinfo for vs cmake configs * remove fix for minsizerel and relwithdeb info. Use global cmake mappings of these targets instead! * added feature packages. unfortunally avx and avx2 create an ICE with Visual Studio 2017 (maybe fixed with 2019?) * removed sse2 as default (forgot about arm...)
This commit is contained in:
parent
cfdc331b4b
commit
68a540d84c
@ -1,6 +1,21 @@
|
||||
Source: fftw3
|
||||
Version: 3.3.8
|
||||
Version: 3.3.8-2
|
||||
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).
|
||||
|
||||
Feature: openmp
|
||||
Description: Builds openmp enabled lib
|
||||
Description: Builds openmp enabled lib
|
||||
|
||||
Feature: sse
|
||||
Description: Builds part of the library with sse
|
||||
|
||||
Feature: sse2
|
||||
Description: Builds part of the library with sse2, sse
|
||||
|
||||
Feature: avx
|
||||
Description: Builds part of the library with avx, sse2, sse
|
||||
|
||||
Feature: avx2
|
||||
Description: Builds part of the library with avx2, fma, avx, sse2, sse
|
||||
|
||||
Feature: threads
|
||||
Description: Enable threads in fftw3
|
||||
|
23
ports/fftw3/fftw3_arch_fix.patch
Normal file
23
ports/fftw3/fftw3_arch_fix.patch
Normal file
@ -0,0 +1,23 @@
|
||||
diff --git a/CMakeLists - Kopie.txt b/CMakeLists.txt
|
||||
index 95bd537a..245acc8f 100644
|
||||
--- a/CMakeLists - Kopie.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -131,6 +131,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)
|
||||
@@ -176,8 +177,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)
|
||||
check_c_compiler_flag (${FLAG} HAVE_FMA)
|
||||
if (HAVE_FMA)
|
41
ports/fftw3/patch_targets.patch
Normal file
41
ports/fftw3/patch_targets.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 335808a..90772b4 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -358,7 +358,7 @@ foreach(subtarget ${subtargets})
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endforeach ()
|
||||
install(TARGETS ${fftw3_lib}
|
||||
- EXPORT FFTW3LibraryDepends
|
||||
+ EXPORT FFTW3${PREC_SUFFIX}LibraryDepends
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
@@ -419,11 +419,11 @@ configure_file (FFTW3ConfigVersion.cmake.in FFTW3${PREC_SUFFIX}ConfigVersion.cma
|
||||
install (FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}ConfigVersion.cmake
|
||||
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX}
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
|
||||
COMPONENT Development)
|
||||
|
||||
-export (TARGETS ${fftw3_lib} NAMESPACE FFTW3:: FILE ${PROJECT_BINARY_DIR}/FFTW3LibraryDepends.cmake)
|
||||
-install(EXPORT FFTW3LibraryDepends
|
||||
+export (TARGETS ${fftw3_lib} NAMESPACE FFTW3:: FILE ${PROJECT_BINARY_DIR}/FFTW3${PREC_SUFFIX}LibraryDepends.cmake)
|
||||
+install(EXPORT FFTW3${PREC_SUFFIX}LibraryDepends
|
||||
NAMESPACE FFTW3::
|
||||
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX}
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
|
||||
COMPONENT Development)
|
||||
--- a/FFTW3Config.cmake.in
|
||||
+++ b/FFTW3Config.cmake.in
|
||||
@@ -10,7 +10,7 @@ set (FFTW3@PREC_SUFFIX@_LIBRARIES fftw3@PREC_SUFFIX@)
|
||||
set (FFTW3@PREC_SUFFIX@_LIBRARY_DIRS @CMAKE_INSTALL_FULL_LIBDIR@)
|
||||
set (FFTW3@PREC_SUFFIX@_INCLUDE_DIRS @CMAKE_INSTALL_FULL_INCLUDEDIR@)
|
||||
|
||||
-include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")
|
||||
+include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3@PREC_SUFFIX@LibraryDepends.cmake")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 2.8.3)
|
||||
set (CMAKE_CURRENT_LIST_DIR)
|
||||
|
@ -21,6 +21,8 @@ vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/omp_test.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/patch_targets.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/fftw3_arch_fix.patch
|
||||
)
|
||||
|
||||
if ("openmp" IN_LIST FEATURES)
|
||||
@ -29,34 +31,88 @@ else()
|
||||
set(ENABLE_OPENMP OFF)
|
||||
endif()
|
||||
|
||||
if ("avx" IN_LIST FEATURES)
|
||||
set(HAVE_AVX ON)
|
||||
set(HAVE_SSE ON)
|
||||
set(HAVE_SSE2 ON)
|
||||
else()
|
||||
set(HAVE_AVX OFF)
|
||||
endif()
|
||||
|
||||
if ("avx2" IN_LIST FEATURES)
|
||||
set(HAVE_AVX2 ON)
|
||||
set(HAVE_FMA ON)
|
||||
set(HAVE_SSE ON)
|
||||
set(HAVE_SSE2 ON)
|
||||
else()
|
||||
set(HAVE_AVX2 OFF)
|
||||
set(HAVE_FMA OFF)
|
||||
endif()
|
||||
|
||||
if ("sse" IN_LIST FEATURES)
|
||||
set(HAVE_SSE ON)
|
||||
else()
|
||||
set(HAVE_SSE OFF)
|
||||
endif()
|
||||
|
||||
if ("sse2" IN_LIST FEATURES)
|
||||
set(HAVE_SSE2 ON)
|
||||
set(HAVE_SSE ON)
|
||||
else()
|
||||
set(HAVE_SSE2 OFF)
|
||||
endif()
|
||||
|
||||
if ("threads" IN_LIST FEATURES)
|
||||
set(HAVE_THREADS ON)
|
||||
else()
|
||||
set(HAVE_THREADS OFF)
|
||||
endif()
|
||||
|
||||
foreach(PRECISION ENABLE_DEFAULT_PRECISION ENABLE_FLOAT ENABLE_LONG_DOUBLE)
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-D${PRECISION}=ON
|
||||
-DENABLE_OPENMP=${ENABLE_OPENMP}
|
||||
)
|
||||
if(${PRECISION} MATCHES "ENABLE_LONG_DOUBLE")
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-D${PRECISION}=ON
|
||||
-DENABLE_OPENMP=${ENABLE_OPENMP}
|
||||
-DENABLE_THREADS=${HAVE_THREADS}
|
||||
)
|
||||
else()
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-D${PRECISION}=ON
|
||||
-DENABLE_OPENMP=${ENABLE_OPENMP}
|
||||
-DHAVE_SSE=${HAVE_SSE}
|
||||
-DHAVE_SSE2=${HAVE_SSE2}
|
||||
-DHAVE_AVX=${HAVE_AVX}
|
||||
-DHAVE_AVX2=${HAVE_AVX2}
|
||||
-DHAVE_FMA=${HAVE_FMA}
|
||||
-DENABLE_THREADS=${HAVE_THREADS}
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${SOURCE_PATH}/api/fftw3.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
file(COPY ${SOURCE_PATH}/api/fftw3.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
|
||||
|
||||
if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-dynamic.patch)
|
||||
endif()
|
||||
if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-dynamic.patch)
|
||||
endif()
|
||||
|
||||
# Cleanup
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
# Cleanup
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
endforeach()
|
||||
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/fftw3)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/fftw3/COPYING ${CURRENT_PACKAGES_DIR}/share/fftw3/copyright)
|
||||
|
Loading…
Reference in New Issue
Block a user