Skip to content

Commit

Permalink
[itk] Use fftw3 threads and config
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Oct 13, 2024
1 parent af291a9 commit f938865
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
46 changes: 46 additions & 0 deletions ports/itk/fftw.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/CMake/FindFFTW.cmake b/CMake/FindFFTW.cmake
index 709c0cd..1f08467 100644
--- a/CMake/FindFFTW.cmake
+++ b/CMake/FindFFTW.cmake
@@ -30,7 +30,17 @@
## to set the initial value of the CMake variable `MKLROOT` (see
## https://software.intel.com/en-us/mkl-linux-developer-guide-scripts-to-set-environment-variables).

-if(ITK_USE_FFTWD OR ITK_USE_FFTWF)
+if((ITK_USE_FFTWD OR ITK_USE_FFTWF) AND NOT ITK_USE_CUFFTW)
+ find_path(FFTW_INCLUDE_PATH fftw3.h)
+ if(ITK_USE_FFTWD)
+ find_package(FFTWD NAMES FFTW3 CONFIG)
+ set(FFTWD_LIBRARIES FFTW3::fftw3)
+ endif()
+ if(ITK_USE_FFTWF)
+ find_package(FFTWF NAMES FFTW3f CONFIG)
+ set(FFTWF_LIBRARIES FFTW3::fftw3f)
+ endif()
+elseif(ITK_USE_FFTWD OR ITK_USE_FFTWF)

if(ITK_USE_MKL)
# If the user has provided the MKL include path then search nearby for library files
diff --git a/CMake/ITKConfig.cmake.in b/CMake/ITKConfig.cmake.in
index 7a77ae3..c4ffd3a 100644
--- a/CMake/ITKConfig.cmake.in
+++ b/CMake/ITKConfig.cmake.in
@@ -1,3 +1,10 @@
+include(CMakeFindDependencyMacro)
+if("@ITK_USE_FFTWD@")
+ find_dependency(FFTW3::fftw3 CONFIG)
+endif()
+if("@ITK_USE_FFTWF@")
+ find_dependency(FFTW3::fftw3f CONFIG)
+endif()
#-----------------------------------------------------------------------------
#
# ITKConfig.cmake - ITK CMake configuration file for external projects.
@@ -108,7 +115,6 @@ set(ITK_FFTW_LIBDIR "@FFTW_LIBDIR@")
# Add FFTW include and library directories
if (ITK_USE_FFTWF OR ITK_USE_FFTWD)
set(ITK_INCLUDE_DIRS ${ITK_INCLUDE_DIRS} "${ITK_FFTW_INCLUDE_PATH}")
- set(ITK_LIBRARY_DIRS ${ITK_LIBRARY_DIRS} "${ITK_FFTW_LIBDIR}")
endif()

# Add configuration with GPU
1 change: 1 addition & 0 deletions ports/itk/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
double-conversion.patch
fftw.diff
openjpeg.patch
openjpeg2.patch
var_libraries.patch
Expand Down
7 changes: 6 additions & 1 deletion ports/itk/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@
"fftw": {
"description": "Enable the FFTW backend",
"dependencies": [
"fftw3"
{
"name": "fftw3",
"features": [
"threads"
]
}
]
},
"opencl": {
Expand Down
2 changes: 1 addition & 1 deletion versions/i-/itk.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"git-tree": "cec6511954f40c271d710fc064fc41a2946a8173",
"git-tree": "f94333fcdb47b821facfa048d17594fbc228767b",
"version": "5.4.0",
"port-version": 1
},
Expand Down

0 comments on commit f938865

Please sign in to comment.