···1414#include <math.h>
1515#include <string.h>
16161717+// Define KISS_FFT_SHARED macro to properly export symbols
1818+#ifdef KISS_FFT_SHARED
1919+# ifdef _WIN32
2020+# ifdef KISS_FFT_BUILD
2121+# define KISS_FFT_API __declspec(dllexport)
2222+# else
2323+# define KISS_FFT_API __declspec(dllimport)
2424+# endif
2525+# else
2626+# define KISS_FFT_API __attribute__ ((visibility ("default")))
2727+# endif
2828+#else
2929+# define KISS_FFT_API
3030+#endif
3131+1732#ifdef __cplusplus
1833extern "C" {
1934#endif
···99114 * buffer size in *lenmem.
100115 * */
101116102102-kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
117117+kiss_fft_cfg KISS_FFT_API kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
103118104119/*
105120 * kiss_fft(cfg,in_out_buf)
···111126 * Note that each element is complex and can be accessed like
112127 f[k].r and f[k].i
113128 * */
114114-void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
129129+void KISS_FFT_API kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
115130116131/*
117132 A more generic version of the above function. It reads its input from every Nth sample.
118133 * */
119119-void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
134134+void KISS_FFT_API kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
120135121136/* If kiss_fft_alloc allocated a buffer, it is one contiguous
122137 buffer and can be simply free()d when no longer needed*/
···126141 Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
127142 your compiler output to call this before you exit.
128143*/
129129-void kiss_fft_cleanup(void);
144144+void KISS_FFT_API kiss_fft_cleanup(void);
130145131146132147/*
133148 * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
134149 */
135135-int kiss_fft_next_fast_size(int n);
150150+int KISS_FFT_API kiss_fft_next_fast_size(int n);
136151137152/* for real ffts, we need an even size */
138153#define kiss_fftr_next_fast_size_real(n) \
+82
kissfft-config.cmake.in
···11+# kissfft-config.ccmake accept the following components:
22+#
33+# SHARED/STATIC:
44+# This components allows one to choose a shared/static kissfft library.
55+# The default is selected by BUILD_SHARED_LIBS.
66+# They are to be used exclusively. Using them together is an error.
77+#
88+# example:
99+# find_package(kissfft CONFIG REQUIRED COMPONENTS STATIC)
1010+#
1111+# simd/int16/int32/float/double:
1212+# This components allows one to choose the datatype.
1313+# When using this component, the target kissfft::kissfft becomes available.
1414+# When not using this component, you will have to choose the correct kissfft target.
1515+#
1616+# example:
1717+# find_package(kissfft CONFIG REQUIRED)
1818+# # - kissfft::kissfft-float, kissfft::kissfft-int32_t/ ... are available (if they are installed)
1919+# # - kissfft::kissfft is not available,
2020+#
2121+# find_package(kissfft CONFIG REQUIRED COMPONENTS int32_t)
2222+# # - kissfft::kissfft-float, kissfft::kissfft-int32_t/ ... are available (if they are installed)
2323+# # - kissfft::kissfft is available (as an alias for kissfft::kissfft-int32_t),
2424+2525+@PACKAGE_INIT@
2626+2727+cmake_minimum_required(VERSION 3.3)
2828+2929+# Set include glob of config files using SHARED/static component, BUILD_SHARED_LIBS by default
3030+set(_kissfft_shared_detected OFF)
3131+set(_kissfft_shared ${BUILD_SHARED_LIBS})
3232+if("SHARED" IN_LIST kissfft_FIND_COMPONENTS)
3333+ set(_kissfft_shared_detected ON)
3434+ set(_kissfft_shared ON)
3535+endif()
3636+if("STATIC" IN_LIST kissfft_FIND_COMPONENTS)
3737+ if(_kissfft_shared_detected)
3838+ message(FATAL_ERROR "SHARED and STATIC components cannot be used together")
3939+ endif()
4040+ set(_kissfft_shared_detected ON)
4141+ set(_kissfft_shared OFF)
4242+endif()
4343+4444+if(_kissfft_shared)
4545+ set(_kissfft_config_glob "kissfft-*-shared-targets.cmake")
4646+else()
4747+ set(_kissfft_config_glob "kissfft-*-static-targets.cmake")
4848+endif()
4949+5050+# Load information for all configured kissfft
5151+get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
5252+file(GLOB CONFIG_FILES "${_DIR}/${_kissfft_config_glob}")
5353+foreach(f ${CONFIG_FILES})
5454+ include(${f})
5555+endforeach()
5656+5757+# If a datatype component is passed, create kissfft::kissfft
5858+set(_kissfft_datatype_detected)
5959+foreach(_kissfft_datatype simd int16 int32 float double)
6060+ if(_kissfft_datatype IN_LIST kissfft_FIND_COMPONENTS)
6161+ if(_kissfft_datatype_detected)
6262+ message(FATAL_ERROR "Cannot define datatype COMPONENT twice: ${_kissfft_datatype_detected} and ${_kissfft_datatype}")
6363+ endif()
6464+ set(_kissfft_datatype_detected ${_kissfft_datatype})
6565+ endif()
6666+endforeach()
6767+6868+if(_kissfft_datatype_detected)
6969+ if(NOT TARGET kissfft::kissfft-${_kissfft_datatype_detected})
7070+ message(FATAL_ERROR "kissfft with datatype=${_kissfft_datatype_detected} is not installed")
7171+ endif()
7272+ if(TARGET kissfft::kissfft)
7373+ message(SEND_ERROR "kissfft::kissfft already exists. You cannot use 2 find_package's with datatype that are visible to eachother.")
7474+ else()
7575+ add_library(kissfft::kissfft INTERFACE IMPORTED)
7676+ set_property(TARGET kissfft::kissfft PROPERTY INTERFACE_LINK_LIBRARIES kissfft::kissfft-${_kissfft_datatype_detected})
7777+ endif()
7878+endif()
7979+8080+set(kissfft_FOUND ON)
8181+set(KISSFFT_VERSION @kissfft_VERSION@)
8282+
+9
kissfft.pc.in
···11+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
22+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
33+44+Name: kissfft
55+Description: A Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid
66+Version: @kissfft_VERSION@
77+88+Libs: -L${libdir} -l@KISSFFT_OUTPUT_NAME@
99+Cflags: -I${includedir} @PKG_KISSFFT_DEFS@