diff --git a/CMakeLists.txt b/CMakeLists.txt index ac4f9e1bf..725985426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,15 @@ if(ENABLE_GTK_UI) message(WARNING "You need at least GTK 2.22 to enable the assistant") set(ENABLE_ASSISTANT OFF CACHE BOOL "Turn on assistant compiling." FORCE) endif() + if(APPLE) + find_package(GtkMacIntegration) + if(GTKMACINTEGRATION_FOUND) + set(HAVE_GTK_OSX 1) + add_definitions("${GTKMACINTEGRATION_CPPFLAGS}") + else() + message(WARNING "gtk-mac-integration not found. Please install gtk-osx-application package.") + endif() + endif() endif() if(ENABLE_ASSISTANT) set(BUILD_WIZARD 1) diff --git a/cmake/FindGtkMacIntegration.cmake b/cmake/FindGtkMacIntegration.cmake new file mode 100644 index 000000000..1c3069c3e --- /dev/null +++ b/cmake/FindGtkMacIntegration.cmake @@ -0,0 +1,54 @@ +############################################################################ +# FindGtkMacIntegration.txt +# Copyright (C) 2015 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 libgtkmacintegration include file and library +# +# GTKMACINTEGRATION_FOUND - system has libgtkmacintegration +# GTKMACINTEGRATION_INCLUDE_DIRS - the libgtkmacintegration include directory +# GTKMACINTEGRATION_LIBRARIES - The libraries needed to use libgtkmacintegration +# GTKMACINTEGRATION_CPPFLAGS - The cflags needed to use libgtkmacintegration + +set(_GTKMACINTEGRATION_ROOT_PATHS + ${CMAKE_INSTALL_PREFIX} +) + +find_path(GTKMACINTEGRATION_INCLUDE_DIRS + NAMES gtkosxapplication.h + HINTS _GTKMACINTEGRATION_ROOT_PATHS + PATH_SUFFIXES include/gtkmacintegration-gtk2 include/gtkmacintegration +) + +find_library(GTKMACINTEGRATION_LIBRARIES + NAMES gtkmacintegration-gtk2 gtkmacintegration + HINTS ${_GTKMACINTEGRATION_ROOT_PATHS} + PATH_SUFFIXES bin lib +) + +set(GTKMACINTEGRATION_CPPFLAGS "-DMAC_INTEGRATION") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GTKMACINTEGRATION + DEFAULT_MSG + GTKMACINTEGRATION_INCLUDE_DIRS GTKMACINTEGRATION_LIBRARIES GTKMACINTEGRATION_CPPFLAGS +) + +mark_as_advanced(GTKMACINTEGRATION_INCLUDE_DIRS GTKMACINTEGRATION_LIBRARIES GTKMACINTEGRATION_CPPFLAGS) diff --git a/config.h.cmake b/config.h.cmake index d731b58e6..2ec983163 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -38,6 +38,7 @@ #define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}" #cmakedefine BUILD_WIZARD +#cmakedefine HAVE_GTK_OSX #cmakedefine HAVE_NOTIFY4 #cmakedefine HAVE_ZLIB 1 #cmakedefine HAVE_CU_GET_SUITE 1 diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index b042b4c63..f68a1c3c7 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -89,7 +89,6 @@ target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES}) if(INTL_FOUND) target_link_libraries(linphone-gtk ${INTL_LIBRARIES}) endif() - if(WIN32) target_link_libraries(linphone-gtk Wininet) endif() @@ -97,10 +96,13 @@ if(ENABLE_NOTIFY) target_include_directories(linphone-gtk PUBLIC ${NOTIFY_INCLUDE_DIRS}) target_link_libraries(linphone-gtk ${NOTIFY_LIBRARIES}) endif() - -if (HAVE_LIBUDEV_H) +if(HAVE_LIBUDEV_H) target_link_libraries(linphone-gtk udev) endif() +if(GTKMACINTEGRATION_FOUND) + target_include_directories(linphone-gtk ${GTKMACINTEGRATION_INCLUDE_DIRS}) + target_link_libraries(linphone-gtk ${GTKMACINTEGRATION_LIBRARIES}) +endif() install(TARGETS linphone-gtk RUNTIME DESTINATION bin diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 1495c2709..9d7e23c98 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -80,5 +80,9 @@ else() target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK) target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS}) target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES}) + if(GTKMACINTEGRATION_FOUND) + target_include_directories(linphone-gtk ${GTKMACINTEGRATION_INCLUDE_DIRS}) + target_link_libraries(linphone-gtk ${GTKMACINTEGRATION_LIBRARIES}) + endif() endif() endif()