2021-09-19 07:46:47 +02:00
|
|
|
if(NOT WIN32 AND USE_SPEEX)
|
|
|
|
if(NOT SPEEX_PATH)
|
|
|
|
find_package(Speex QUIET)
|
|
|
|
|
|
|
|
if(Speex_FOUND)
|
|
|
|
set(SPEEX_SOURCE "(system)")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(SPEEX_PATH OR NOT Speex_FOUND)
|
|
|
|
FetchDependency(SPEEX
|
|
|
|
DIR speex
|
|
|
|
GIT_REPOSITORY https://gitlab.xiph.org/xiph/speex
|
2022-04-14 14:29:54 +02:00
|
|
|
GIT_TAG Speex-1.2.0
|
2021-09-19 07:46:47 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if(SPEEX_PATH)
|
2021-10-02 08:00:53 +02:00
|
|
|
set(SPEEX_LINK_PATH ${SPEEX_BIN}/libspeex/.libs/libspeex.a)
|
|
|
|
|
|
|
|
if(NOT EXISTS ${SPEEX_PATH}/configure)
|
|
|
|
add_custom_target(SPEEX_AUTORECONF
|
|
|
|
COMMAND ./autogen.sh
|
|
|
|
BYPRODUCTS ${SPEEX_PATH}/configure
|
|
|
|
WORKING_DIRECTORY ${SPEEX_PATH}
|
|
|
|
)
|
2021-09-19 07:46:47 +02:00
|
|
|
endif()
|
|
|
|
|
2021-10-02 08:00:53 +02:00
|
|
|
file(MAKE_DIRECTORY ${SPEEX_BIN})
|
|
|
|
add_custom_target(SPEEX_CONFIGURE
|
2021-10-22 10:31:57 +02:00
|
|
|
COMMAND "${SPEEX_PATH}/configure" --enable-static --disable-shared --disable-binaries CC="${CMAKE_C_COMPILER}" AR="${CMAKE_AR}" RANLIB="${CMAKE_RANLIB}"
|
2021-10-02 08:00:53 +02:00
|
|
|
DEPENDS ${SPEEX_PATH}/configure
|
|
|
|
BYPRODUCTS ${SPEEX_BIN}/Makefile
|
|
|
|
WORKING_DIRECTORY ${SPEEX_BIN}
|
|
|
|
)
|
|
|
|
add_custom_target(SPEEX_MAKE
|
|
|
|
COMMAND make
|
|
|
|
DEPENDS ${SPEEX_BIN}/Makefile
|
|
|
|
BYPRODUCTS ${SPEEX_LINK_PATH} ${SPEEX_BIN}
|
|
|
|
WORKING_DIRECTORY ${SPEEX_BIN}
|
|
|
|
)
|
|
|
|
|
2021-09-19 07:46:47 +02:00
|
|
|
add_library(speex STATIC IMPORTED)
|
2021-10-02 08:00:53 +02:00
|
|
|
if(NOT EXISTS ${SPEEX_LINK_PATH})
|
|
|
|
add_dependencies(speex SPEEX_MAKE)
|
|
|
|
endif()
|
2021-09-19 07:46:47 +02:00
|
|
|
set_target_properties(speex PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${SPEEX_LINK_PATH}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(NOT USE_SPEEX)
|
|
|
|
unset(SPEEX_SOURCE)
|
|
|
|
endif()
|