Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cmake #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ SpeexDSP.spec
config.h
config.log
config.status
include/speex/speexdsp_config_types.h
*.sw[lmnop]
testdenoise
testecho
Expand All @@ -35,3 +34,4 @@ speexdsp.pc
stamp-*
patches
/m4
build/
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions include/speex/speexdsp_config_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SPEEX_CONFIG_TYPES_H
#define SPEEX_CONFIG_TYPES_H

#include <stdint.h>

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
12 changes: 0 additions & 12 deletions include/speex/speexdsp_config_types.h.in

This file was deleted.