mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[fftw3] Cleanup of CMake targets. Modernize. Improve DLL marking. (#6540)
* [fftw3] Cleanup of CMake targets. Modernize. Improve DLL marking. * [fftw3] Use combined threads to enable DLLs on Windows.
This commit is contained in:
parent
60ecb46561
commit
ef2d3ff6d0
@ -1,5 +1,5 @@
|
||||
Source: fftw3
|
||||
Version: 3.3.8-4
|
||||
Version: 3.3.8-6
|
||||
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
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/fftw3.h 2017-01-15 13:03:24.000000000 +0100
|
||||
+++ b/fftw3.h 2017-02-24 04:05:36.051091700 +0100
|
||||
@@ -47,6 +47,8 @@
|
||||
#ifndef FFTW3_H
|
||||
#define FFTW3_H
|
||||
|
||||
+#define FFTW_DLL
|
||||
+
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
@ -1,15 +1,4 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fftw-3.3.8)
|
||||
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
# This can be removed in the next source code update
|
||||
if(EXISTS "${SOURCE_PATH}/CMakeLists.txt")
|
||||
file(READ "${SOURCE_PATH}/CMakeLists.txt" _contents)
|
||||
if("${_contents}" MATCHES "-D_OPENMP -DLIBFFTWF33_EXPORTS /openmp /bigobj")
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://www.fftw.org/fftw-3.3.8.tar.gz"
|
||||
@ -17,14 +6,13 @@ vcpkg_download_distfile(ARCHIVE
|
||||
SHA512 ab918b742a7c7dcb56390a0a0014f517a6dff9a2e4b4591060deeb2c652bf3c6868aa74559a422a276b853289b4b701bdcbd3d4d8c08943acf29167a7be81a38
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/omp_test.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/patch_targets.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/fftw3_arch_fix.patch
|
||||
omp_test.patch
|
||||
patch_targets.patch
|
||||
fftw3_arch_fix.patch
|
||||
)
|
||||
|
||||
if ("openmp" IN_LIST FEATURES)
|
||||
@ -70,8 +58,12 @@ else()
|
||||
set(HAVE_THREADS OFF)
|
||||
endif()
|
||||
|
||||
foreach(PRECISION ENABLE_DEFAULT_PRECISION ENABLE_FLOAT ENABLE_LONG_DOUBLE)
|
||||
if(${PRECISION} MATCHES "ENABLE_LONG_DOUBLE")
|
||||
set(ENABLE_FLOAT_CMAKE fftw3f)
|
||||
set(ENABLE_LONG_DOUBLE_CMAKE fftw3l)
|
||||
set(ENABLE_DEFAULT_PRECISION_CMAKE fftw3)
|
||||
|
||||
foreach(PRECISION ENABLE_FLOAT ENABLE_LONG_DOUBLE ENABLE_DEFAULT_PRECISION)
|
||||
if(PRECISION STREQUAL "ENABLE_LONG_DOUBLE")
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
@ -79,6 +71,8 @@ foreach(PRECISION ENABLE_DEFAULT_PRECISION ENABLE_FLOAT ENABLE_LONG_DOUBLE)
|
||||
-D${PRECISION}=ON
|
||||
-DENABLE_OPENMP=${ENABLE_OPENMP}
|
||||
-DENABLE_THREADS=${HAVE_THREADS}
|
||||
-DWITH_COMBINED_THREADS=${HAVE_THREADS}
|
||||
-DBUILD_TESTS=OFF
|
||||
)
|
||||
else()
|
||||
vcpkg_configure_cmake(
|
||||
@ -93,28 +87,30 @@ foreach(PRECISION ENABLE_DEFAULT_PRECISION ENABLE_FLOAT ENABLE_LONG_DOUBLE)
|
||||
-DHAVE_AVX2=${HAVE_AVX2}
|
||||
-DHAVE_FMA=${HAVE_FMA}
|
||||
-DENABLE_THREADS=${HAVE_THREADS}
|
||||
-DWITH_COMBINED_THREADS=${HAVE_THREADS}
|
||||
-DBUILD_TESTS=OFF
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${SOURCE_PATH}/api/fftw3.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
|
||||
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()
|
||||
|
||||
# Cleanup
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share/${${PRECISION}_CMAKE})
|
||||
endforeach()
|
||||
|
||||
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}")
|
||||
|
||||
# Cleanup
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
# 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…
x
Reference in New Issue
Block a user