summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt53
1 files changed, 52 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cec8a2..a3f4e93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,16 @@
project(twinkle)
-cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
set(PRODUCT_VERSION "1.10.2")
set(PRODUCT_DATE "February 14, 2018")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+# Add -DDEBUG for non-release builds, or uCommon will unilaterally define NDEBUG
+# (https://lists.gnu.org/archive/html/bug-commoncpp/2019-12/msg00000.html)
+set_directory_properties(PROPERTIES
+ COMPILE_DEFINITIONS $<$<OR:$<CONFIG:>,$<CONFIG:Debug>>:DEBUG>)
+
+include(CMakeDependentOption)
OPTION(WITH_ZRTP "Enable ZRTP encrypted calls" OFF)
OPTION(WITH_SPEEX "Enable the Speex codec" OFF)
@@ -13,6 +19,7 @@ OPTION(WITH_ALSA "Enable ALSA support" ON)
OPTION(WITH_JACK "Enable JackAudio support" ON)
OPTION(WITH_DIAMONDCARD "Enable Diamondcard integration" OFF)
OPTION(WITH_QT5 "Enable Qt 5 GUI" ON)
+CMAKE_DEPENDENT_OPTION(WITH_DBUS "Enable use of QtDBus (GUI only)" ON "WITH_QT5" OFF)
OPTION(WITH_G729 "Enable G.729A support" OFF)
OPTION(WITH_GSM "Use external GSM library" OFF)
@@ -20,6 +27,10 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include (CheckIncludeFile)
include (CheckIncludeFiles)
+include (CheckSymbolExists)
+include (CMakePushCheckState)
+include (CheckCXXSourceCompiles)
+include (TestBigEndian)
find_package(LibXml2 REQUIRED)
find_package(LibMagic REQUIRED)
@@ -38,6 +49,11 @@ if (WITH_QT5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${Qt5Quick_EXECUTABLE_COMPILE_FLAGS}")
include_directories(${Qt5Widgets_INCLUDES} ${Qt5Quick_INCLUDES})
add_definitions(${Qt5Widgets_DEFINITIONS} ${Qt5Quick_DEFINITIONS})
+
+ if (WITH_DBUS)
+ find_package(Qt5DBus REQUIRED)
+ set(HAVE_DBUS TRUE)
+ endif (WITH_DBUS)
endif (WITH_QT5)
include_directories(${LIBXML2_INCLUDE_DIR})
@@ -96,6 +112,9 @@ if (WITH_ILBC)
if (ILBC_FOUND)
message(STATUS "iLBC OK")
set(HAVE_ILBC TRUE)
+ if (ILBC_CPP)
+ set(HAVE_ILBC_CPP TRUE)
+ endif (ILBC_CPP)
include_directories(${ILBC_INCLUDE_DIR})
else (ILBC_FOUND)
@@ -109,6 +128,10 @@ if (WITH_G729)
if (G729_FOUND)
message(STATUS "bcg729 OK")
set(HAVE_BCG729 TRUE)
+
+ if (G729_ANNEX_B)
+ set(HAVE_BCG729_ANNEX_B TRUE)
+ endif (G729_ANNEX_B)
include_directories(${G729_INCLUDE_DIR})
else (G729_FOUND)
@@ -133,6 +156,34 @@ check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(linux/types.h HAVE_LINUX_TYPES_H)
check_include_files("sys/socket.h;linux/errqueue.h" HAVE_LINUX_ERRQUEUE_H)
+check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
+if (HAVE_STRERROR_R)
+ # Check whether the return type is (int) or (char *)
+ # Code taken from Apache Thrift's ConfigureChecks.cmake
+ check_cxx_source_compiles("
+ #include <string.h>
+ int main() {
+ char b;
+ char *a = strerror_r(0, &b, 0);
+ return 0;
+ }
+ " STRERROR_R_CHAR_P)
+endif (HAVE_STRERROR_R)
+
+cmake_push_check_state()
+list(APPEND CMAKE_REQUIRED_LIBRARIES "-lresolv")
+check_cxx_source_compiles("
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+
+ int main() { res_init(); return 0; }
+" HAVE_RES_INIT)
+cmake_pop_check_state()
+
+test_big_endian(WORDS_BIGENDIAN)
+
set(datadir "${CMAKE_INSTALL_PREFIX}/share/twinkle")
configure_file(twinkle_config.h.in twinkle_config.h)
configure_file(twinkle.desktop.in twinkle.desktop)