-
Notifications
You must be signed in to change notification settings - Fork 216
feat: add cmake #53
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
base: master
Are you sure you want to change the base?
feat: add cmake #53
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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() | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorporate support for *.in files: # Check for standard integer types and set size variables
include(CheckIncludeFile)
include(CheckTypeSize)
check_include_file(stdint.h HAVE_STDINT_H)
if(HAVE_STDINT_H)
set(INCLUDE_STDINT 1)
endif()
# Check sizes of integer types
check_type_size("short" SIZEOF_SHORT)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
# Set type definitions based on size checks
if(SIZEOF_SHORT EQUAL 2)
set(SIZE16 "short")
set(USIZE16 "unsigned short")
elseif(SIZEOF_INT EQUAL 2)
set(SIZE16 "int")
set(USIZE16 "unsigned int")
else()
set(SIZE16 "int16_t")
set(USIZE16 "uint16_t")
endif()
if(SIZEOF_INT EQUAL 4)
set(SIZE32 "int")
set(USIZE32 "unsigned int")
elseif(SIZEOF_LONG EQUAL 4)
set(SIZE32 "long")
set(USIZE32 "unsigned long")
else()
set(SIZE32 "int32_t")
set(USIZE32 "uint32_t")
endif()
# Configure speexdsp_config_types.h
# Ensure the target directory exists
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/speex")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/speexdsp_config_types.h.in"
"${CMAKE_BINARY_DIR}/include/speex/speexdsp_config_types.h"
@ONLY
|
||
|
|
||
| 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) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we may want to include the generation of shared libraries. list(REMOVE_ITEM speexdsp_SOURCES
${CMAKE_SOURCE_DIR}/libspeexdsp/testdenoise.c
${CMAKE_SOURCE_DIR}/libspeexdsp/testecho.c
${CMAKE_SOURCE_DIR}/libspeexdsp/testjitter.c
${CMAKE_SOURCE_DIR}/libspeexdsp/testresample.c
${CMAKE_SOURCE_DIR}/libspeexdsp/testresample2.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) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section generates the cmake support files, from the *.in files. install(DIRECTORY include/ DESTINATION include)
# Create and install pkg-config file
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/speexdsp.pc.in"
"${CMAKE_BINARY_DIR}/speexdsp.pc"
@ONLY
)
install(FILES "${CMAKE_BINARY_DIR}/speexdsp.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
# Create config file
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/speexdspConfig.cmake.in"
"${CMAKE_BINARY_DIR}/speexdspConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/speexdsp
)
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/speexdspConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_BINARY_DIR}/speexdspConfig.cmake"
"${CMAKE_BINARY_DIR}/speexdspConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/speexdsp
) |
||
| 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 |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand with VERSION and DESCRIPTION: