From 31df8531d003d5335d275490d085efa2124f2d2b Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Tue, 16 Apr 2013 19:02:50 +0000 Subject: [PATCH] Commit initial cmake config for codec2. git-svn-id: https://svn.code.sf.net/p/freetel/code@1233 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/CMakeLists.txt | 76 ++++++++++++++++++++++++++++ codec2-dev/src/CMakeLists.txt | 95 +++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 codec2-dev/CMakeLists.txt create mode 100644 codec2-dev/src/CMakeLists.txt diff --git a/codec2-dev/CMakeLists.txt b/codec2-dev/CMakeLists.txt new file mode 100644 index 00000000..729b09cc --- /dev/null +++ b/codec2-dev/CMakeLists.txt @@ -0,0 +1,76 @@ +cmake_minimum_required (VERSION 2.8) + +# Prevent in-source builds +set(CMAKE_DISABLE_SOURCE_CHANGES ON) +set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) + +project(codec2) + + +# +# Set project version information. This should probably be done via external +# file at some point. +# +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 2) +# Set to patch level is needed, otherwise leave FALSE. +set(PROJECT_VERSION_PATCH FALSE) +set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") +# Patch level version bumps should not change API/ABI. +set(SOVERSION ${PROJECT_VERSION}) +if(PROJECT_VERSION_PATCH) + set(PROJECT_VERSION "${PROJECT_VERSION}.${PROJECT_VERSION_PATCH}") +endif() + +message(STATUS "codec2 version: ${PROJECT_VERSION}") + +# Set default C++ flags. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -O3 -g") + +# Build shared libraries by default +set(BUILD_SHARED_LIBS TRUE) + + +# +# Find some standard headers and functions. +# Should we error out if one is not available? +# Do the results need to be written to a config.h? +# +find_library(LIBM m ) +if(LIBM) + set(CMAKE_REQUIRED_INCLUDES math.h) + set(CMAKE_REQUIRED_LIBRARIES m) +endif(LIBM) + +include(CheckIncludeFiles) +check_include_files("stdlib.h" HAVE_STDLIB_H) +check_include_files("string.h" HAVE_STRING_H) + +include(CheckFunctionExists) +check_function_exists(floor HAVE_FLOOR) +check_function_exists(ceil HAVE_CEIL) +check_function_exists(pow HAVE_POW) +check_function_exists(sqrt HAVE_SQRT) +check_function_exists(sin HAVE_SIN) +check_function_exists(cos HAVE_COS) +check_function_exists(atan2 HAVE_ATAN2) +check_function_exists(log10 HAVE_LOG10) + + +# +# codec2 library +# +add_subdirectory(src) + +# +# Install example code? Defaults to no. +# +option(INSTALL_EXAMPLES "Install example code." OFF) +if(INSTALL_EXAMPLES) + install(DIRECTORY octave raw script voicing wav + DESTINATION share/codec2) +endif() + +# +# Cpack configuration to go here... +# diff --git a/codec2-dev/src/CMakeLists.txt b/codec2-dev/src/CMakeLists.txt new file mode 100644 index 00000000..fdf09e3f --- /dev/null +++ b/codec2-dev/src/CMakeLists.txt @@ -0,0 +1,95 @@ +set(CODEC2_SRCS + dump.c + lpc.c + nlp.c + postfilter.c + sine.c + codec2.c + fifo.c + fdmdv.c + kiss_fft.c + interp.c + lsp.c + phase.c + quantise.c + pack.c + codebook.c + codebookd.c + codebookvq.c + codebookjnd.c + codebookjvm.c + codebookvqanssi.c + codebookdt.c + codebookge.c +) + +add_library(codec2 ${CODEC2_SRCS}) +target_link_libraries(codec2 ${CMAKE_REQUIRED_LIBRARIES}) +set_target_properties(codec2 PROPERTIES SOVERSION ${SOVERSION}) + +set(CODEC2_PUBLIC_HEADERS + codec2.h + codec2_fdmdv.h + codec2_fifo.h + comp.h + golay23.h +) + +install(FILES ${CODEC2_PUBLIC_HEADERS} + DESTINATION include/codec2 +) + +add_executable(c2demo c2demo.c) +target_link_libraries(c2demo ${CMAKE_REQUIRED_LIBRARIES} codec2) + +add_executable(c2enc c2enc.c) +target_link_libraries(c2enc ${CMAKE_REQUIRED_LIBRARIES} codec2) + +add_executable(c2dec c2dec.c) +target_link_libraries(c2dec ${CMAKE_REQUIRED_LIBRARIES} codec2) + +add_executable(c2sim c2sim.c ampexp.c phaseexp.c) +target_link_libraries(c2sim ${CMAKE_REQUIRED_LIBRARIES} codec2) + +add_executable(fdmdv_get_test_bits fdmdv_get_test_bits.c fdmdv.c kiss_fft.c) +target_link_libraries(fdmdv_get_test_bits ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(fdmdv_mod fdmdv_mod.c fdmdv.c kiss_fft.c) +target_link_libraries(fdmdv_mod ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(fdmdv_demod fdmdv_demod.c fdmdv.c kiss_fft.c octave.c) +target_link_libraries(fdmdv_demod ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(fdmdv_put_test_bits fdmdv_put_test_bits.c fdmdv.c kiss_fft.c) +target_link_libraries(fdmdv_put_test_bits ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(fdmdv_interleave fdmdv_interleave.c) +target_link_libraries(fdmdv_interleave ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(insert_errors insert_errors.c) +target_link_libraries(insert_errors ${CMAKE_REQUIRED_LIBRARIES}) + +add_executable(fec_enc fec_enc.c golay23.c) +target_link_libraries(fec_enc ${CMAKE_REQUIRED_LIBRARIES} codec2) + +add_executable(fec_dec fec_dec.c golay23.c) +target_link_libraries(fec_dec ${CMAKE_REQUIRED_LIBRARIES} codec2) + +install(TARGETS + codec2 + c2demo + c2demo + c2enc + c2dec + c2sim + fdmdv_get_test_bits + fdmdv_mod fdmdv_demod + fdmdv_put_test_bits + fdmdv_interleave + insert_errors + fec_enc + fec_dec + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin +) -- 2.25.1