From 86b74cc52117ee2ca13fc3a871915def10c7a921 Mon Sep 17 00:00:00 2001 From: Ghislain MARY <ghislain.mary@belledonne-communications.com> Date: Fri, 2 Jan 2015 16:55:44 +0100 Subject: [PATCH] Handle compilation of account assistant when building with CMake. --- CMakeLists.txt | 12 ++++++++ cmake/FindNotify.cmake | 6 ++-- cmake/FindSoup.cmake | 63 ++++++++++++++++++++++++++++++++++++++++++ config.h.cmake | 1 + coreapi/CMakeLists.txt | 6 ++++ gtk/CMakeLists.txt | 7 +++++ 6 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 cmake/FindSoup.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f1664f68d1..89333bde40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,15 @@ if(ENABLE_NOTIFY) set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE) endif() endif() +if(ENABLE_ASSISTANT) + find_package(Soup) + if(SOUP_FOUND) + set(BUILD_WIZARD 1) + else() + message(WARNING "Could not find the soup library!") + set(ENABLE_ASSISTANT OFF CACHE BOOL "Turn on assistant compiling." FORCE) + endif() +endif() find_package(Gettext) @@ -120,6 +129,9 @@ endif() if(ENABLE_TUNNEL) include_directories(${TUNNEL_INCLUDE_DIRS}) endif() +if(ENABLE_ASSISTANT) + include_directories(${SOUP_INCLUDE_DIRS}) +endif() if(MSVC) include_directories(${CMAKE_PREFIX_PATH}/include/MSVC) diff --git a/cmake/FindNotify.cmake b/cmake/FindNotify.cmake index 26bd5bac14..f77e0885fc 100644 --- a/cmake/FindNotify.cmake +++ b/cmake/FindNotify.cmake @@ -22,9 +22,9 @@ # # - Find the notify include file and library # -# NOTIFY_FOUND - system has linphone -# NOTIFY_INCLUDE_DIRS - the linphone include directory -# NOTIFY_LIBRARIES - The libraries needed to use linphone +# NOTIFY_FOUND - system has libnotify +# NOTIFY_INCLUDE_DIRS - the libnotify include directory +# NOTIFY_LIBRARIES - The libraries needed to use libnotify set(_NOTIFY_ROOT_PATHS ${WITH_NOTIFY} diff --git a/cmake/FindSoup.cmake b/cmake/FindSoup.cmake new file mode 100644 index 0000000000..82735a3172 --- /dev/null +++ b/cmake/FindSoup.cmake @@ -0,0 +1,63 @@ +############################################################################ +# FindSoup.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. +# +############################################################################ +# +# - Find the soup include file and library +# +# SOUP_FOUND - system has libsoup +# SOUP_INCLUDE_DIRS - the libsoup include directory +# SOUP_LIBRARIES - The libraries needed to use libsoup + +find_package(GTK2 2.18 REQUIRED gtk) + +set(_SOUP_ROOT_PATHS + ${WITH_SOUP} + ${CMAKE_INSTALL_PREFIX} +) + +find_path(SOUP_INCLUDE_DIRS + NAMES libsoup/soup.h + HINTS _SOUP_ROOT_PATHS + PATH_SUFFIXES include/libsoup-2.4 +) + +if(SOUP_INCLUDE_DIRS) + set(HAVE_LIBSOUP_SOUP_H 1) + list(APPEND SOUP_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS}) +endif() + +find_library(SOUP_LIBRARIES + NAMES soup-2.4 + HINTS ${_SOUP_ROOT_PATHS} + PATH_SUFFIXES bin lib +) + +if(SOUP_LIBRARIES) + list(APPEND SOUP_LIBRARIES ${GTK2_LIBRARIES}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Soup + DEFAULT_MSG + SOUP_INCLUDE_DIRS SOUP_LIBRARIES HAVE_LIBSOUP_SOUP_H +) + +mark_as_advanced(SOUP_INCLUDE_DIRS SOUP_LIBRARIES HAVE_LIBSOUP_SOUP_H) diff --git a/config.h.cmake b/config.h.cmake index 9690bff271..0d442cb366 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -36,6 +36,7 @@ #define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}" #define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}" +#cmakedefine BUILD_WIZARD #cmakedefine HAVE_NOTIFY4 #cmakedefine HAVE_CU_GET_SUITE 1 #cmakedefine HAVE_CU_CURSES 1 \ No newline at end of file diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 1a4f48665e..541e0d6707 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -97,6 +97,9 @@ if(ENABLE_TUNNEL) else() list(APPEND SOURCE_FILES linphone_tunnel_stubs.c) endif() +if(ENABLE_ASSISTANT) + list(APPEND SOURCE_FILES sipwizard.c) +endif() set(GENERATED_SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h @@ -124,6 +127,9 @@ endif() if(ENABLE_TUNNEL) list(APPEND LIBS ${TUNNEL_LIBRARIES}) endif() +if(ENABLE_ASSISTANT) + list(APPEND LIBS ${SOUP_LIBRARIES}) +endif() if(WIN32) list(APPEND LIBS shlwapi) endif() diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index 89d5805a6c..7af3759719 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -65,6 +65,10 @@ set(SOURCE_FILES videowindow.c ) +if(ENABLE_ASSISTANT) + list(APPEND SOURCE_FILES setupwizard.c) +endif() + if(GETTEXT_FOUND) add_definitions("-DENABLE_NLS") endif() @@ -77,6 +81,9 @@ if(ENABLE_NOTIFY) target_include_directories(linphone-gtk PUBLIC ${NOTIFY_INCLUDE_DIRS}) target_link_libraries(linphone-gtk ${NOTIFY_LIBRARIES}) endif() +if(ENABLE_ASSISTANT) + target_link_libraries(linphone-gtk ${SOUP_LIBRARIES}) +endif() install(TARGETS linphone-gtk RUNTIME DESTINATION bin -- GitLab