mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 21:20:27 -04:00
Add cmake install + MSVC dll support
This commit is contained in:
parent
0a70dfd0cf
commit
5c708d85db
@ -3,7 +3,29 @@ project(kissfft)
|
|||||||
|
|
||||||
add_library(kissfft
|
add_library(kissfft
|
||||||
kiss_fft.c)
|
kiss_fft.c)
|
||||||
|
add_library(kissfft::kissfft ALIAS kissfft)
|
||||||
|
|
||||||
target_include_directories(kissfft PUBLIC
|
target_include_directories(kissfft PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:.>)
|
$<INSTALL_INTERFACE:.>)
|
||||||
|
|
||||||
|
set_target_properties(kissfft PROPERTIES
|
||||||
|
DEFINE_SYMBOL KISS_FFT_BUILD)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(kissfft PUBLIC KISS_FFT_SHARED)
|
||||||
|
set_target_properties(kissfft PROPERTIES
|
||||||
|
C_VISIBILITY_PRESET hidden)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(KISSFFT_INSTALL "Enable kissfft install" ON)
|
||||||
|
if (KISSFFT_INSTALL)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS kissfft EXPORT kissfft
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
install(FILES "kiss_fft.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
install(EXPORT kissfft DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||||
|
NAMESPACE "kissfft::"
|
||||||
|
FILE "${PROJECT_NAME}-config.cmake")
|
||||||
|
endif()
|
||||||
|
25
kiss_fft.h
25
kiss_fft.h
@ -14,6 +14,21 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// Define KISS_FFT_SHARED macro to properly export symbols
|
||||||
|
#ifdef KISS_FFT_SHARED
|
||||||
|
# ifdef _WIN32
|
||||||
|
# ifdef KISS_FFT_BUILD
|
||||||
|
# define KISS_FFT_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define KISS_FFT_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define KISS_FFT_API __attribute__ ((visibility ("default")))
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define KISS_FFT_API
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -99,7 +114,7 @@ typedef struct kiss_fft_state* kiss_fft_cfg;
|
|||||||
* buffer size in *lenmem.
|
* buffer size in *lenmem.
|
||||||
* */
|
* */
|
||||||
|
|
||||||
kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
|
kiss_fft_cfg KISS_FFT_API kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kiss_fft(cfg,in_out_buf)
|
* kiss_fft(cfg,in_out_buf)
|
||||||
@ -111,12 +126,12 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
|
|||||||
* Note that each element is complex and can be accessed like
|
* Note that each element is complex and can be accessed like
|
||||||
f[k].r and f[k].i
|
f[k].r and f[k].i
|
||||||
* */
|
* */
|
||||||
void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
|
void KISS_FFT_API kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A more generic version of the above function. It reads its input from every Nth sample.
|
A more generic version of the above function. It reads its input from every Nth sample.
|
||||||
* */
|
* */
|
||||||
void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
|
void KISS_FFT_API kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
|
||||||
|
|
||||||
/* If kiss_fft_alloc allocated a buffer, it is one contiguous
|
/* If kiss_fft_alloc allocated a buffer, it is one contiguous
|
||||||
buffer and can be simply free()d when no longer needed*/
|
buffer and can be simply free()d when no longer needed*/
|
||||||
@ -126,13 +141,13 @@ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout
|
|||||||
Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
|
Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
|
||||||
your compiler output to call this before you exit.
|
your compiler output to call this before you exit.
|
||||||
*/
|
*/
|
||||||
void kiss_fft_cleanup(void);
|
void KISS_FFT_API kiss_fft_cleanup(void);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
|
* Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
|
||||||
*/
|
*/
|
||||||
int kiss_fft_next_fast_size(int n);
|
int KISS_FFT_API kiss_fft_next_fast_size(int n);
|
||||||
|
|
||||||
/* for real ffts, we need an even size */
|
/* for real ffts, we need an even size */
|
||||||
#define kiss_fftr_next_fast_size_real(n) \
|
#define kiss_fftr_next_fast_size_real(n) \
|
||||||
|
Loading…
Reference in New Issue
Block a user