mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
[speexdsp] Update CMake script for macOS/Linux (#14758)
* [speexdsp] Update CMake script for macOS/Linux * [speexdsp] Update download URL comment Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * [speexdsp] update with suggested CMake changes Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
This commit is contained in:
parent
7be127628f
commit
7313144886
@ -1,32 +1,106 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
option(USE_SSE "Use SSE" ON)
|
||||
project (libspeexdsp)
|
||||
option(USE_SSE "Use SSE" OFF)
|
||||
option(USE_NEON "Use NEON" OFF)
|
||||
option(FIXED_POINT "Use Fixed Point Arithmetic" OFF)
|
||||
|
||||
file(GLOB_RECURSE LIBSPEEXDSP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/*.c")
|
||||
list(FILTER LIBSPEEXDSP_SOURCES EXCLUDE REGEX "${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/test.*\\.c")
|
||||
file(GLOB_RECURSE LIBSPEEXDSP_HEADERS "${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/*.h")
|
||||
file(GLOB_RECURSE LIBSPEEXDSP_HEADERS_PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include/**/*.h")
|
||||
set(LIBSPEEXDSP_VERSION "1.2.0")
|
||||
set(LIBSPEEXDSP_SOVERSION "1")
|
||||
project(libspeexdsp)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-D_WINDOWS -D_USRDLL)
|
||||
set(LIBSPEEXDSP_SOURCES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/buffer.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fftwrap.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/filterbank.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/jitter.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/mdf.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/preprocess.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/resample.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/scal.c"
|
||||
)
|
||||
set(LIBSPEEXDSP_HEADERS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/arch.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/bfin.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fftwrap.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/filterbank.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fixed_arm4.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fixed_arm5e.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fixed_bfin.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fixed_debug.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/fixed_generic.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/math_approx.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/misc_bfin.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/os_support.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/pseudofloat.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/resample_neon.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/resample_sse.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/smallft.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/stack_alloc.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/vorbis_psy.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speex_buffer.h"
|
||||
)
|
||||
set(LIBSPEEXDSP_HEADERS_PUBLIC
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speex_echo.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speex_jitter.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speex_preprocess.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speex_resampler.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/speex/speexdsp_types.h"
|
||||
)
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
add_definitions("-DEXPORT=")
|
||||
elseif(WIN32)
|
||||
add_definitions("-DEXPORT=")
|
||||
list(APPEND LIBSPEEXDSP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/win32/libspeexdsp.def")
|
||||
else ()
|
||||
add_definitions(-D_LIB)
|
||||
endif ()
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H -D_WIN32)
|
||||
|
||||
if (USE_SSE)
|
||||
add_definitions(-D_USE_SSE -D_USE_SSE2)
|
||||
else()
|
||||
add_definitions("-DEXPORT=__attribute__((visibility(\"default\")))")
|
||||
endif()
|
||||
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/include"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/win32")
|
||||
add_library(libspeexdsp ${LIBSPEEXDSP_SOURCES} ${LIBSPEEXDSP_HEADERS})
|
||||
if (USE_SSE AND NOT FIXED_POINT)
|
||||
add_definitions(-DUSE_SSE -DUSE_SSE2)
|
||||
endif()
|
||||
if (USE_NEON AND NOT MSVC)
|
||||
add_definitions(-DUSE_NEON)
|
||||
endif()
|
||||
|
||||
set_target_properties(libspeexdsp PROPERTIES PUBLIC_HEADER "${LIBSPEEXDSP_HEADERS_PUBLIC}")
|
||||
if (FIXED_POINT)
|
||||
add_definitions(-DFIXED_POINT -DUSE_KISS_FFT)
|
||||
list(APPEND LIBSPEEXDSP_SOURCES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/kiss_fft.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/kiss_fftr.c"
|
||||
)
|
||||
list(APPEND LIBSPEEXDSP_HEADERS
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/_kiss_fft_guts.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/kiss_fft.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/kiss_fftr.h"
|
||||
)
|
||||
else()
|
||||
add_definitions(-DFLOATING_POINT -DUSE_SMALLFT)
|
||||
list(APPEND LIBSPEEXDSP_SOURCES "${CMAKE_CURRENT_LIST_DIR}/libspeexdsp/smallft.c")
|
||||
endif()
|
||||
|
||||
install(TARGETS libspeexdsp
|
||||
if (NOT MSVC)
|
||||
add_definitions(-DVAR_ARRAYS)
|
||||
endif()
|
||||
|
||||
# Basic speexdsp_config_types.h for Linux support
|
||||
set(INCLUDE_STDINT "#include <stdint.h>")
|
||||
set(SIZE16 "int16_t")
|
||||
set(USIZE16 "uint16_t")
|
||||
set(SIZE32 "int32_t")
|
||||
set(USIZE32 "uint32_t")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/include/speex/speexdsp_config_types.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/speexdsp_config_types.h" @ONLY)
|
||||
list(APPEND LIBSPEEXDSP_HEADERS_PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/speexdsp_config_types.h")
|
||||
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
|
||||
|
||||
add_library(speexdsp ${LIBSPEEXDSP_SOURCES} ${LIBSPEEXDSP_HEADERS})
|
||||
set_target_properties(speexdsp PROPERTIES PUBLIC_HEADER "${LIBSPEEXDSP_HEADERS_PUBLIC}")
|
||||
set_target_properties(speexdsp PROPERTIES VERSION "${LIBSPEEXDSP_VERSION}")
|
||||
set_target_properties(speexdsp PROPERTIES SOVERSION "${LIBSPEEXDSP_SOVERSION}")
|
||||
|
||||
install(TARGETS speexdsp
|
||||
ARCHIVE DESTINATION "lib"
|
||||
RUNTIME DESTINATION "bin"
|
||||
PUBLIC_HEADER DESTINATION "include/speex")
|
||||
|
@ -1,5 +1,6 @@
|
||||
Source: speexdsp
|
||||
Version: 1.2.0-2
|
||||
Version: 1.2.0
|
||||
Port-Version: 3
|
||||
Homepage: https://speex.org/
|
||||
Description: A patent-free, Open Source/Free Software DSP library.
|
||||
Build-Depends:
|
||||
|
@ -1,10 +1,23 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO xiph/speexdsp
|
||||
REF 64cbfa9bca7479a758351aa02bb4abdd76baa9e7 #1.2.0
|
||||
SHA512 b92488e1efd4d763cd2d438b88a1b708d2a9d8f804dc2b016bfb29c4f7366624d3cf86a23645067393274e100c1bd6467def0eb98575f04ffcaf49b20f1f1105
|
||||
HEAD_REF master
|
||||
)
|
||||
if(VCPKG_USE_HEAD_VERSION)
|
||||
vcpkg_from_gitlab(
|
||||
GITLAB_URL "https://gitlab.xiph.org"
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO xiph/speexdsp
|
||||
HEAD_REF master
|
||||
)
|
||||
else()
|
||||
# Since the github repo is out-dated, use official download URL for release builds to reduce traffic to the Gitlab host
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://downloads.xiph.org/releases/speex/speexdsp-1.2.0.tar.gz"
|
||||
FILENAME "speexdsp-1.2.0.tar.gz"
|
||||
SHA512 e357cd5377415ea66c862302c7cf8bf6a10063cacd903f0846478975b87974cf5bdf00e2c6759d8f4f453c4c869cf284e9dc948a84a83d7b2ab96bd5405c05ec
|
||||
)
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE "${ARCHIVE}"
|
||||
REF "1.2.0"
|
||||
)
|
||||
endif()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
@ -12,12 +25,17 @@ set(USE_SSE OFF)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
set(USE_SSE ON)
|
||||
endif()
|
||||
set(USE_NEON OFF)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(USE_NEON ON)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DUSE_SSE=${USE_SSE}
|
||||
-DUSE_NEON=${USE_NEON}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
Loading…
x
Reference in New Issue
Block a user