From f0d6013fa94f955b5b9aa606fd46835fede4169e Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:55:35 +0200 Subject: [PATCH 1/3] feat: add cmake --- .gitignore | 1 + CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 91740497..a1d8e4a3 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ speexdsp.pc stamp-* patches /m4 +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..ac20e180 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,37 @@ +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() + +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) From 9178f36ca25eab88e193f0909b43cfe65683d8e7 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sat, 7 Dec 2024 19:26:04 +0200 Subject: [PATCH 2/3] fix: windows build with cmake --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac20e180..7e5a14af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,12 @@ 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 From 144726b6236eba021db3247c9e018381fc32bd06 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sat, 7 Dec 2024 20:00:50 +0200 Subject: [PATCH 3/3] fix: linux build with cmake --- .gitignore | 1 - include/speex/speexdsp_config_types.h | 11 +++++++++++ include/speex/speexdsp_config_types.h.in | 12 ------------ 3 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 include/speex/speexdsp_config_types.h delete mode 100644 include/speex/speexdsp_config_types.h.in diff --git a/.gitignore b/.gitignore index a1d8e4a3..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 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 -