diff --git a/.gitlab-ci-files/job-linux-desktop-archlinux-latest.yml b/.gitlab-ci-files/job-linux-desktop-archlinux-latest.yml index e9f810fdb..f320e0f63 100644 --- a/.gitlab-ci-files/job-linux-desktop-archlinux-latest.yml +++ b/.gitlab-ci-files/job-linux-desktop-archlinux-latest.yml @@ -100,7 +100,7 @@ job-archlinux-latest-ninja-clang-novideo: # - $NIGHTLY_MASTER # - $DEPLOY_LINUX # variables: -# CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON +# CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DENABLE_GPL_THIRD_PARTIES=ON # extends: job-archlinux-latest-makefile-clang # artifacts: # paths: diff --git a/.gitlab-ci-files/job-linux-desktop-centos7.yml b/.gitlab-ci-files/job-linux-desktop-centos7.yml index f81f11ae1..0c6f49e61 100644 --- a/.gitlab-ci-files/job-linux-desktop-centos7.yml +++ b/.gitlab-ci-files/job-linux-desktop-centos7.yml @@ -74,7 +74,7 @@ job-centos7-ninja-gcc-package: variables: - $DEPLOY_LINUX_CENTOS7 variables: - CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON CMAKE_GENERATOR: Ninja CC: gcc CXX: g++ diff --git a/.gitlab-ci-files/job-linux-desktop-debian10.yml b/.gitlab-ci-files/job-linux-desktop-debian10.yml index dc8a49cbd..50fc9eab9 100644 --- a/.gitlab-ci-files/job-linux-desktop-debian10.yml +++ b/.gitlab-ci-files/job-linux-desktop-debian10.yml @@ -109,7 +109,7 @@ job-debian10-makefile-clang-package: - $NIGHTLY_MASTER - $DEPLOY_LINUX variables: - CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON extends: job-debian10-makefile-clang artifacts: paths: diff --git a/.gitlab-ci-files/job-linux-desktop-ubuntu-1804.yml b/.gitlab-ci-files/job-linux-desktop-ubuntu-1804.yml index 0cf4d9283..51c05990f 100644 --- a/.gitlab-ci-files/job-linux-desktop-ubuntu-1804.yml +++ b/.gitlab-ci-files/job-linux-desktop-ubuntu-1804.yml @@ -55,7 +55,7 @@ job-ubuntu1804-ninja-clang: variables: - $NIGHTLY_MASTER variables: - CMAKE_OPTIONS: -DENABLE_DOC=ON -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_DOC=ON -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON CMAKE_GENERATOR: Ninja CC: clang CXX: clang++ @@ -76,7 +76,7 @@ job-ubuntu1804-makefile-gcc: - $NIGHTLY_MASTER - $DEPLOY_PLUGINS variables: - CMAKE_OPTIONS: -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON CMAKE_GENERATOR: Unix Makefiles CC: gcc CXX: g++ @@ -118,7 +118,7 @@ job-ubuntu1804-makefile-gcc-package: - $PACKAGE_LINUX - $DEPLOY_LINUX variables: - CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DLINPHONE_SDK_MAKE_RELEASE_FILE_URL=$MAKE_RELEASE_FILE_URL/$LINUX_PLATFORM/$APP_FOLDER -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_BUILDER_SIGNING_IDENTITY=$GPG_SIGNING_KEYID -DENABLE_G729=ON -DLINPHONE_SDK_MAKE_RELEASE_FILE_URL=$MAKE_RELEASE_FILE_URL/$LINUX_PLATFORM/$APP_FOLDER -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON CMAKE_GENERATOR: Unix Makefiles CC: gcc CXX: g++ diff --git a/.gitlab-ci-files/job-linux-desktop-ubuntu-rolling.yml b/.gitlab-ci-files/job-linux-desktop-ubuntu-rolling.yml index 25304c964..cb3034ac7 100644 --- a/.gitlab-ci-files/job-linux-desktop-ubuntu-rolling.yml +++ b/.gitlab-ci-files/job-linux-desktop-ubuntu-rolling.yml @@ -92,7 +92,7 @@ job-ubuntu-rolling-ninja-clang-novideo: # - $NIGHTLY_MASTER # - $DEPLOY_LINUX # variables: -# CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON +# CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DENABLE_GPL_THIRD_PARTIES=ON # extends: job-ubuntu-rolling-makefile-clang # artifacts: # paths: diff --git a/.gitlab-ci-files/job-macosx-desktop.yml b/.gitlab-ci-files/job-macosx-desktop.yml index 1aa43317f..ac7ae8fda 100644 --- a/.gitlab-ci-files/job-macosx-desktop.yml +++ b/.gitlab-ci-files/job-macosx-desktop.yml @@ -40,13 +40,14 @@ # On each push ################################################# +#TODO: reactivate pcrypto when liboqs is fixed for 'Vortex' CPU. job-macosx-ninja: except: refs: - schedules variables: CMAKE_GENERATOR: Ninja - CMAKE_OPTIONS: -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_PQCRYPTO=OFF extends: .job-macosx-desktop ################################################# @@ -60,7 +61,7 @@ job-macosx-makefile: - $DEPLOY_PLUGINS variables: CMAKE_GENERATOR: Unix Makefiles - CMAKE_OPTIONS: -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_PQCRYPTO=OFF ADDITIONAL_BUILD_OPTIONS: -j$MAKEFILE_JOBS extends: .job-macosx-desktop @@ -69,7 +70,7 @@ job-macosx-ninja-novideo: variables: - $NIGHTLY_MASTER variables: - CMAKE_OPTIONS: -DENABLE_VIDEO=OFF -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_VIDEO=OFF -DENABLE_PQCRYPTO=OFF CMAKE_GENERATOR: Ninja extends: .job-macosx-desktop diff --git a/.gitlab-ci-files/job-windows-desktop.yml b/.gitlab-ci-files/job-windows-desktop.yml index 4c0ded14e..01bdc3cb3 100644 --- a/.gitlab-ci-files/job-windows-desktop.yml +++ b/.gitlab-ci-files/job-windows-desktop.yml @@ -10,7 +10,7 @@ - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $DOCKER_UPDATE == null && $SKIP_WINDOWS == null - if: $CI_PIPELINE_SOURCE == "schedule" && $DOCKER_UPDATE == null && $SKIP_WINDOWS == null variables: - CMAKE_OPTIONS: -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON LINPHONESDK_PLATFORM: Desktop OUTPUT_ZIP_FOLDER: win64 MINGW_TYPE: mingw64 @@ -102,7 +102,7 @@ .windows-vs2019-msvc: extends: .windows-vs2019 variables: - CMAKE_OPTIONS: -DENABLE_UNIT_TESTS=ON -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_UNIT_TESTS=ON -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON LINPHONESDK_PLATFORM: Desktop CMAKE_GENERATOR: "Visual Studio 16 2019" BUILD_TARGET: install @@ -158,7 +158,7 @@ vs2019-win64-package: - if: $PACKAGE_WINDOWS - if: $DEPLOY_WINDOWS variables: - CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON + CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DLINPHONE_WINDOWS_SIGN_TOOL=$WINDOWS_SIGN_TOOL -DLINPHONE_WINDOWS_SIGN_TIMESTAMP_URL=$WINDOWS_SIGN_TIMESTAMP_URL -DLINPHONE_WINDOWS_SIGN_HASH=$WINDOWS_SIGN_HASH -DENABLE_G729=ON -DENABLE_PQCRYPTO=ON -DENABLE_GPL_THIRD_PARTIES=ON RELEASE_FILE: -DLINPHONE_SDK_MAKE_RELEASE_FILE_URL=$MAKE_RELEASE_FILE_URL/$WINDOWS_PLATFORM/$APP_FOLDER ################################################# diff --git a/CMakeLists.txt b/CMakeLists.txt index d3102064a..d4b2d83b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ cmake_minimum_required(VERSION 3.22) + get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) @@ -39,6 +40,8 @@ if(ENABLE_BUILD_VERBOSE) message("User Args : ${USER_ARGS}") endif() if( APPLE ) + set(LINPHONESDK_BUILD_TYPE "Macos") + set(ENABLE_FAT_BINARY "ON") if( NOT CMAKE_OSX_DEPLOYMENT_TARGET) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") endif() @@ -55,9 +58,23 @@ endif() project(linphoneqt) +set(CMAKE_SYSTEM_PROCESSOR "x86_64") include(GNUInstallDirs) include(CheckCXXCompilerFlag) +set(CMAKE_CXX_STANDARD 17) +set(APPLICATION_OUTPUT_DIR "${CMAKE_BINARY_DIR}/OUTPUT") +set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}") +#set(LINPHONE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/linphone-sdk/desktop") # Fromp 5.3, this install output is no more usable. We have to install all into the same folder as the final folder. +#set(QTKEYCHAIN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/qtkeychain") + +#set(LINPHONE_OUTPUT_DIR "${APPLICATION_OUTPUT_DIR}") +#set(LINPHONE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/linphone-sdk/linphone-sdk/mac") +#set(LINPHONE__DIR "${CMAKE_BINARY_DIR}/linphone-sdk/linphone-sdk/mac") +set(QTKEYCHAIN_OUTPUT_DIR "${APPLICATION_OUTPUT_DIR}") + +set(QTKEYCHAIN_TARGET_NAME "EQt5Keychain") + # Avoid cmake warning if CMP0071 is not set. if (POLICY CMP0071) cmake_policy(SET CMP0071 NEW) @@ -85,49 +102,63 @@ endif() #------------------------------------------------------------------------------- # SET OPTIONS #------------------------------------------------------------------------------- +set(OPTION_LIST) +function(add_option OPTION DESC VALUE) + option(${OPTION} ${DESC} ${VALUE}) + list(APPEND OPTION_LIST "-D${OPTION}=${VALUE}") +endfunction() -option(ENABLE_APP_LICENSE "Enable the license in packages." ON) -option(ENABLE_APP_OAUTH2 "Build with OAuth2 support for remote provisioning." OFF) # Experimental. -option(ENABLE_APP_PACKAGING "Enable packaging" OFF) -option(ENABLE_APP_PACKAGE_ROOTCA "Embed the rootca file into the package" ON) -option(ENABLE_APP_PDF_VIEWER "Enable Pdf viewer" ON) -option(ENABLE_APP_WEBVIEW "Enable webviews." OFF) # Webview is not fully supported because of deployments. Used for subscription. -option(ENABLE_BUILD_APP_PLUGINS "Enable the build of plugins" ON) -option(ENABLE_BUILD_EXAMPLES "Enable the build of examples" OFF) -option(ENABLE_BUILD_VERBOSE "Enable the build generation to be more verbose" OFF) -option(ENABLE_QT_KEYCHAIN "Build QtKeychain to manage VFS from System key stores." ON) -option(ENABLE_UPDATE_CHECK "Enable update check." ON) -option(LINPHONE_SDK_MAKE_RELEASE_FILE_URL "Make a RELEASE file that work along check_version and use this URL" "") -option(ENABLE_RELATIVE_PREFIX "Set Internal packages relative to the binary" ON) +#option(ENABLE_APP_LICENSE "Enable the license in packages." ON) +add_option(ENABLE_APP_LICENSE "Enable the license in packages." ON) +add_option(ENABLE_APP_OAUTH2 "Build with OAuth2 support for remote provisioning." OFF) # Experimental. +add_option(ENABLE_APP_PACKAGING "Enable packaging" OFF) +add_option(ENABLE_APP_PACKAGE_ROOTCA "Embed the rootca file into the package" ON) +add_option(ENABLE_APP_PDF_VIEWER "Enable Pdf viewer" ON) +add_option(ENABLE_APP_WEBVIEW "Enable webviews." OFF) # Webview is not fully supported because of deployments. Used for subscription. +add_option(ENABLE_BUILD_APP_PLUGINS "Enable the build of plugins" ON) +add_option(ENABLE_BUILD_EXAMPLES "Enable the build of examples" OFF) +add_option(ENABLE_BUILD_VERBOSE "Enable the build generation to be more verbose" OFF) +add_option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." OFF) +add_option(ENABLE_DAEMON "Enable the linphone daemon interface." OFF) +add_option(ENABLE_DOC "Enable API documentation generation." OFF) +add_option(ENABLE_FFMPEG "Build mediastreamer2 with ffmpeg video support." OFF)# No more needed +add_option(ENABLE_LDAP "Enable LDAP support." YES) +add_option(ENABLE_NON_FREE_CODECS "Enable the use of non free codecs" YES) +add_option(ENABLE_NON_FREE_FEATURES "Enable the use of non free codecs" ${ENABLE_NON_FREE_CODECS}) +add_option(ENABLE_OPENH264 "Enable the use of OpenH264 codec" YES) +add_option(ENABLE_QT_KEYCHAIN "Build QtKeychain to manage VFS from System key stores." ON) +add_option(ENABLE_QRCODE "Enable QRCode support" OFF)#Experimental +add_option(ENABLE_RELATIVE_PREFIX "Set Internal packages relative to the binary" ON) +add_option(ENABLE_SANITIZER "Enable sanitizer." OFF) +add_option(ENABLE_STRICT "Build with strict compilator flags e.g. -Wall -Werror" OFF) +add_option(ENABLE_TESTS "Build with testing binaries of SDK" OFF) +add_option(ENABLE_TESTS_COMPONENTS "Build libbctoolbox-tester" OFF) +add_option(ENABLE_TOOLS "Enable tools of SDK" OFF) +add_option(ENABLE_UNIT_TESTS "Enable unit test of SDK." OFF) +add_option(ENABLE_UPDATE_CHECK "Enable update check." ON) +add_option(ENABLE_VIDEO "Enable Video support." YES) +add_option(ENABLE_WINDOWS_TOOLS_CHECK "Enable tools checks on Windows for auto install." OFF) + + +add_option(LINPHONE_SDK_MAKE_RELEASE_FILE_URL "Make a RELEASE file that work along check_version and use this URL" "") # QtKeychain -option(LIBSECRET_SUPPORT "Build with libsecret support" OFF) # Need libsecret-devel +add_option(LIBSECRET_SUPPORT "Build with libsecret support" OFF) # Need libsecret-devel -# Set some SDK variables to configure the APP build as we want it -set(ENABLE_CONSOLE_UI OFF) -set(ENABLE_CXX_WRAPPER ON CACHE BOOL "Build the C++ wrapper for Liblinphone." FORCE) -set(ENABLE_DAEMON OFF) -set(ENABLE_FFMPEG OFF) -set(ENABLE_LDAP ON) -set(ENABLE_NON_FREE_FEATURES ON) -set(ENABLE_OPENH264 ON) -set(ENABLE_QRCODE OFF) # Experimental -set(ENABLE_SANITIZER OFF) -set(ENABLE_STRICT OFF) -set(ENABLE_TESTS_COMPONENT OFF) -set(ENABLE_THEORA OFF) -set(ENABLE_TOOLS OFF) -set(ENABLE_VIDEO ON) if(WIN32) - set(ENABLE_OPENSSL_EXPORT ON) + option(ENABLE_OPENSSL_EXPORT "Enable OpenSSL deployment" YES) elseif(APPLE) - set(ENABLE_OPENSSL_EXPORT OFF) + option(ENABLE_OPENSSL_EXPORT "Enable OpenSSL deployment" OFF) else() - set(ENABLE_V4L ON) - set(ENABLE_OPENSSL_EXPORT OFF) + option(ENABLE_V4L "Ability to capture and display video using libv4l2 or libv4l." YES) + option(ENABLE_OPENSSL_EXPORT "Enable OpenSSL deployment" OFF) endif() +# Set some SDK variables to configure the APP build as we want it +set(ENABLE_CXX_WRAPPER ON CACHE BOOL "Build the C++ wrapper for Liblinphone." FORCE) +set(ENABLE_THEORA OFF) +set(ENABLE_QT_GL ${ENABLE_VIDEO}) find_package(Qt5 5.10 COMPONENTS Core REQUIRED) @@ -135,32 +166,60 @@ if(NOT Qt5_FOUND) message(FATAL_ERROR "Minimum supported Qt5 version is 5.10!") endif() +set(LINPHONEAPP_BUILD_TYPE "Default" CACHE STRING "Type of build") +set_property(CACHE LINPHONEAPP_BUILD_TYPE PROPERTY STRINGS "Default" "Macos" "Normal") + +if(LINPHONEAPP_BUILD_TYPE STREQUAL "Default") + if(APPLE) + set(LINPHONEAPP_BUILD_TYPE "Macos") + else() + set(LINPHONEAPP_BUILD_TYPE "Normal") + endif() + +endif() + if(NOT LINPHONE_QT_ONLY) + function(add_linphone_sdk) + set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}") + #set(CMAKE_BINARY_DIR ${APPLICATION_OUTPUT_DIR}) + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Prevent project from overriding the options we just set here + add_subdirectory("linphone-sdk") + endfunction() + add_linphone_sdk() - function(add_linphone_sdk) - set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Prevent project from overriding the options we just set here - add_subdirectory("linphone-sdk") + if(ENABLE_QT_KEYCHAIN) + function(add_linphone_keychain) + set(CMAKE_INSTALL_PREFIX "${QTKEYCHAIN_OUTPUT_DIR}") + add_subdirectory("external/qtkeychain") + endfunction() + add_linphone_keychain() + endif() + get_target_property(LINPHONE_BIN_DIR sdk LOCATION) +endif() + +if(NOT LINPHONE_OUTPUT_DIR AND NOT LINPHONE_BIN_DIR) + set(LINPHONE_OUTPUT_DIR ${APPLICATION_OUTPUT_DIR}) +else() + set(LINPHONE_OUTPUT_DIR ${LINPHONE_BIN_DIR}) +endif() + + +if(NOT APPLE) + function(add_linphone_app) + + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Prevent project from overriding the options we just set here + if(APPLE) + add_compile_definitions("ENABLE_FAT_BINARY=ON") # Disable XCFrameworks as it is not supported. + elseif(UNIX) + set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib") + endif() + add_subdirectory("linphone-app") endfunction() - add_linphone_sdk() - - if(ENABLE_QT_KEYCHAIN) - set(QTKEYCHAIN_TARGET_NAME "EQt5Keychain") - add_subdirectory("external/qtkeychain") + add_linphone_app() + if(ENABLE_BUILD_APP_PLUGINS) + add_subdirectory("plugins" "plugins-app") endif() +else() + include(cmake/TasksMacos.cmake) endif() -function(add_linphone_app) - if(APPLE) - add_compile_definitions("ENABLE_FAT_BINARY=ON") # Disable XCFrameworks as it is not supported. - elseif(UNIX) - set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib") - endif() - - add_subdirectory("linphone-app") -endfunction() -add_linphone_app() - - -if(ENABLE_BUILD_APP_PLUGINS) - add_subdirectory("plugins" "plugins-app") -endif() diff --git a/cmake/TasksMacos.cmake b/cmake/TasksMacos.cmake new file mode 100644 index 000000000..7cc8a6575 --- /dev/null +++ b/cmake/TasksMacos.cmake @@ -0,0 +1,113 @@ +############################################################################ +# TasksMacos.cmake +# Copyright (C) 2010-2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +set(LINPHONEAPP_MACOS_ARCHS "x86_64" CACHE STRING "MacOS architectures to build: comma-separated list of values in [arm64, x86_64]") +option(ENABLE_FAT_BINARY "Enable fat binary generation using lipo." ON) + +set(_MACOS_ARCHS ${LINPHONEAPP_MACOS_ARCHS}) +#linphone_sdk_convert_comma_separated_list_to_cmake_list("${LINPHONESDK_MACOS_ARCHS}" _MACOS_ARCHS) + + +############################################################################ +# Clean previously generated SDK +############################################################################ + +#add_custom_target(clean-sdk ALL +# COMMAND "${CMAKE_COMMAND}" +# "-DLINPHONESDK_DIR=${PROJECT_SOURCE_DIR}" +# "-DLINPHONESDK_BUILD_DIR=${PROJECT_BINARY_DIR}" +# "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" +# "-P" "${PROJECT_SOURCE_DIR}/cmake/macos/CleanSDK.cmake" +# WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +# COMMENT "Cleaning SDK" +# USES_TERMINAL +#) + + +############################################################################ +# Build each selected architecture +############################################################################ + +#linphone_sdk_get_inherited_cmake_args(_CMAKE_CONFIGURE_ARGS _CMAKE_BUILD_ARGS) +#linphone_sdk_get_enable_cmake_args(_MACOS_CMAKE_ARGS) + + +#-DLINPHONE_OUTPUT_DIR=${LINPHONE_OUTPUT_DIR} + + +set(_MACOS_TARGETS) +foreach(_MACOS_ARCH IN LISTS _MACOS_ARCHS) + set(_MACOS_ARCH_BINARY_DIR "${PROJECT_BINARY_DIR}/app_mac-${_MACOS_ARCH}") + set(_MACOS_ARCH_INSTALL_DIR "${PROJECT_BINARY_DIR}/OUTPUT/mac-${_MACOS_ARCH}") + add_custom_target(app_mac-${_MACOS_ARCH} ALL + COMMAND ${CMAKE_COMMAND} -B ${_MACOS_ARCH_BINARY_DIR} ${USER_ARGS} ${OPTION_LIST} -DCMAKE_INSTALL_PREFIX=${_MACOS_ARCH_INSTALL_DIR} -DLINPHONE_OUTPUT_DIR=${LINPHONE_OUTPUT_DIR} -DCMAKE_TOOLCHAIN_FILE=${PROJECT_SOURCE_DIR}/cmake/toolchains/toolchain-mac-x86_64.cmake -DLINPHONEAPP_BUILD_TYPE="Normal" + COMMAND ${CMAKE_COMMAND} --build ${_MACOS_ARCH_BINARY_DIR} --target install ${_CMAKE_BUILD_ARGS} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/linphone-app + DEPENDS sdk + COMMENT "Building Linphone APP for MacOS ${_MACOS_ARCH}" + USES_TERMINAL + COMMAND_EXPAND_LISTS + ) + list(APPEND _MACOS_TARGETS mac-${_MACOS_ARCH}) +endforeach() + + +############################################################################ +# Generate the aggregated frameworks +############################################################################ + +#add_custom_target(gen-frameworks ALL +# COMMAND "${CMAKE_COMMAND}" +# "-DLINPHONESDK_DIR=${PROJECT_SOURCE_DIR}" +# "-DLINPHONESDK_BUILD_DIR=${PROJECT_BINARY_DIR}" +# "-DLINPHONESDK_MACOS_ARCHS=${LINPHONESDK_MACOS_ARCHS}" +# "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/linphone-sdk/mac" +# "-DENABLE_FAT_BINARY=${ENABLE_FAT_BINARY}" +# "-P" "${PROJECT_SOURCE_DIR}/cmake/macos/GenerateFrameworks.cmake" +# DEPENDS ${_MACOS_TARGETS} +# WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +# COMMENT "Aggregating frameworks of all architectures" +# USES_TERMINAL +#) + + +############################################################################ +# Generate the SDK +############################################################################ + +#list(GET _MACOS_ARCHS 0 _FIRST_ARCH) +#add_custom_target(sdk ALL +# COMMAND "${CMAKE_COMMAND}" +# "-DLINPHONESDK_PLATFORM=${LINPHONESDK_PLATFORM}" +# "-DLINPHONESDK_DIR=${PROJECT_SOURCE_DIR}" +# "-DLINPHONESDK_BUILD_DIR=${PROJECT_BINARY_DIR}" +# "-DLINPHONESDK_VERSION=${LINPHONESDK_VERSION}" +# "-DLINPHONESDK_ENABLED_FEATURES_FILENAME=${CMAKE_BINARY_DIR}/enabled_features.txt" +# "-DLINPHONESDK_MACOS_ARCHS=${LINPHONESDK_MACOS_ARCHS}" +# "-DLINPHONESDK_MACOS_BASE_URL=${LINPHONESDK_MACOS_BASE_URL}" +# "-DENABLE_FAT_BINARY=${ENABLE_FAT_BINARY}" +# "-P" "${PROJECT_SOURCE_DIR}/cmake/macos/GenerateSDK.cmake" +# DEPENDS gen-frameworks +# WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +# COMMENT "Generating the SDK (zip file and podspec)" +# USES_TERMINAL +#) diff --git a/cmake/toolchains/toolchain-mac-arm64.cmake b/cmake/toolchains/toolchain-mac-arm64.cmake new file mode 100644 index 000000000..213974cc1 --- /dev/null +++ b/cmake/toolchains/toolchain-mac-arm64.cmake @@ -0,0 +1,24 @@ +################################################################################ +# +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ +message(FATAL_ERROR A) +set(CMAKE_SYSTEM_PROCESSOR "arm64") +set(CMAKE_OSX_ARCHITECTURES "arm64") +set(CLANG_TARGET "arm64-apple-macos") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-mac-common.cmake") diff --git a/cmake/toolchains/toolchain-mac-common.cmake b/cmake/toolchains/toolchain-mac-common.cmake new file mode 100644 index 000000000..369eb45ab --- /dev/null +++ b/cmake/toolchains/toolchain-mac-common.cmake @@ -0,0 +1,106 @@ +############################################################################ +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +############################################################################ + +# Building for Mac is only available under APPLE systems +if(NOT APPLE) + message(FATAL_ERROR "You need to build using a Mac OS X system") +endif() +execute_process(COMMAND xcode-select -print-path + RESULT_VARIABLE XCODE_SELECT_RESULT + OUTPUT_VARIABLE XCODE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if(NOT ${XCODE_SELECT_RESULT} EQUAL 0) + message(FATAL_ERROR "xcode-select failed: ${XCODE_SELECT_RESULT}. You may need to install Xcode.") +endif() + +execute_process(COMMAND xcrun --sdk macosx --show-sdk-version + RESULT_VARIABLE XCRUN_SHOW_SDK_VERSION_RESULT + OUTPUT_VARIABLE MACOS_SDK_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if(NOT ${XCRUN_SHOW_SDK_VERSION_RESULT} EQUAL 0) + message(FATAL_ERROR "xcrun failed: ${XCRUN_SHOW_SDK_VERSION_RESULT}. You may need to install Xcode.") +endif() + +execute_process(COMMAND xcrun --sdk macosx --show-sdk-platform-path + RESULT_VARIABLE XCRUN_SHOW_SDK_PATH_RESULT + OUTPUT_VARIABLE CMAKE_OSX_SYSROOT + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if(NOT ${XCRUN_SHOW_SDK_PATH_RESULT} EQUAL 0) + message(FATAL_ERROR "xcrun failed: ${XCRUN_SHOW_SDK_PATH_RESULT}. You may need to install Xcode.") +endif() +set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}/Developer/SDKs/MacOSX.sdk") + +execute_process(COMMAND xcrun --sdk macosx --find clang + RESULT_VARIABLE XCRUN_FIND_CLANG_RESULT + OUTPUT_VARIABLE CLANG_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if(NOT ${XCRUN_FIND_CLANG_RESULT} EQUAL 0) + message(FATAL_ERROR "xcrun failed: ${XCRUN_FIND_CLANG_RESULT}. You may need to install Xcode.") +endif() +get_filename_component(TOOLCHAIN_PATH "${CLANG_PATH}" DIRECTORY) + +message(STATUS "Using sysroot path: ${CMAKE_OSX_SYSROOT}") +message(STATUS "Using sdk version: ${MACOS_SDK_VERSION}") +set(SDK_BIN_PATH "${CMAKE_OSX_SYSROOT}/../../usr/bin") + +set(TOOLCHAIN_CC "${TOOLCHAIN_PATH}/clang") +set(TOOLCHAIN_CXX "${TOOLCHAIN_PATH}/clang++") +set(TOOLCHAIN_OBJC "${TOOLCHAIN_PATH}/clang") +set(TOOLCHAIN_LD "${TOOLCHAIN_PATH}/ld") +set(TOOLCHAIN_AR "${TOOLCHAIN_PATH}/ar") +set(TOOLCHAIN_RANLIB "${TOOLCHAIN_PATH}/ranlib") +set(TOOLCHAIN_STRIP "${TOOLCHAIN_PATH}/strip") +set(TOOLCHAIN_NM "${TOOLCHAIN_PATH}/nm") + +execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERSION_RAW OUTPUT_STRIP_TRAILING_WHITESPACE) +STRING(REGEX REPLACE "Xcode ([^\n]*).*" "\\1" XCODE_VERSION "${XCODE_VERSION_RAW}") + +include(CMakeForceCompiler) + +set(CMAKE_CROSSCOMPILING FALSE) + +# Define name of the target system +set(CMAKE_SYSTEM_NAME "Darwin") +set(CMAKE_SYSTEM_VERSION ${MACOS_SDK_VERSION}) + +# The following variables are needed to build correctly with Xcode +if(CMAKE_GENERATOR STREQUAL "Xcode") + set(CMAKE_MACOSX_BUNDLE NO)#if YES, cmake try_compile will not be able to test executable.app and then API info will fail. + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO) + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) + set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode") +endif() + +# Define the compiler +set(CMAKE_C_COMPILER "${TOOLCHAIN_CC}") +set(CMAKE_C_COMPILER_TARGET "${CLANG_TARGET}") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_CXX}") +set(CMAKE_CXX_COMPILER_TARGET "${CLANG_TARGET}") +set(CMAKE_AR "${TOOLCHAIN_AR}" CACHE FILEPATH "ar") +set(CMAKE_RANLIB "${TOOLCHAIN_RANLIB}" CACHE FILEPATH "ranlib") +set(CMAKE_LINKER "${TOOLCHAIN_LD}" CACHE FILEPATH "linker") +set(CMAKE_NM "${TOOLCHAIN_NM}" CACHE FILEPATH "nm") + +set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT} ${CMAKE_INSTALL_PREFIX}) + +#important: the GUI identifier is required so that executables can be launched on simulators +set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.linphone.\${PRODUCT_NAME:identifier}") diff --git a/cmake/toolchains/toolchain-mac-x86_64.cmake b/cmake/toolchains/toolchain-mac-x86_64.cmake new file mode 100644 index 000000000..baba3c760 --- /dev/null +++ b/cmake/toolchains/toolchain-mac-x86_64.cmake @@ -0,0 +1,24 @@ +################################################################################ +# +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ + +set(CMAKE_SYSTEM_PROCESSOR "x86_64") +set(CMAKE_OSX_ARCHITECTURES "x86_64") +set(CLANG_TARGET "x86_64-apple-darwin") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-mac-common.cmake") diff --git a/cmake/toolchains/toolchain-uwp-common.cmake b/cmake/toolchains/toolchain-uwp-common.cmake new file mode 100644 index 000000000..a2a7a32ae --- /dev/null +++ b/cmake/toolchains/toolchain-uwp-common.cmake @@ -0,0 +1,26 @@ +############################################################################ +# toolchain-uwp-common.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +############################################################################ + +set(CMAKE_CROSSCOMPILING TRUE) + +set(CMAKE_SYSTEM_NAME "WindowsStore") +set(CMAKE_SYSTEM_VERSION "10.0") + +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE) +set(CMAKE_VS_WINRT_BY_DEFAULT TRUE) diff --git a/cmake/toolchains/toolchain-uwp-x64.cmake b/cmake/toolchains/toolchain-uwp-x64.cmake new file mode 100644 index 000000000..b45bfe542 --- /dev/null +++ b/cmake/toolchains/toolchain-uwp-x64.cmake @@ -0,0 +1,22 @@ +################################################################################ +# toolchain-uwp-x64.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ + +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-uwp-common.cmake") diff --git a/cmake/toolchains/toolchain-uwp-x86.cmake b/cmake/toolchains/toolchain-uwp-x86.cmake new file mode 100644 index 000000000..f887f1f5b --- /dev/null +++ b/cmake/toolchains/toolchain-uwp-x86.cmake @@ -0,0 +1,22 @@ +################################################################################ +# toolchain-uwp-x86.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ + +set(CMAKE_SYSTEM_PROCESSOR "x86") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-uwp-common.cmake") diff --git a/cmake/toolchains/toolchain-windows-store-common.cmake b/cmake/toolchains/toolchain-windows-store-common.cmake new file mode 100644 index 000000000..5853f7e50 --- /dev/null +++ b/cmake/toolchains/toolchain-windows-store-common.cmake @@ -0,0 +1,31 @@ +############################################################################ +# toolchain-windows-store-common.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +############################################################################ + +set(CMAKE_C_STANDARD_LIBRARIES "WindowsApp.lib ${CMAKE_C_STANDARD_LIBRARIES}") +set(CMAKE_CXX_STANDARD_LIBRARIES "WindowsApp.lib ${CMAKE_CXX_STANDARD_LIBRARIES}") + +set(CMAKE_EXE_LINKER_FLAGS_INIT "/APPCONTAINER") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "/APPCONTAINER") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "/APPCONTAINER") + + +add_compile_definitions("ENABLE_MICROSOFT_STORE_APP" "_WIN32_WINNT=0x0A00") + + +link_directories(BEFORE ${MICROSOFT_STORE_LINK_PATHS}) diff --git a/cmake/toolchains/toolchain-windows-store-x64.cmake b/cmake/toolchains/toolchain-windows-store-x64.cmake new file mode 100644 index 000000000..e20c82ff7 --- /dev/null +++ b/cmake/toolchains/toolchain-windows-store-x64.cmake @@ -0,0 +1,23 @@ +################################################################################ +# toolchain-windows-store-x64.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ + +# set(CMAKE_SYSTEM_PROCESSOR "x86_64") +set(MICROSOFT_STORE_LINK_PATHS "\$(WindowsSDK_LibraryPath_x64);\$(NETFXKitsDir)Lib\\um\\x64;\$(VC_LibraryPath_VC_x64_store);\$(VC_ReferencesPath_ATL_x64);\$(VC_LibraryPath_VC_x64);\$(VC_LibraryPath_x64);\$(VC_VS_LibraryPath_VC_VS_x64);\$(LibraryPath);\$(VC_LibraryPath_VC_x64_store)\\references") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-windows-store-common.cmake") diff --git a/cmake/toolchains/toolchain-windows-store-x86.cmake b/cmake/toolchains/toolchain-windows-store-x86.cmake new file mode 100644 index 000000000..257b86948 --- /dev/null +++ b/cmake/toolchains/toolchain-windows-store-x86.cmake @@ -0,0 +1,23 @@ +################################################################################ +# toolchain-windows-store-x86.cmake +# Copyright (c) 2021-2023 Belledonne Communications SARL. +# +# 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 3 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, see . +# +################################################################################ + +# set(CMAKE_SYSTEM_PROCESSOR "x86") +set(MICROSOFT_STORE_LINK_PATHS "\$(WindowsSDK_LibraryPath_x86);\$(NETFXKitsDir)Lib\\um\\x86;\$(VC_LibraryPath_VC_x86_store);\$(VC_ReferencesPath_ATL_x86);\$(VC_LibraryPath_VC_x86);\$(VC_LibraryPath_x86);\$(VC_VS_LibraryPath_VC_VS_x86);\$(LibraryPath);\$(VC_LibraryPath_VC_x86_store)\\references") + +include("${CMAKE_CURRENT_LIST_DIR}/toolchain-windows-store-common.cmake") diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index ecb9aa745..96f83e7c7 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -23,9 +23,9 @@ cmake_minimum_required(VERSION 3.22) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -find_package(BcToolbox) -if(NOT BCTOOLBOX_FOUND) +set(LINPHONE_TARGETS) +find_package(BCToolbox) +if(NOT BCToolbox_FOUND) find_package(bctoolbox CONFIG) endif() set(FULL_VERSION ) @@ -64,6 +64,10 @@ list(APPEND CMAKE_MODULE_PATH "${LINPHONE_OUTPUT_DIR}/lib/cmake") list(APPEND CMAKE_PREFIX_PATH "${QTKEYCHAIN_OUTPUT_DIR}/lib64/cmake") list(APPEND CMAKE_PREFIX_PATH "${QTKEYCHAIN_OUTPUT_DIR}/lib/cmake") +if(APPLE) + list(APPEND CMAKE_FRAMEWORK_PATH "${LINPHONE_OUTPUT_DIR}/Frameworks") +endif() + set(APP_LIBRARY app-library) set(APP_PLUGIN app-plugin) include(application_info.cmake) @@ -86,33 +90,33 @@ if(WIN32) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${EXECUTABLE_OUTPUT_DIR} ) endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) endif() +if(TARGET sdk)#if not exist, this build is coming from crosscompiling (aka already dependent of sdk) + list(APPEND LINPHONE_TARGETS sdk) + set(LINPHONE_PACKAGES Belr Belcard Ortp Mediastreamer2 BelleSIP Linphone LinphoneCxx) +endif() -find_package(Ortp) -if(NOT ORTP_FOUND) - find_package(ortp CONFIG) -endif() -find_package(Mediastreamer2) -if(NOT MEDIASTREAMER2_FOUND) - find_package(Mediastreamer2 CONFIG) -endif() -find_package(Belcard) -if(NOT BELCARD_FOUND) - find_package(belcard CONFIG) -endif() -find_package(Linphone) -if(NOT LINPHONE_FOUND) - find_package(Linphone CONFIG) -endif() -find_package(LinphoneCxx) -if(NOT LINPHONECXX_FOUND) - find_package(LinphoneCxx CONFIG) +set(ENABLE_ADVANCED_IM ON CACHE BOOLEAN "Enable IM") +set(ENABLE_DB_STORAGE ON CACHE BOOLEAN "Enable Storage") + +if(ENABLE_ADVANCED_IM OR ENABLE_DB_STORAGE OR ENABLE_PQCRYPTO) + list(PREPEND LINPHONE_PACKAGES Lime) endif() +foreach(PACKAGE ${LINPHONE_PACKAGES}) + message(STATUS "Trying to find ${PACKAGE}") + find_package(${PACKAGE}) + if(NOT ${PACKAGE}_FOUND) + find_package(${PACKAGE} CONFIG) + endif() +endforeach() + + if(ENABLE_QT_KEYCHAIN) find_package(QtKeychain) if(NOT QtKeychain_FOUND) find_package(${QTKEYCHAIN_TARGET_NAME} CONFIG REQUIRED) endif() + add_compile_definitions("ENABLE_QT_KEYCHAIN") if(QtKeychain_USE_BUILD_INTERFACE) add_compile_definitions("QTKEYCHAIN_USE_BUILD_INTERFACE") @@ -640,14 +644,13 @@ if(ENABLE_BUILD_VERBOSE)#useful to copy these Paths to QML previewers message("QML_IMPORT_PATH=${QML_IMPORT_PATH}" ) message("Qt5 Paths : Qt5_DIR=$ENV{Qt5_DIR}, PATH=$ENV{PATH}") endif() -if(APPLE) - if(MS2_PLUGINS_LOCATION) - set(MSPLUGINS_DIR ${MS2_PLUGINS_LOCATION}) - else() - set(MSPLUGINS_DIR "Frameworks/mediastreamer2.framework/Versions/A/Libraries") - endif() + +if(MEDIASTREAMER2_PLUGINS_LOCATION) + set(MSPLUGINS_DIR ${MEDIASTREAMER2_PLUGINS_LOCATION}) +elseif(APPLE) + set(MSPLUGINS_DIR "Frameworks/mediastreamer2.framework/Versions/A/Libraries") else() - set(MSPLUGINS_DIR "plugins/mediastreamer") + set(MSPLUGINS_DIR "${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins") endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") # ------------------------------------------------------------------------------ @@ -715,14 +718,13 @@ endif() target_compile_definitions(${APP_PLUGIN} PUBLIC "-DENABLE_APP_EXPORT_PLUGIN") set_target_properties(${APP_PLUGIN} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) -list(APPEND INCLUDED_DIRECTORIES "${LINPHONECXX_INCLUDE_DIRS}" "${MEDIASTREAMER2_INCLUDE_DIRS}") +list(APPEND INCLUDED_DIRECTORIES "${LINPHONECXX_INCLUDE_DIRS}" "${BCToolbox_INCLUDE_DIRS}" "${MEDIASTREAMER2_INCLUDE_DIRS}") list(APPEND INCLUDED_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/include") -set(LIBRARIES_LIST ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${OPUS_LIBRARIES}) +set(LIBRARIES_LIST ${BCToolbox_CORE_LIBRARIES} ${Belr_LIBRARIES} ${Belcard_LIBRARIES} ${BelleSIP_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${OPUS_LIBRARIES}) if(ENABLE_QT_KEYCHAIN) - list(APPEND INCLUDED_DIRECTORIES ${QtKeyChain_INCLUDE_DIRS}) - list(APPEND LIBRARIES_LIST ${QtKeyChain_LIBRARIES}) + list(APPEND LIBRARIES_LIST ${QtKeychain_LIBRARIES}) endif() list(APPEND LIBRARIES ${LIBRARIES_LIST}) @@ -751,8 +753,20 @@ if(ENABLE_QT_KEYCHAIN) endif() +function(add_framework_library FW_NAME) + find_library(FRAMEWORK_${FW_NAME} NAMES ${FW_NAME} PATHS ${LINPHONE_OUTPUT_DIR} PATH_SUFFIXES Frameworks NO_DEFAULT_PATH) + message(STATUS "Found: ${FRAMEWORK_${FW_NAME}}/${FW_NAME} / ${FW_NAME}") + + set(LIBRARIES ${LIBRARIES} "${FRAMEWORK_${FW_NAME}}/${FW_NAME}" PARENT_SCOPE) +endfunction() + if (APPLE) - list(APPEND LIBRARIES "-framework Cocoa -framework IOKit -framework AVFoundation") + list(APPEND LIBRARIES "-framework Cocoa" "-framework IOKit" "-framework AVFoundation") + add_framework_library(linphone++) + add_framework_library(belcard) + add_framework_library(bctoolbox) + add_framework_library(linphone) + add_framework_library(mediastreamer2) # -framework linphone") #This doesn't work yet endif () @@ -760,6 +774,16 @@ target_include_directories(${APP_LIBRARY} SYSTEM PUBLIC ${INCLUDED_DIRECTORIES}) target_include_directories(${APP_PLUGIN} SYSTEM PUBLIC ${INCLUDED_DIRECTORIES}) target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${INCLUDED_DIRECTORIES}) +if(ENABLE_QT_KEYCHAIN) + target_include_directories(${APP_LIBRARY} SYSTEM PUBLIC $) + target_include_directories(${APP_PLUGIN} SYSTEM PUBLIC $) + target_include_directories(${TARGET_NAME} SYSTEM PUBLIC $) +endif() + +link_directories(BEFORE "${LINPHONE_OUTPUT_DIR}/lib") +target_link_directories(${APP_LIBRARY} PUBLIC "${LINPHONE_OUTPUT_DIR}/lib") +target_link_directories(${APP_PLUGIN} PUBLIC "${LINPHONE_OUTPUT_DIR}/lib") + target_link_libraries(${APP_LIBRARY} ${LIBRARIES}) target_link_libraries(${APP_PLUGIN} ${LIBRARIES}) target_link_libraries(${APP_LIBRARY} ${APP_PLUGIN}) @@ -771,6 +795,9 @@ if(WIN32 AND ENABLE_LDAP) target_link_libraries(${TARGET_NAME} wsock32 ws2_32 ${OPENLDAP_LIBRARIES}) endif() +add_dependencies(${APP_LIBRARY} ${LINPHONE_TARGETS}) +add_dependencies(${APP_PLUGIN} ${LINPHONE_TARGETS}) + add_dependencies(${APP_LIBRARY} update_translations ${TARGET_NAME}-git-version ${APP_PLUGIN}) add_dependencies(${TARGET_NAME} ${APP_LIBRARY} ${APP_PLUGIN}) @@ -798,9 +825,9 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" DESTINATION ".") add_subdirectory(build) -# GMA: TODO add_subdirectory(cmake_builder/linphone_package) +add_subdirectory(cmake_builder/linphone_package) -# GMA: TODO deployqt_hack(${TARGET_NAME} ${LINPHONE_QML_DIR}) +deployqt_hack(${TARGET_NAME} ${LINPHONE_QML_DIR}) # ------------------------------------------------------------------------------ diff --git a/linphone-app/cmake/FindBCToolbox.cmake b/linphone-app/cmake/FindBCToolbox.cmake new file mode 100644 index 000000000..e97c88dd0 --- /dev/null +++ b/linphone-app/cmake/FindBCToolbox.cmake @@ -0,0 +1,76 @@ +############################################################################ +# FindBctoolbox.cmake +# Copyright (C) 2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ +# +# - Find the bctoolbox include files and library +# LINPHONE_TARGETS - Add usable targets into this list. +# BCToolbox_FOUND - System has lib bctoolbox +# BCToolbox_INCLUDE_DIRS - The bctoolbox include directories +# BCToolbox_LIBRARIES - The libraries needed to use bctoolbox +# BCToolbox_CMAKE_DIR - The bctoolbox cmake directory +# BCToolbox_CORE_FOUND - System has core bctoolbox +# BCToolbox_CORE_INCLUDE_DIRS - The core bctoolbox include directories +# BCToolbox_CORE_LIBRARIES - The core bctoolbox libraries +# BCToolbox_TESTER_FOUND - System has bctoolbox tester +# BCToolbox_TESTER_INCLUDE_DIRS - The bctoolbox tester include directories +# BCToolbox_TESTER_LIBRARIES - The bctoolbox tester libraries + +if(NOT TARGET bctoolbox) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + set(BCToolbox_CMAKE_DIR ${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/bctoolbox/cmake) + include(${BCToolbox_CMAKE_DIR}/bctoolboxTargets.cmake) +else() + get_target_property(BCToolbox_SOURCE_DIR bctoolbox SOURCE_DIR) + set(BCToolbox_CMAKE_DIR "${BCToolbox_SOURCE_DIR}/../cmake") +endif() + +if(TARGET bctoolbox) + list(APPEND LINPHONE_TARGETS bctoolbox) + include(${BCToolbox_CMAKE_DIR}/BCToolboxCMakeUtils.cmake) + set(BCToolbox_CORE_LIBRARIES bctoolbox) + get_target_property(BCToolbox_CORE_INCLUDE_DIRS bctoolbox INTERFACE_INCLUDE_DIRECTORIES) + set(BCToolbox_CORE_FOUND TRUE) + + if(TARGET bctoolbox-tester) + set(BCToolbox_TESTER_LIBRARIES bctoolbox-tester) + get_target_property(BCToolbox_TESTER_INCLUDE_DIRS bctoolbox-tester INTERFACE_INCLUDE_DIRECTORIES) + set(BCToolbox_TESTER_FOUND TRUE) + set(BCToolbox_TESTER_COMPONENT_VARIABLES BCToolbox_TESTER_FOUND BCToolbox_TESTER_INCLUDE_DIRS BCToolbox_TESTER_LIBRARIES) + endif() + set(BCToolbox_LIBRARIES ${BCToolbox_CORE_LIBRARIES} ${BCToolbox_TESTER_LIBRARIES}) + set(BCToolbox_INCLUDE_DIRS ${BCToolbox_CORE_INCLUDE_DIRS} ${BCToolbox_TESTER_INCLUDE_DIRS}) + + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BCToolbox + DEFAULT_MSG + BCToolbox_INCLUDE_DIRS BCToolbox_LIBRARIES BCToolbox_CMAKE_DIR + BCToolbox_CORE_FOUND BCToolbox_CORE_INCLUDE_DIRS BCToolbox_CORE_LIBRARIES + ${BCToolbox_TESTER_COMPONENT_VARIABLES} + ) + + mark_as_advanced( + BCToolbox_INCLUDE_DIRS BCToolbox_LIBRARIES BCToolbox_CMAKE_DIR + BCToolbox_CORE_FOUND BCToolbox_CORE_INCLUDE_DIRS BCToolbox_CORE_LIBRARIES + ${BCToolbox_TESTER_COMPONENT_VARIABLES} + ) +endif() \ No newline at end of file diff --git a/linphone-app/cmake/FindBcToolbox.cmake b/linphone-app/cmake/FindBcToolbox.cmake deleted file mode 100644 index 57664786f..000000000 --- a/linphone-app/cmake/FindBcToolbox.cmake +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################ -# FindBctoolbox.cmake -# Copyright (C) 2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -############################################################################ -# -# - Find the bctoolbox include files and library -# -# BCTOOLBOX_FOUND - System has lib bctoolbox -# BCTOOLBOX_INCLUDE_DIRS - The bctoolbox include directories -# BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox -# BCTOOLBOX_CMAKE_DIR - The bctoolbox cmake directory -# BCTOOLBOX_CORE_FOUND - System has core bctoolbox -# BCTOOLBOX_CORE_INCLUDE_DIRS - The core bctoolbox include directories -# BCTOOLBOX_CORE_LIBRARIES - The core bctoolbox libraries -# BCTOOLBOX_TESTER_FOUND - System has bctoolbox tester -# BCTOOLBOX_TESTER_INCLUDE_DIRS - The bctoolbox tester include directories -# BCTOOLBOX_TESTER_LIBRARIES - The bctoolbox tester libraries - -if(TARGET bctoolbox) - - set(BCTOOLBOX_CORE_LIBRARIES bctoolbox) - get_target_property(BCTOOLBOX_CORE_INCLUDE_DIRS bctoolbox INTERFACE_INCLUDE_DIRECTORIES) - set(BCTOOLBOX_CORE_FOUND TRUE) - get_target_property(BCTOOLBOX_SOURCE_DIR bctoolbox SOURCE_DIR) - set(BCTOOLBOX_CMAKE_DIR "${BCTOOLBOX_SOURCE_DIR}/../cmake") - if(TARGET bctoolbox-tester) - set(BCTOOLBOX_TESTER_LIBRARIES bctoolbox-tester) - get_target_property(BCTOOLBOX_TESTER_INCLUDE_DIRS bctoolbox-tester INTERFACE_INCLUDE_DIRECTORIES) - set(BCTOOLBOX_TESTER_FOUND TRUE) - set(BCTOOLBOX_TESTER_COMPONENT_VARIABLES BCTOOLBOX_TESTER_FOUND BCTOOLBOX_TESTER_INCLUDE_DIRS BCTOOLBOX_TESTER_LIBRARIES) - endif() - set(BCTOOLBOX_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES}) - set(BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS} ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(BcToolbox - DEFAULT_MSG - BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR - BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES - ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} - ) - - mark_as_advanced( - BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR - BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES - ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} - ) - -endif() diff --git a/linphone-app/cmake/FindBelcard.cmake b/linphone-app/cmake/FindBelcard.cmake index f5a26151c..06f634652 100644 --- a/linphone-app/cmake/FindBelcard.cmake +++ b/linphone-app/cmake/FindBelcard.cmake @@ -22,22 +22,29 @@ # # - Find the belcard include files and library # -# BELCARD_FOUND - system has lib belcard -# BELCARD_INCLUDE_DIRS - the belcard include directory -# BELCARD_LIBRARIES - The library needed to use belcard +# LINPHONE_TARGETS - Add usable targets into this list. +# Belcard_FOUND - system has lib belcard +# Belcard_INCLUDE_DIRS - the belcard include directory +# Belcard_LIBRARIES - The library needed to use belcard + +if(NOT TARGET belcard) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/belcard/cmake/belcardTargets.cmake) +endif() if(TARGET belcard) - - set(BELCARD_LIBRARIES belcard) - get_target_property(BELCARD_INCLUDE_DIRS belcard INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND LINPHONE_TARGETS belcard) + set(Belcard_LIBRARIES belcard) + get_target_property(Belcard_INCLUDE_DIRS belcard INTERFACE_INCLUDE_DIRECTORIES) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Belcard DEFAULT_MSG - BELCARD_INCLUDE_DIRS BELCARD_LIBRARIES + Belcard_INCLUDE_DIRS Belcard_LIBRARIES ) - mark_as_advanced(BELCARD_INCLUDE_DIRS BELCARD_LIBRARIES) - + mark_as_advanced(Belcard_INCLUDE_DIRS Belcard_LIBRARIES) + endif() diff --git a/linphone-app/cmake/FindBelleSIP.cmake b/linphone-app/cmake/FindBelleSIP.cmake new file mode 100644 index 000000000..d87c90fba --- /dev/null +++ b/linphone-app/cmake/FindBelleSIP.cmake @@ -0,0 +1,51 @@ +############################################################################ +# FindBelr.cmake +# Copyright (C) 2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ +# +# - Find the belcard include files and library +# +# LINPHONE_TARGETS - Add usable targets into this list. +# BelleSIP_FOUND - system has lib belcard +# BelleSIP_INCLUDE_DIRS - the belcard include directory +# BelleSIP_LIBRARIES - The library needed to use belcard + +if(NOT TARGET belle-sip) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake/BelleSIP/BelleSIPTargets.cmake) +endif() + +if(TARGET belle-sip) + list(APPEND LINPHONE_TARGETS belle-sip) + + set(BelleSIP_LIBRARIES belle-sip) + get_target_property(BelleSIP_INCLUDE_DIRS belle-sip INTERFACE_INCLUDE_DIRECTORIES) + + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BelleSIP + DEFAULT_MSG + BelleSIP_INCLUDE_DIRS BelleSIP_LIBRARIES + ) + + mark_as_advanced(BelleSIP_INCLUDE_DIRS BelleSIP_LIBRARIES) + +endif() diff --git a/linphone-app/cmake/FindBelr.cmake b/linphone-app/cmake/FindBelr.cmake new file mode 100644 index 000000000..5ac897c2d --- /dev/null +++ b/linphone-app/cmake/FindBelr.cmake @@ -0,0 +1,51 @@ +############################################################################ +# FindBelr.cmake +# Copyright (C) 2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ +# +# - Find the belcard include files and library +# +# LINPHONE_TARGETS - Add usable targets into this list. +# Belr_FOUND - system has lib belcard +# Belr_INCLUDE_DIRS - the belcard include directory +# Belr_LIBRARIES - The library needed to use belcard + +if(NOT TARGET belr) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake/belr/belrTargets.cmake) +endif() + +if(TARGET belr) + list(APPEND LINPHONE_TARGETS belr) + + set(Belr_LIBRARIES belr) + get_target_property(Belr_INCLUDE_DIRS belr INTERFACE_INCLUDE_DIRECTORIES) + + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Belr + DEFAULT_MSG + Belr_INCLUDE_DIRS Belr_LIBRARIES + ) + + mark_as_advanced(Belr_INCLUDE_DIRS Belr_LIBRARIES) + +endif() diff --git a/linphone-app/cmake/FindLime.cmake b/linphone-app/cmake/FindLime.cmake new file mode 100644 index 000000000..b40052952 --- /dev/null +++ b/linphone-app/cmake/FindLime.cmake @@ -0,0 +1,48 @@ +############################################################################ +# FindLime.cmake +# Copyright (C) 2023 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ +# +# - Find the belcard include files and library +# +# LINPHONE_TARGETS - Add usable targets into this list. +# Lime_FOUND - system has lib belcard +# Lime_INCLUDE_DIRS - the belcard include directory +# Lime_LIBRARIES - The library needed to use belcard + +if(NOT TARGET lime) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/lime/cmake/limeTargets.cmake) +endif() + +if(TARGET lime) + list(APPEND LINPHONE_TARGETS lime) + set(Lime_LIBRARIES lime) + get_target_property(Lime_INCLUDE_DIRS lime INTERFACE_INCLUDE_DIRECTORIES) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Lime + DEFAULT_MSG + Lime_INCLUDE_DIRS Lime_LIBRARIES + ) + + mark_as_advanced(Lime_INCLUDE_DIRS Lime_LIBRARIES) +endif() diff --git a/linphone-app/cmake/FindLinphone.cmake b/linphone-app/cmake/FindLinphone.cmake index ecaa95a59..627e719e0 100644 --- a/linphone-app/cmake/FindLinphone.cmake +++ b/linphone-app/cmake/FindLinphone.cmake @@ -22,15 +22,23 @@ # # - Find the linphone include files and library # +# LINPHONE_TARGETS - Add usable targets into this list. # LINPHONE_FOUND - system has lib linphone # LINPHONE_INCLUDE_DIRS - the linphone include directory # LINPHONE_LIBRARIES - The library needed to use linphone +# LINPHONE_LIBRARY_OUTPUT_DIRECTORY - Output directory for likbraries + +if(NOT TARGET liblinphone) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/linphone/cmake/linphoneTargets.cmake) +endif() if(TARGET liblinphone) + list(APPEND LINPHONE_TARGETS liblinphone) set(LINPHONE_LIBRARIES liblinphone) - get_target_property(LINPHONE_INCLUDE_DIRS liblinphone INTERFACE_INCLUDE_DIRECTORIES) - + get_target_property(LINPHONE_INCLUDE_DIRS liblinphone INTERFACE_INCLUDE_DIRECTORIES) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Linphone diff --git a/linphone-app/cmake/FindLinphoneCxx.cmake b/linphone-app/cmake/FindLinphoneCxx.cmake index 3925915a1..51ee39222 100644 --- a/linphone-app/cmake/FindLinphoneCxx.cmake +++ b/linphone-app/cmake/FindLinphoneCxx.cmake @@ -22,12 +22,19 @@ # # - Find the linphonecxx include files and library # +# LINPHONE_TARGETS - Add usable targets into this list. # LINPHONECXX_FOUND - system has lib linphonecxx # LINPHONECXX_INCLUDE_DIRS - the linphonecxx include directory # LINPHONECXX_LIBRARIES - The library needed to use linphonecxx -if(TARGET liblinphone++) +if(NOT TARGET liblinphone++) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/LinphoneCxx/cmake/LinphoneCxxTargets.cmake) +endif() +if(TARGET liblinphone++) + list(APPEND LINPHONE_TARGETS liblinphone++) set(LINPHONECXX_LIBRARIES liblinphone++) get_target_property(LINPHONECXX_INCLUDE_DIRS liblinphone++ INTERFACE_INCLUDE_DIRECTORIES) diff --git a/linphone-app/cmake/FindMediastreamer2.cmake b/linphone-app/cmake/FindMediastreamer2.cmake index 64ac8f284..b71a03fdd 100644 --- a/linphone-app/cmake/FindMediastreamer2.cmake +++ b/linphone-app/cmake/FindMediastreamer2.cmake @@ -22,19 +22,25 @@ # # - Find the mediastreamer2 include files and library # +# LINPHONE_TARGETS - Add usable targets into this list. # MEDIASTREAMER2_FOUND - system has lib mediastreamer2 # MEDIASTREAMER2_INCLUDE_DIRS - the mediasteamer2 include directory # MEDIASTREAMER2_LIBRARIES - The library needed to use mediasteamer2 # MEDIASTREAMER2_PLUGINS_LOCATION - The location of the mediastreamer2 plugins -if(TARGET mediastreamer2) +if(NOT TARGET mediastreamer2) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_DATADIR}/Mediastreamer2/cmake/Mediastreamer2Targets.cmake) +endif() +if(TARGET mediastreamer2) + list(APPEND LINPHONE_TARGETS mediastreamer2) set(MEDIASTREAMER2_LIBRARIES mediastreamer2) get_target_property(MEDIASTREAMER2_INCLUDE_DIRS mediastreamer2 INTERFACE_INCLUDE_DIRECTORIES) define_property(TARGET PROPERTY "MS2_PLUGINS" BRIEF_DOCS "Stores the location of mediastreamer2 plugins" FULL_DOCS "Stores the location of mediastreamer2 plugins") get_target_property(MEDIASTREAMER2_PLUGINS_LOCATION mediastreamer2 MS2_PLUGINS) - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Mediastreamer2 DEFAULT_MSG diff --git a/linphone-app/cmake/FindOpenLDAP.cmake b/linphone-app/cmake/FindOpenLDAP.cmake index 8fc1b0063..65a4207c2 100644 --- a/linphone-app/cmake/FindOpenLDAP.cmake +++ b/linphone-app/cmake/FindOpenLDAP.cmake @@ -20,12 +20,13 @@ # # - Find the OpenLDAP include file and library # +# LINPHONE_TARGETS - Add usable targets into this list. # OPENLDAP_FOUND - system has OpenLDAP # OPENLDAP_INCLUDE_DIRS - the OpenLDAP include directory # OPENLDAP_LIBRARIES - The libraries needed to use OpenLDAP if(TARGET ldap) - + list(APPEND LINPHONE_TARGETS ldap) set(OPENLDAP_LIBRARIES ldap) get_target_property(OPENLDAP_INCLUDE_DIRS ldap INTERFACE_INCLUDE_DIRECTORIES) diff --git a/linphone-app/cmake/FindOrtp.cmake b/linphone-app/cmake/FindOrtp.cmake index 13121fb4a..423feed6d 100644 --- a/linphone-app/cmake/FindOrtp.cmake +++ b/linphone-app/cmake/FindOrtp.cmake @@ -22,22 +22,27 @@ # # - Find the ortp include files and library # +# LINPHONE_TARGETS - Add usable targets into this list. # ORTP_FOUND - system has lib ortp # ORTP_INCLUDE_DIRS - the ortp include directory # ORTP_LIBRARIES - The library needed to use ortp +if(NOT TARGET ortp) + set(EXPORT_PATH ${LINPHONE_OUTPUT_DIR}) + include(GNUInstallDirs) + include(${EXPORT_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake/ortp/ortpTargets.cmake) +endif() if(TARGET ortp) + list(APPEND LINPHONE_TARGETS ortp) + set(ORTP_LIBRARIES ortp) + get_target_property(ORTP_INCLUDE_DIRS ortp INTERFACE_INCLUDE_DIRECTORIES) - set(ORTP_LIBRARIES ortp) - get_target_property(ORTP_INCLUDE_DIRS ortp INTERFACE_INCLUDE_DIRECTORIES) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Ortp + DEFAULT_MSG + ORTP_INCLUDE_DIRS ORTP_LIBRARIES + ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Ortp - DEFAULT_MSG - ORTP_INCLUDE_DIRS ORTP_LIBRARIES - ) - - mark_as_advanced(ORTP_INCLUDE_DIRS ORTP_LIBRARIES) + mark_as_advanced(ORTP_INCLUDE_DIRS ORTP_LIBRARIES) endif() diff --git a/linphone-app/cmake/FindQtKeychain.cmake b/linphone-app/cmake/FindQtKeychain.cmake index 81606cda7..20f18fd34 100644 --- a/linphone-app/cmake/FindQtKeychain.cmake +++ b/linphone-app/cmake/FindQtKeychain.cmake @@ -27,18 +27,15 @@ # QtKeychain_LIBRARIES - The library needed to use linphonecxx if(TARGET ${QTKEYCHAIN_TARGET_NAME}) - + list(APPEND LINPHONE_TARGETS ${QTKEYCHAIN_TARGET_NAME}) set(QtKeychain_LIBRARIES ${QTKEYCHAIN_TARGET_NAME}) get_target_property(QtKeychain_INCLUDE_DIRS ${QTKEYCHAIN_TARGET_NAME} INTERFACE_INCLUDE_DIRECTORIES) set(QtKeychain_USE_BUILD_INTERFACE TRUE) - - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QtKeychain DEFAULT_MSG QtKeychain_INCLUDE_DIRS QtKeychain_LIBRARIES ) - mark_as_advanced(QtKeychain_INCLUDE_DIRS QtKeychain_LIBRARIES) - endif() + diff --git a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt index 9c0a03b6e..447e3d6c8 100644 --- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt +++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt @@ -108,8 +108,18 @@ endif () # Specific deployment. # ============================================================================== set(APP_QT_CONF_DPI "1") -if (WIN32) - if(ENABLE_QT_KEYCHAIN) +if (WIN32) + file(GLOB LIB_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_BINDIR}/*.dll") + if( ENABLE_OPENH264)# Remove openH264 lib from the installation. this codec will be download by user + foreach(item ${LIB_FILES}) + get_filename_component(LIBRARY_FILENAME ${item} NAME) + if("${LIBRARY_FILENAME}" MATCHES "^openh264.*.dll$") + list(REMOVE_ITEM LIB_FILES ${item}) + endif() + endforeach(item) + endif() + +#[[ if(ENABLE_QT_KEYCHAIN) file(GLOB LIB_FILES "${QTKEYCHAIN_OUTPUT_DIR}/${CMAKE_INSTALL_BINDIR}/*.dll") install(FILES ${LIB_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/") endif() @@ -143,6 +153,7 @@ if (WIN32) if(ENABLE_APP_PACKAGE_ROOTCA) install(FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Linphone/rootca.pem" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}/") endif() +]] install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphonerc-factory" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}") set(APP_QT_CONF_DPI "0") set(APP_QT_CONF_PATH "") @@ -243,6 +254,7 @@ elseif (APPLE) endif () # install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_NAME}.app" DESTINATION "." USE_SOURCE_PERMISSIONS) else()# Not Windows and Apple +#[[ file(GLOB SHARED_LIBRARIES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/lib*.so") foreach (LIBRARY ${SHARED_LIBRARIES}) get_filename_component(LIBRARY_FILENAME ${LIBRARY} NAME) message("Changing RPATH of ${LIBRARY_FILENAME} from '${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}' to '$ORIGIN/../${CMAKE_INSTALL_LIBDIR}'") @@ -297,6 +309,7 @@ else()# Not Windows and Apple endif() file(GLOB PLUGINS_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins/*") install(FILES ${PLUGINS_FILES} DESTINATION "plugins/mediastreamer/" ) +]] # Install desktop/icon files. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphone.desktop.cmake" "${CMAKE_CURRENT_BINARY_DIR}/../../${EXECUTABLE_NAME}.desktop" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../../${EXECUTABLE_NAME}.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) @@ -361,6 +374,7 @@ endif () # ============================================================================== # CPack. # ============================================================================== + if(${ENABLE_APP_PACKAGING}) set(CPACK_BINARY_STGZ OFF) set(CPACK_BINARY_TGZ OFF) @@ -496,7 +510,7 @@ function(deployqt_hack target qml_dir) #Note: CMAKE_CURRENT_SOURCE_DIR point to linphone-app because deployqt_hack is called there. add_custom_command(TARGET ${target} POST_BUILD COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${CMAKE_CURRENT_SOURCE_DIR}/ui" "${qml_dir}" - WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/..") + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") if(NOT ENABLE_APP_WEBVIEW) set(RM_COMMAND "rm") if(CMAKE_VERSION VERSION_LESS 3.17) @@ -504,7 +518,7 @@ function(deployqt_hack target qml_dir) endif() add_custom_command(TARGET ${target} POST_BUILD COMMAND "${CMAKE_COMMAND}" "-E" "${RM_COMMAND}" "-f" "${qml_dir}/views/App/Main/Assistant/CreateAppSipAccountWithWebView.qml" - WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/..") + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") endif() if(WIN32) diff --git a/linphone-app/cmake_builder/linphone_package/packaging.cmake.in b/linphone-app/cmake_builder/linphone_package/packaging.cmake.in index 58fb129b7..6f3bd0b37 100644 --- a/linphone-app/cmake_builder/linphone_package/packaging.cmake.in +++ b/linphone-app/cmake_builder/linphone_package/packaging.cmake.in @@ -53,7 +53,7 @@ if (NOT "${CMAKE_INSTALL_PREFIX}" MATCHES .*/_CPack_Packages/.*) endif() endif() if(DO_GENERATOR) - execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G @CPACK_GENERATOR@ RESULT_VARIABLE CPACK_COMMAND_RESULT) + execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G @CPACK_GENERATOR@ -C @CMAKE_BUILD_TYPE@ RESULT_VARIABLE CPACK_COMMAND_RESULT) if(CPACK_COMMAND_RESULT) message(FATAL_ERROR "Failed to create @CPACK_GENERATOR@ package!") endif() diff --git a/linphone-app/src/components/search/SearchSipAddressesModel.cpp b/linphone-app/src/components/search/SearchSipAddressesModel.cpp index 6b5c54808..b9dc3c9b8 100644 --- a/linphone-app/src/components/search/SearchSipAddressesModel.cpp +++ b/linphone-app/src/components/search/SearchSipAddressesModel.cpp @@ -65,7 +65,7 @@ SearchSipAddressesModel::~SearchSipAddressesModel(){ void SearchSipAddressesModel::setFilter(const QString& filter){ if(!filter.isEmpty()){ mMagicSearch->setSearchLimit((int)CoreManager::getInstance()->getSettingsModel()->getMagicSearchMaxResults()); - mMagicSearch->getContactsListAsync(filter.toStdString(),"", (int)linphone::MagicSearchSource::All, linphone::MagicSearchAggregation::None); + mMagicSearch->getContactsListAsync(filter.toStdString(),"", (int)linphone::MagicSearch::Source::All, linphone::MagicSearch::Aggregation::None); }else{ beginResetModel(); mList.clear(); diff --git a/linphone-app/tools/create_appimage.sh b/linphone-app/tools/create_appimage.sh index 3ab9ff1dd..b93197dbd 100755 --- a/linphone-app/tools/create_appimage.sh +++ b/linphone-app/tools/create_appimage.sh @@ -38,13 +38,31 @@ export APPIMAGE_EXTRACT_AND_RUN=1 rm -rf ${WORK_DIR}/AppDir mkdir -p "${WORK_DIR}/AppDir/usr/" +copyFolder() +{ + mkdir -p "${WORK_DIR}/AppDir/usr/$1" + cp -rf "${BIN_SOURCE_DIR}/$1"/* "${WORK_DIR}/AppDir/usr/$1" +} + + #Copy all files from the output project -cp -rf "${BIN_SOURCE_DIR}"/* "${WORK_DIR}/AppDir/usr/" +#cp -rf "${BIN_SOURCE_DIR}"/* "${WORK_DIR}/AppDir/usr/" +copyFolder bin +#cp -rf "${BIN_SOURCE_DIR}/bin"/* "${WORK_DIR}/AppDir/usr/bin" + +# Copy share +copyFolder share/applications +copyFolder share/belr +copyFolder share/icons +copyFolder share/images +copyFolder share/linphone +copyFolder share/sounds + #remove Packages folder : it is not part of the project -rm -rf "${WORK_DIR}/AppDir/usr/Packages" +#rm -rf "${WORK_DIR}/AppDir/usr/Packages" #remove libraries : there are automatically found by linuxdeploy -rm -rf "${WORK_DIR}/AppDir/usr/lib" -rm -rf "${WORK_DIR}/AppDir/usr/lib64" +#rm -rf "${WORK_DIR}/AppDir/usr/lib" +#rm -rf "${WORK_DIR}/AppDir/usr/lib64" #Copy soci sqlite3 backend mkdir -p "${WORK_DIR}/AppDir/usr/lib" cp -f "${BIN_SOURCE_DIR}/lib"/libsoci_sqlite3* "${WORK_DIR}/AppDir/usr/lib/" @@ -57,13 +75,13 @@ cp -f "${BIN_SOURCE_DIR}/lib64"/libEQt* "${WORK_DIR}/AppDir/usr/lib/" if [ -d "${BIN_SOURCE_DIR}/lib64/mediastreamer" ]; then - mkdir -p "${WORK_DIR}/AppDir/usr/plugins/" - cp -rf "${BIN_SOURCE_DIR}"/lib64/mediastreamer "${WORK_DIR}/AppDir/usr/plugins/" + mkdir -p "${WORK_DIR}/AppDir/usr/lib64/" + cp -rf "${BIN_SOURCE_DIR}"/lib64/mediastreamer "${WORK_DIR}/AppDir/usr/lib64/" fi if [ -d "${BIN_SOURCE_DIR}/lib/mediastreamer" ]; then - mkdir -p "${WORK_DIR}/AppDir/usr/plugins/" - cp -rf "${BIN_SOURCE_DIR}"/lib/mediastreamer "${WORK_DIR}/AppDir/usr/plugins/" + mkdir -p "${WORK_DIR}/AppDir/usr/lib/" + cp -rf "${BIN_SOURCE_DIR}"/lib/mediastreamer "${WORK_DIR}/AppDir/usr/lib/" fi if [ -f "${WORK_DIR}/AppBin/linuxdeploy-x86_64.AppImage" ]; then @@ -83,7 +101,7 @@ fi ########################################################################################### export QML_SOURCES_PATHS=${QML_SOURCES_PATHS}:${WORK_DIR}/.. -export LD_LIBRARY_PATH=${QT_PATH}/lib +export LD_LIBRARY_PATH=${QT_PATH}/lib:${BIN_SOURCE_DIR}/lib:${BIN_SOURCE_DIR}/lib64 #export EXTRA_QT_PLUGINS=webenginecore;webview;webengine echo "-- Generating AppDir for AppImage" diff --git a/linphone-sdk b/linphone-sdk index b1d9eba1c..88c727d0c 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit b1d9eba1c96efc4f33edea6acc89d68815f11d97 +Subproject commit 88c727d0c8cd2d93d8ddcca1a4bff4a2e2fd7e89