diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2792ab2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,98 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +cmake_minimum_required(VERSION 2.8) +project(BCG729 C) + + +set(PACKAGE "bcg729") +set(PACKAGE_NAME "${PACKAGE}") +set(PACKAGE_VERSION "0.1") +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_BUGREPORT "support@belledonne-communications.com") +set(PACKAGE_TARNAME "bcg729") +set(PACKAGE_URL "") +set(VERSION "${PACKAGE_VERSION}") + + +option(ENABLE_TESTS "Enable compilation of the tests." No) +option(ENABLE_MSPLUGIN "Enable compilation of the mediastreamer2 plugin." Yes) +set(WITH_MS2 "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Set prefix where the mediastreamer libraries can be found (ex:/usr or /usr/local)") +set(WITH_ORTP "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Set prefix where the oRTP library can be found (ex:/usr or /usr/local)") + + +if(MSVC) + include_directories(${CMAKE_INSTALL_PREFIX}/include/MSVC) +endif() + + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules) +message("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") + +include(CheckIncludeFile) +check_include_file("dlfcn.h" HAVE_DLFCN_H) +check_include_file("inttypes.h" HAVE_INTTYPES_H) +check_include_file("memory.h" HAVE_MEMORY_H) +check_include_file("stdint.h" HAVE_STDINT_H) +check_include_file("stdlib.h" HAVE_STDLIB_H) +check_include_file("strings.h" HAVE_STRINGS_H) +check_include_file("string.h" HAVE_STRING_H) +check_include_file("sys/stat.h" HAVE_SYS_STAT_H) +check_include_file("sys/types.h" HAVE_SYS_TYPES_H) +check_include_file("unistd.h" HAVE_UNISTD_H) + +if(ENABLE_MSPLUGIN) + find_package(ORTP) + find_package(MS2) + + if(NOT (ORTP_FOUND AND MS2_FOUND)) + message(WARNING "Could not find the oRTP and/or mediastreamer2 libraries!") + set(ENABLE_MSPLUGIN OFF CACHE BOOL "Enable compilation of the mediastreamer2 plugin." FORCE) + endif() +endif() + + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + + +include_directories( + ${MS2_INCLUDE_DIR} + include + src + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/src +) + +add_definitions(-DHAVE_CONFIG_H) +if(MSVC) + add_definitions("/W3") +else() + add_definitions("-Wall" "-Werror") +endif() + +add_subdirectory(src) +if(ENABLE_MSPLUGIN) + add_subdirectory(msbcg729) +endif() +if(ENABLE_TESTS) + add_subdirectory(test) +endif() diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..d6c8c3b --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,61 @@ +/*************************************************************************** +* config.h.cmake +* Copyright (C) 2014 Belledonne Communications, Grenoble France +* +**************************************************************************** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +****************************************************************************/ + +#cmakedefine PACKAGE "@PACKAGE@" +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" +#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" +#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" +#cmakedefine PACKAGE_URL "@PACKAGE_URL@" +#cmakedefine VERSION "@VERSION@" + +#ifndef HAVE_DLFCN_H +#cmakedefine HAVE_DLFCN_H +#endif +#ifndef HAVE_INTTYPES_H +#cmakedefine HAVE_INTTYPES_H +#endif +#ifndef HAVE_MEMORY_H +#cmakedefine HAVE_MEMORY_H +#endif +#ifndef HAVE_STDINT_H +#cmakedefine HAVE_STDINT_H +#endif +#ifndef HAVE_STDLIB_H +#cmakedefine HAVE_STDLIB_H +#endif +#ifndef HAVE_STRINGS_H +#cmakedefine HAVE_STRINGS_H +#endif +#ifndef HAVE_STRING_H +#cmakedefine HAVE_STRING_H +#endif +#ifndef HAVE_SYS_STAT_H +#cmakedefine HAVE_SYS_STAT_H +#endif +#ifndef HAVE_SYS_TYPES_H +#cmakedefine HAVE_SYS_TYPES_H +#endif +#ifndef HAVE_UNISTD_H +#cmakedefine HAVE_UNISTD_H +#endif diff --git a/msbcg729/CMakeLists.txt b/msbcg729/CMakeLists.txt new file mode 100644 index 0000000..e09a669 --- /dev/null +++ b/msbcg729/CMakeLists.txt @@ -0,0 +1,46 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +set(SOURCE_FILES + bcg729_dec.c + bcg729_enc.c +) + +add_library(msbcg729 SHARED ${BCG729_SOURCE_FILES} ${SOURCE_FILES}) +set_target_properties(msbcg729 PROPERTIES VERSION ${PACKAGE_VERSION} SOVERSION 0) +if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libmsbcg729.pdb + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() + set_target_properties(msbcg729 PROPERTIES PREFIX "lib") +endif() +target_link_libraries(msbcg729 ${BCG729_LIBS}) + +install(TARGETS msbcg729 + RUNTIME DESTINATION lib/mediastreamer/plugins + LIBRARY DESTINATION lib/mediastreamer/plugins + ARCHIVE DESTINATION lib/mediastreamer/plugins + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..c9aca65 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,78 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +set(BCG729_LIBS + ${MS2_LIBRARIES} + ${ORTP_LIBRARIES} +) + +set(BCG729_SOURCE_FILES + adaptativeCodebookSearch.c + codebooks.c + computeAdaptativeCodebookGain.c + computeLP.c + computeWeightedSpeech.c + decodeAdaptativeCodeVector.c + decodeFixedCodeVector.c + decodeGains.c + decodeLSP.c + decoder.c + encoder.c + findOpenLoopPitchDelay.c + fixedCodebookSearch.c + gainQuantization.c + interpolateqLSP.c + LP2LSPConversion.c + LPSynthesisFilter.c + LSPQuantization.c + postFilter.c + postProcessing.c + preProcessing.c + qLSP2LP.c + utils.c +) + +add_library(bcg729 SHARED ${BCG729_SOURCE_FILES}) +set_target_properties(bcg729 PROPERTIES VERSION ${PACKAGE_VERSION} SOVERSION 0) +if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libbcg729.pdb + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() + set_target_properties(bcg729 PROPERTIES PREFIX "lib") +endif() +target_link_libraries(bcg729 ${BCG729_LIBS}) + +install(TARGETS bcg729 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) + +set(ABS_BCG729_SOURCE_FILES ) +foreach(elem ${BCG729_SOURCE_FILES}) + list(APPEND ABS_BCG729_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}") +endforeach() +set(BCG729_SOURCE_FILES ${ABS_BCG729_SOURCE_FILES} PARENT_SCOPE)