diff --git a/.gitignore b/.gitignore index 91740497..b6ea3ffe 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ SpeexDSP.spec config.h config.log config.status -include/speex/speexdsp_config_types.h *.sw[lmnop] testdenoise testecho @@ -35,3 +34,4 @@ speexdsp.pc stamp-* patches /m4 +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..7e5a14af --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) + +project(speexdsp LANGUAGES C CXX) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +option(BUILD_SHARED_LIBS "Build shared libraries" OFF) +option(USE_FIXED_POINT "Use fixed-point arithmetic" ON) + +# Define compile-time options +if(USE_FIXED_POINT) + add_compile_definitions(FIXED_POINT=1) +else() + add_compile_definitions(FLOATING_POINT=1) +endif() + +# 'M_PI': undeclared identifier +if(WIN32) + add_compile_definitions(_USE_MATH_DEFINES=1) +endif() + + +add_compile_definitions(EXPORT= USE_KISS_FFT=1) + +# Include directories +include_directories( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/libspeexdsp +) + +# Source files +file(GLOB SPEEXDSP_SOURCES libspeexdsp/*.c) +add_library(speexdsp ${SPEEXDSP_SOURCES}) + +# Installation rules +install(TARGETS speexdsp + EXPORT speexdspConfig + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install(DIRECTORY include/ DESTINATION include) diff --git a/include/speex/speexdsp_config_types.h b/include/speex/speexdsp_config_types.h new file mode 100644 index 00000000..81103093 --- /dev/null +++ b/include/speex/speexdsp_config_types.h @@ -0,0 +1,11 @@ +#ifndef SPEEX_CONFIG_TYPES_H +#define SPEEX_CONFIG_TYPES_H + +#include + +typedef int16_t spx_int16_t; +typedef uint16_t spx_uint16_t; +typedef int32_t spx_int32_t; +typedef uint32_t spx_uint32_t; + +#endif diff --git a/include/speex/speexdsp_config_types.h.in b/include/speex/speexdsp_config_types.h.in deleted file mode 100644 index 5ea7b556..00000000 --- a/include/speex/speexdsp_config_types.h.in +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __SPEEX_TYPES_H__ -#define __SPEEX_TYPES_H__ - -@INCLUDE_STDINT@ - -typedef @SIZE16@ spx_int16_t; -typedef @USIZE16@ spx_uint16_t; -typedef @SIZE32@ spx_int32_t; -typedef @USIZE32@ spx_uint32_t; - -#endif -