Skip to content

Conversation

@thewh1teagle
Copy link

@thewh1teagle thewh1teagle commented Dec 6, 2024

@phreed
Copy link

phreed commented Nov 24, 2025

I think the PR should include the cmake support files:

  • speexdspConfig.cmake
  • speexdsp.pc

Is there a reason you replaced the speexdsp_config_types.h.in with speexdsp_config_types.h?

phreed added a commit to FreeTAKTeam/staged-recipes that referenced this pull request Nov 24, 2025
Copy link

@phreed phreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library products should include cmake support files:

  • lib/pkgconfig/speexdsp.pc
  • lib/cmake/speexdsp/speexdspConfig.cmake
  • lib/cmake/speexdsp/speexdspConfigVersion.cmake

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.10)

project(speexdsp LANGUAGES C CXX)
Copy link

@phreed phreed Nov 24, 2025

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:

project(speexdsp
    VERSION 1.2.1
    DESCRIPTION "speexdsp audio processing library"
    LANGUAGES C CXX
)

if(WIN32)
add_compile_definitions(_USE_MATH_DEFINES=1)
endif()

Copy link

Choose a reason for hiding this comment

The 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
    

)

# Source files
file(GLOB SPEEXDSP_SOURCES libspeexdsp/*.c)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to include the generation of shared libraries.
In that case the test files should be excluded:

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
)

LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY include/ DESTINATION include)
Copy link

Choose a reason for hiding this comment

The 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
)

Copy link

@phreed phreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the *.in files should be preferred, such as speexdsp_config_types.h.in over the speexdsp_config_types.h.
speexdsp-cmake-support.zip

@thewh1teagle
Copy link
Author

FYI I can’t work on this PR anymore since it’s from about a year ago. I assume you can take it from here. Thanks!

@phreed
Copy link

phreed commented Nov 24, 2025

FYI I can’t work on this PR anymore since it’s from about a year ago. I assume you can take it from here. Thanks!

I just noticed that this is not the source repository but only a mirror.
I will take this up at the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CMake

3 participants