diff options
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | cmake/FindGsm.cmake | 17 | ||||
-rw-r--r-- | src/CMakeLists.txt | 41 | ||||
-rw-r--r-- | src/audio/audio_tx.h | 7 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 20 | ||||
-rw-r--r-- | twinkle_config.h.in | 1 |
6 files changed, 72 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d41f749..d8cd1fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ OPTION(WITH_DIAMONDCARD "Enable Diamondcard integration" OFF) OPTION(WITH_QT4 "Enable Qt 4 GUI" OFF) OPTION(WITH_QT5 "Enable Qt 5 GUI" OFF) OPTION(WITH_G729 "Enable G.729A support" OFF) +OPTION(WITH_GSM "Use external GSM library" OFF) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") @@ -114,6 +115,18 @@ if (WITH_G729) endif (G729_FOUND) endif (WITH_G729) +if (WITH_GSM) + find_package(Gsm) + + if (GSM_FOUND) + message(STATUS "gsm OK") + set(HAVE_GSM TRUE) + + include_directories(${GSM_INCLUDE_DIR}) + else (GSM_FOUND) + message(FATAL_ERROR "gsm not found!") + endif (GSM_FOUND) +endif (WITH_GSM) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(linux/types.h HAVE_LINUX_TYPES_H) diff --git a/cmake/FindGsm.cmake b/cmake/FindGsm.cmake new file mode 100644 index 0000000..85f367b --- /dev/null +++ b/cmake/FindGsm.cmake @@ -0,0 +1,17 @@ +FIND_PATH(GSM_INCLUDE_DIR gsm/gsm.h) +FIND_LIBRARY(GSM_LIBRARY NAMES gsm) + +IF(GSM_INCLUDE_DIR AND GSM_LIBRARY) + SET(GSM_FOUND TRUE) +ENDIF(GSM_INCLUDE_DIR AND GSM_LIBRARY) + +IF(GSM_FOUND) + IF (NOT Gsm_FIND_QUIETLY) + MESSAGE(STATUS "Found gsm includes: ${GSM_INCLUDE_DIR}/gsm/config.h") + MESSAGE(STATUS "Found gsm library: ${GSM_LIBRARY}") + ENDIF (NOT Gsm_FIND_QUIETLY) +ELSE(GSM_FOUND) + IF (Gsm_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find gsm development files") + ENDIF (Gsm_FIND_REQUIRED) +ENDIF(GSM_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1b0607..11c79f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,9 @@ project(libtwinkle) include_directories("${CMAKE_CURRENT_SOURCE_DIR}") add_subdirectory(audio) -add_subdirectory(audio/gsm/src) +if (NOT WITH_GSM) + add_subdirectory(audio/gsm/src) +endif (NOT WITH_GSM) add_subdirectory(audits) add_subdirectory(im) add_subdirectory(mwi) @@ -54,11 +56,9 @@ set(LIBTWINKLE_SRCS add_library(libtwinkle OBJECT ${LIBTWINKLE_SRCS}) -add_executable(twinkle-console - main.cpp +set(twinkle_OBJS $<TARGET_OBJECTS:libtwinkle> $<TARGET_OBJECTS:libtwinkle-audio> - $<TARGET_OBJECTS:libtwinkle-gsm> $<TARGET_OBJECTS:libtwinkle-audits> $<TARGET_OBJECTS:libtwinkle-im> $<TARGET_OBJECTS:libtwinkle-mwi> @@ -71,15 +71,40 @@ add_executable(twinkle-console $<TARGET_OBJECTS:libtwinkle-threads> $<TARGET_OBJECTS:libtwinkle-utils> ) +if (NOT WITH_GSM) + list(APPEND twinkle_OBJS $<TARGET_OBJECTS:libtwinkle-gsm>) +endif (NOT WITH_GSM) + +add_executable(twinkle-console + main.cpp + ${twinkle_OBJS} +) + +set(twinkle_LIBS + -lpthread + -lresolv + ${LibMagic_LIBRARY} + ${LIBXML2_LIBRARIES} + ${Readline_LIBRARY} + ${ILBC_LIBRARIES} + ${SPEEX_LIBRARIES} + ${ZRTPCPP_LIBRARIES} + ${CCRTP_LIBRARIES} + ${COMMONCPP_LIBRARIES} + ${UCOMMON_LIBRARIES} + ${LIBSNDFILE_LIBRARY} + ${ALSA_LIBRARY} + ${G729_LIBRARY} +) +if (WITH_GSM) + list(APPEND twinkle_LIBS ${GSM_LIBRARY}) +endif (WITH_GSM) if (WITH_QT4 OR WITH_QT5) add_subdirectory(gui) endif (WITH_QT4 OR WITH_QT5) -target_link_libraries(twinkle-console -lpthread -lresolv ${LibMagic_LIBRARY} ${LIBXML2_LIBRARIES} - ${Readline_LIBRARY} ${ILBC_LIBRARIES} ${SPEEX_LIBRARIES} ${ZRTPCPP_LIBRARIES} - ${CCRTP_LIBRARIES} ${COMMONCPP_LIBRARIES} ${UCOMMON_LIBRARIES} ${LIBSNDFILE_LIBRARY} - ${ALSA_LIBRARY} ${G729_LIBRARY}) +target_link_libraries(twinkle-console ${twinkle_LIBS}) install(TARGETS twinkle-console DESTINATION bin) diff --git a/src/audio/audio_tx.h b/src/audio/audio_tx.h index a51ef9a..20daebc 100644 --- a/src/audio/audio_tx.h +++ b/src/audio/audio_tx.h @@ -30,11 +30,16 @@ #include "rtp_telephone_event.h" #include "user.h" #include "threads/mutex.h" -#include "gsm/inc/gsm.h" #include "audio_device.h" #include "twinkle_rtp_session.h" #include "twinkle_config.h" +#ifdef HAVE_GSM +#include <gsm/gsm.h> +#else +#include "gsm/inc/gsm.h" +#endif + using namespace std; using namespace ost; diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index c178b9c..41e8a04 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -111,30 +111,14 @@ set(TWINKLE_GUI-SRCS osd.cpp incoming_call_popup.cpp - $<TARGET_OBJECTS:libtwinkle> - $<TARGET_OBJECTS:libtwinkle-audio> - $<TARGET_OBJECTS:libtwinkle-gsm> - $<TARGET_OBJECTS:libtwinkle-audits> - $<TARGET_OBJECTS:libtwinkle-im> - $<TARGET_OBJECTS:libtwinkle-mwi> - $<TARGET_OBJECTS:libtwinkle-parser> - $<TARGET_OBJECTS:libtwinkle-patterns> - $<TARGET_OBJECTS:libtwinkle-presence> - $<TARGET_OBJECTS:libtwinkle-sdp> - $<TARGET_OBJECTS:libtwinkle-sockets> - $<TARGET_OBJECTS:libtwinkle-stun> - $<TARGET_OBJECTS:libtwinkle-threads> - $<TARGET_OBJECTS:libtwinkle-utils> + ${twinkle_OBJS} ${twinkle_UIS} ${twinkle_QRC} ${twinkle_LANG} ) add_executable(twinkle ${TWINKLE_GUI-SRCS}) -target_link_libraries(twinkle -lpthread -lresolv ${LibMagic_LIBRARY} ${LIBXML2_LIBRARIES} - ${Readline_LIBRARY} ${ILBC_LIBRARIES} ${SPEEX_LIBRARIES} ${ZRTPCPP_LIBRARIES} - ${CCRTP_LIBRARIES} ${COMMONCPP_LIBRARIES} ${UCOMMON_LIBRARIES} ${LIBSNDFILE_LIBRARY} - ${ALSA_LIBRARY} ${qt_LIBS} ${G729_LIBRARY}) +target_link_libraries(twinkle ${twinkle_LIBS} ${qt_LIBS}) install(TARGETS twinkle DESTINATION bin) install(FILES ${twinkle_LANG} DESTINATION share/twinkle/lang) diff --git a/twinkle_config.h.in b/twinkle_config.h.in index 4cf6fc9..3928565 100644 --- a/twinkle_config.h.in +++ b/twinkle_config.h.in @@ -3,6 +3,7 @@ #cmakedefine HAVE_ILBC #cmakedefine HAVE_ZRTP #cmakedefine HAVE_BCG729 +#cmakedefine HAVE_GSM #cmakedefine HAVE_UNISTD_H #cmakedefine HAVE_LINUX_TYPES_H |