File: use-fftw-lib-with-cmake

package info (click to toggle)
liquid-dsp 1.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,216 kB
  • sloc: ansic: 115,859; sh: 3,513; makefile: 1,350; python: 274; asm: 11
file content (47 lines) | stat: -rw-r--r-- 1,398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: Detect and link with libfftw3 in cmake build
Author: Andreas Bombe <aeb@debian.org>
Last-Update: 2025-03-15 <YYYY-MM-DD, last update of the meta-information, optional>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,10 +41,11 @@
 include (CheckFunctionExists)
 include (CheckLibraryExists)
 include (CheckSymbolExists)
+find_package(PkgConfig REQUIRED)
 
 # check for hardware acceleration
 include(cmake/FindSIMD.cmake)
-# TODO: check for FFTW
+pkg_check_modules(FFTW3 IMPORTED_TARGET fftw3f REQUIRED)
 
 # global flags
 if (MSVC)
@@ -55,6 +56,10 @@
     add_compile_options(-Wall -fPIC -O3 -Wno-deprecated -Wno-deprecated-declarations)
 endif()
 
+if (FFTW3_FOUND)
+    set(HAVE_FFTW3_H 1)
+endif()
+
 include (CheckTypeSize)
 check_type_size(int SIZEOF_INT LANGUAGE C)
 
@@ -399,7 +404,7 @@
     target_link_options(${LIBNAME} PRIVATE -coverage)
 endif(COVERAGE)
 
-target_link_libraries(${LIBNAME} c m)
+target_link_libraries(${LIBNAME} c m PkgConfig::FFTW3)
 
 set_target_properties(${LIBNAME} PROPERTIES VERSION ${LIQUID_VERSION} SOVERSION 1)
 set_target_properties(${LIBNAME}-static PROPERTIES OUTPUT_NAME ${LIBNAME})
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -5,3 +5,4 @@
 #cmakedefine HAVE_STDLIB_H
 #cmakedefine HAVE_LIBC
 #cmakedefine SIZEOF_INT @SIZEOF_INT@
+#cmakedefine HAVE_FFTW3_H 1