From 31b79d6f726f295096c3b9bf3a9a824e01594e9a Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Fri, 6 Mar 2015 21:07:08 +0000 Subject: [PATCH] Updates to allow static speex building. git-svn-id: https://svn.code.sf.net/p/freetel/code@2058 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2-dev/CMakeLists.txt | 101 +++++++++++++++-------------- fdmdv2-dev/cmake/BuildCodec2.cmake | 2 +- fdmdv2-dev/src/CMakeLists.txt | 2 - fdmdv2/CMakeLists.txt | 68 +++++++++---------- 4 files changed, 89 insertions(+), 84 deletions(-) diff --git a/fdmdv2-dev/CMakeLists.txt b/fdmdv2-dev/CMakeLists.txt index 8c3789b6..4773359a 100644 --- a/fdmdv2-dev/CMakeLists.txt +++ b/fdmdv2-dev/CMakeLists.txt @@ -88,6 +88,8 @@ set(USE_STATIC_SOX FALSE CACHE BOOL "Download and build static sox instead of the system library.") set(USE_STATIC_CODEC2 TRUE CACHE BOOL "Download and build static codec2 instead of the system library.") +set(USE_STATIC_SPEEXDSP TRUE CACHE BOOL + "Download and build static speex instead of the system library.") set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL "Download and build static wxWidgets instead of the system library.") @@ -212,6 +214,40 @@ add_definitions(-DHAVE_CONFIG_H) find_package(Threads REQUIRED) message(STATUS "Threads library flags: ${CMAKE_THREAD_LIBS_INIT}") +# +# Find codec2 +# +if(NOT USE_STATIC_CODEC2) + message(STATUS "Looking for codec2...") + find_package(codec2 CONFIG QUIET) + if(codec2_FOUND) + get_target_property(CODEC2_BRARY codec2 LOCATION) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${codec2_INCLUDE_DIRS}") + else() + # Try to find manually + find_path(CODEC2_INCLUDE_DIRS codec2.h + PATH_SUFFIXES codec2) + find_library(CODEC2_LIBRARY NAMES codec2) + if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIRS}") + list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) + include_directories(${CODEC2_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "codec2 library not found. +Linux: +Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV. +Windws: +It's easiest to use the cmake option: USE_STATIC_CODEC2" + ) + endif() + endif() +else(NOT USE_STATIC_CODEC2) + message(STATUS "Will attempt static build of codec2.") + include(cmake/BuildCodec2.cmake) +endif(NOT USE_STATIC_CODEC2) + # # Find or build portaudio Library # @@ -376,56 +412,27 @@ if(wxWidgets_FOUND) list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) endif(wxWidgets_FOUND) -# -# Find codec2 -# -if(NOT USE_STATIC_CODEC2) - message(STATUS "Looking for codec2...") - find_package(codec2 CONFIG QUIET) - if(codec2_FOUND) - get_target_property(CODEC2_BRARY codec2 LOCATION) - message(STATUS " codec2 library: ${CODEC2_LIBRARY}") - message(STATUS " codec2 headers: ${codec2_INCLUDE_DIRS}") - else() - # Try to find manually - find_path(CODEC2_INCLUDE_DIRS codec2.h - PATH_SUFFIXES codec2) - find_library(CODEC2_LIBRARY NAMES codec2) - if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS) - message(STATUS " codec2 library: ${CODEC2_LIBRARY}") - message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIRS}") - list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) - include_directories(${CODEC2_INCLUDE_DIRS}) - else() - message(FATAL_ERROR "codec2 library not found. -Linux: -Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV. -Windws: -It's easiest to use the cmake option: USE_STATIC_CODEC2" - ) - endif() - endif() -else(NOT USE_STATIC_CODEC2) - message(STATUS "Will attempt static build of codec2.") - include(cmake/BuildCodec2.cmake) -endif(NOT USE_STATIC_CODEC2) - # # Find speex library # -message(STATUS "Looking for Speex DSP library.") -find_path(SPEEXDSP_INCLUDE_DIR speex/speex.h) -find_library(SPEEXDSP_LIBRARY speexdsp) -message(STATUS " Speex DSP headers: ${SPEEXDSP_INCLUDE_DIR}") -message(STATUS " Speex DSP library: ${SPEEXDSP_LIBRARY}") -if(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) - include_directories(${SPEEXDSP_INCLUDE_DIR}) - list(APPEND FREEDV_LINK_LIBS ${SPEEXDSP_LIBRARY}) -else(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) - message(FATAL_ERROR "Speex DSP library not found!") -endif(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) - -# Freedv +if(NOT USE_STATIC_SPEEXDSP) + message(STATUS "Looking for Speex DSP library.") + find_path(SPEEXDSP_INCLUDE_DIR speex/speex.h) + find_library(SPEEXDSP_LIBRARY speexdsp) + message(STATUS " Speex DSP headers: ${SPEEXDSP_INCLUDE_DIR}") + message(STATUS " Speex DSP library: ${SPEEXDSP_LIBRARY}") + if(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) + include_directories(${SPEEXDSP_INCLUDE_DIR}) + list(APPEND FREEDV_LINK_LIBS ${SPEEXDSP_LIBRARY}) + else(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) + message(FATAL_ERROR "Speex DSP library not found!") + endif(SPEEXDSP_INCLUDE_DIR AND SPEEXDSP_LIBRARY) +else() + message(STATUS "Will attempt static build of speex.") + include(cmake/BuildSpeex.cmake) +endif() + +#Freedv add_subdirectory(src) # Icons and desktop file diff --git a/fdmdv2-dev/cmake/BuildCodec2.cmake b/fdmdv2-dev/cmake/BuildCodec2.cmake index 4c135778..dd2a585c 100644 --- a/fdmdv2-dev/cmake/BuildCodec2.cmake +++ b/fdmdv2-dev/cmake/BuildCodec2.cmake @@ -1,7 +1,7 @@ include(ExternalProject) ExternalProject_Add(codec2 SVN_REPOSITORY https://svn.code.sf.net/p/freetel/code/codec2-dev - CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE + CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external/dist INSTALL_COMMAND "" ) set(CODEC2_LIBRARIES diff --git a/fdmdv2-dev/src/CMakeLists.txt b/fdmdv2-dev/src/CMakeLists.txt index 4eaa27b6..ac30ad8b 100644 --- a/fdmdv2-dev/src/CMakeLists.txt +++ b/fdmdv2-dev/src/CMakeLists.txt @@ -30,8 +30,6 @@ set(FREEDV_SOURCES sox_biquad.h sox.h topFrame.h - #varicode.h - #varicode_table.h version.h ) diff --git a/fdmdv2/CMakeLists.txt b/fdmdv2/CMakeLists.txt index e9951141..b6e232ac 100644 --- a/fdmdv2/CMakeLists.txt +++ b/fdmdv2/CMakeLists.txt @@ -211,6 +211,40 @@ add_definitions(-DHAVE_CONFIG_H) find_package(Threads REQUIRED) message(STATUS "Threads library flags: ${CMAKE_THREAD_LIBS_INIT}") +# +# Find codec2 +# +if(NOT USE_STATIC_CODEC2) + message(STATUS "Looking for codec2...") + find_package(codec2 CONFIG QUIET) + if(codec2_FOUND) + get_target_property(CODEC2_BRARY codec2 LOCATION) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${codec2_INCLUDE_DIRS}") + else() + # Try to find manually + find_path(CODEC2_INCLUDE_DIRS codec2.h + PATH_SUFFIXES codec2) + find_library(CODEC2_LIBRARY NAMES codec2) + if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIRS}") + list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) + include_directories(${CODEC2_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "codec2 library not found. +Linux: +Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV. +Windws: +It's easiest to use the cmake option: USE_STATIC_CODEC2" + ) + endif() + endif() +else(NOT USE_STATIC_CODEC2) + message(STATUS "Will attempt static build of codec2.") + include(cmake/BuildCodec2.cmake) +endif(NOT USE_STATIC_CODEC2) + # # Find or build portaudio Library # @@ -375,40 +409,6 @@ if(wxWidgets_FOUND) list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) endif(wxWidgets_FOUND) -# -# Find codec2 -# -if(NOT USE_STATIC_CODEC2) - message(STATUS "Looking for codec2...") - find_package(codec2 CONFIG QUIET) - if(codec2_FOUND) - get_target_property(CODEC2_BRARY codec2 LOCATION) - message(STATUS " codec2 library: ${CODEC2_LIBRARY}") - message(STATUS " codec2 headers: ${codec2_INCLUDE_DIRS}") - else() - # Try to find manually - find_path(CODEC2_INCLUDE_DIRS codec2.h - PATH_SUFFIXES codec2) - find_library(CODEC2_LIBRARY NAMES codec2) - if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS) - message(STATUS " codec2 library: ${CODEC2_LIBRARY}") - message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIRS}") - list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) - include_directories(${CODEC2_INCLUDE_DIRS}) - else() - message(FATAL_ERROR "codec2 library not found. -Linux: -Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV. -Windws: -It's easiest to use the cmake option: USE_STATIC_CODEC2" - ) - endif() - endif() -else(NOT USE_STATIC_CODEC2) - message(STATUS "Will attempt static build of codec2.") - include(cmake/BuildCodec2.cmake) -endif(NOT USE_STATIC_CODEC2) - # Freedv add_subdirectory(src) -- 2.25.1