Enable build with QtKeychain without using an ExternalProject.

This commit is contained in:
Julien Wadel 2023-08-03 11:47:27 +02:00
parent 305fe70370
commit c7acdf2bf6
7 changed files with 90 additions and 144 deletions

View file

@ -66,7 +66,6 @@ endif ()
#------------------------------------------------------------------------------
# Prepare gobal CMAKE configuration specific to the current project
# GMA: set(QTKEYCHAIN_TARGET_NAME "EQt5Keychain")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/OUTPUT" CACHE PATH "Default linphone-app installation prefix" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
@ -116,6 +115,7 @@ 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)
@ -134,18 +134,25 @@ if(NOT Qt5_FOUND)
message(FATAL_ERROR "Minimum supported Qt5 version is 5.10!")
endif()
if(NOT LINPHONE_QT_ONLY)
function(add_linphone_sdk)
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")
endfunction()
add_linphone_sdk()
if(ENABLE_QT_KEYCHAIN)
set(QTKEYCHAIN_TARGET_NAME "EQt5Keychain")
add_subdirectory("external/qtkeychain")
endif()
endif()
function(add_linphone_app)
if(APPLE)
add_compile_definitions("ENABLE_FAT_BINARY=ON") # Disable XCFrameworks as it is not supported.
elseif(UNIX)
# GMA: set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib:${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib")
endif()
@ -154,122 +161,6 @@ endfunction()
add_linphone_app()
# if(ENABLE_BUILD_APP_PLUGINS)
# file(GLOB children "plugins/*")
# set(dirlist "")
# foreach(child ${children})
# if(IS_DIRECTORY ${curdir}/${child} AND (ENABLE_BUILD_EXAMPLES OR NOT ${child} MATCHES "example"))
# list(APPEND dirlist ${child})
# endif()
# endforeach()
# list(LENGTH dirlist count)
# if(NOT count)
# set(ENABLE_BUILD_APP_PLUGINS OFF)
# message(STATUS "No plugins found for the application to build")
# endif()
# endif()
# if(NOT LINPHONE_QT_ONLY)
# #add_subdirectory(external/qtkeychain)
# if(ENABLE_QT_KEYCHAIN)
# ExternalProject_Add(app-qtkeychain PREFIX "${CMAKE_BINARY_DIR}/qtkeychain"
# SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/qtkeychain"
# INSTALL_DIR "${QTKEYCHAIN_OUTPUT_DIR}"
# BINARY_DIR "${SDK_BUILD_DIR}/qtkeychain"
# BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
# LIST_SEPARATOR | # Use the alternate list separator
# CMAKE_ARGS ${APP_OPTIONS} ${QTKEYCHAIN_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
# BUILD_ALWAYS NO #${DO_BUILD}
# )
# endif()
# ExternalProject_Add(sdk PREFIX "${CMAKE_BINARY_DIR}/sdk"
# SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-sdk"
# INSTALL_DIR "${LINPHONE_OUTPUT_DIR}"
# STAMP_DIR "${SDK_BUILD_DIR}/stamp"
# BINARY_DIR "${SDK_BUILD_DIR}"
# STEP_TARGETS build
# BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
# INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
# LIST_SEPARATOR | # Use the alternate list separator
# CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
# BUILD_ALWAYS NO #${DO_BUILD}
# )
# ExternalProject_Add_Step(sdk force_build
# COMMENT "Forcing build for 'sdk'"
# DEPENDEES configure
# DEPENDERS build
# ALWAYS 1
# )
# endif()
# include(FindPkgConfig)
# set(APP_DEPENDS sdk)# Used if NOT LINPHONE_QT_ONLY
# if(ENABLE_QT_KEYCHAIN)
# list(APPEND APP_DEPENDS app-qtkeychain)
# endif()
# find_package(${QTKEYCHAIN_TARGET_NAME} CONFIG QUIET)
# if(NOT (LinphoneCxx_FOUND) OR NOT (Linphone_FOUND) OR NOT (bctoolbox_FOUND) OR NOT (belcard_FOUND) OR NOT (Mediastreamer2_FOUND) OR NOT (ortp_FOUND)
# OR ( ENABLE_QT_KEYCHAIN AND NOT(${QTKEYCHAIN_TARGET_NAME}_FOUND) )
# OR FORCE_APP_EXTERNAL_PROJECTS
# )
# message("Projects are set as External projects. You can start building them by using for example : cmake --build . --target install")
# ExternalProject_Add(linphone-qt PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
# SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
# INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
# BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
# DEPENDS ${APP_DEPENDS}
# BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
# INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
# LIST_SEPARATOR | # Use the alternate list separator
# CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
# # ${APP_OPTIONS}
# BUILD_ALWAYS ON
# )
# if( ENABLE_BUILD_APP_PLUGINS)
# ExternalProject_Add(app-plugins PREFIX "${CMAKE_BINARY_DIR}/plugins-app"
# SOURCE_DIR "${CMAKE_SOURCE_DIR}/plugins"
# INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
# BINARY_DIR "${CMAKE_BINARY_DIR}/plugins-app"
# DEPENDS linphone-qt
# BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
# INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
# LIST_SEPARATOR | # Use the alternate list separator
# CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
# )
# endif()
# install(CODE "message(STATUS \"Running install\")")
# set(AUTO_REGENERATION auto_regeneration)
# if( ENABLE_BUILD_APP_PLUGINS)
# add_custom_target(${AUTO_REGENERATION} ALL
# COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}
# DEPENDS app-plugins)
# else()
# add_custom_target(${AUTO_REGENERATION} ALL
# COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}
# DEPENDS linphone-qt)
# endif()
# else()
# message("Adding Linphone Desktop in an IDE-friendly state")
# set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}")
# add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app)
# if(NOT LINPHONE_QT_ONLY)
# add_dependencies(app-library ${APP_DEPENDS})
# endif()
# if( ENABLE_BUILD_APP_PLUGINS)
# add_subdirectory(${CMAKE_SOURCE_DIR}/plugins "plugins-app")
# endif()
# endif()
# ExternalProject_Add(linphone-qt-only PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
# SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
# INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
# BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
# BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
# # INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
# LIST_SEPARATOR | # Use the alternate list separator
# CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
# EXCLUDE_FROM_ALL ON
# #BUILD_ALWAYS ON
# )
if(ENABLE_BUILD_APP_PLUGINS)
add_subdirectory("plugins" "plugins-app")
endif()

View file

@ -74,7 +74,8 @@ Note: If you have the third party tool `qtchooser` installed :
`mkdir build`
`cd build`
`cmake .. -DCMAKE_BUILD_PARALLEL_LEVEL=10 -DCMAKE_BUILD_TYPE=RelWithDebInfo`
`cmake --build . --target install --parallel 10 --config RelWithDebInfo`
`cmake --build . --parallel 10 --config RelWithDebInfo`
`cmake --install .`
`./OUTPUT/bin/linphone --verbose` or `./OUTPUT/Linphone.app/Contents/MacOS/linphone --verbose`
### Get sources

2
external/qtkeychain vendored

@ -1 +1 @@
Subproject commit bb47857aed7c3e9a66902ff681680a79f44e81e5
Subproject commit 72e39ee293f4598955b92f9fb21b97cf21a8d1a6

View file

@ -108,10 +108,16 @@ if(NOT LINPHONECXX_FOUND)
find_package(LinphoneCxx CONFIG)
endif()
# if(ENABLE_QT_KEYCHAIN)
# find_package(${QTKEYCHAIN_TARGET_NAME} CONFIG REQUIRED)
# add_definitions(-DENABLE_QT_KEYCHAIN)
# endif()
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")
endif()
endif()
if(ENABLE_BUILD_VERBOSE)
message("INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} FRAMEWORK_PATH=${CMAKE_FRAMEWORK_PATH}, PREFIX_PATH=${CMAKE_PREFIX_PATH}")
@ -127,7 +133,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DQT_QML_D
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG" )
#############################
#Sanitizer
# Sanitizer
if(ENABLE_SANITIZER)
if(MSVC)
set(sanitize_flags "/fsanitize=address /Oy-")
@ -147,11 +153,11 @@ if(ENABLE_SANITIZER)
endif()
#############################
if( WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_")#remove error from windows headers order
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_") # Remove error from windows headers order
add_definitions(-DNOMINMAX)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)#useful for config.h
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Useful for config.h
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network Test Qml Multimedia)
@ -714,10 +720,10 @@ 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})
#if(ENABLE_QT_KEYCHAIN)
# list(APPEND INCLUDED_DIRECTORIES ${QtKeyChain_INCLUDE_DIRS})
# list(APPEND LIBRARIES_LIST ${QtKeyChain_LIBRARIES})
#endif()
if(ENABLE_QT_KEYCHAIN)
list(APPEND INCLUDED_DIRECTORIES ${QtKeyChain_INCLUDE_DIRS})
list(APPEND LIBRARIES_LIST ${QtKeyChain_LIBRARIES})
endif()
if(WIN32)
foreach(LIBRARY ${LIBRARIES_LIST})# Search for lib full path

View file

@ -0,0 +1,44 @@
############################################################################
# FindQtKeychain.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 linphonecxx include files and library
#
# QtKeychain_FOUND - system has lib linphonecxx
# QtKeychain_INCLUDE_DIRS - the linphonecxx include directory
# QtKeychain_LIBRARIES - The library needed to use linphonecxx
if(TARGET ${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()

View file

@ -22,8 +22,13 @@
#define VFS_UTILS_H_
#include <QObject>
#ifdef QTKEYCHAIN_USE_BUILD_INTERFACE
#include <keychain.h>
#else
#include <EQt5Keychain/keychain.h>
#endif
#include <QSettings>
// =============================================================================
class VfsUtils : public QObject {

View file

@ -1,6 +1,6 @@
################################################################################
#
# Copyright (c) 2017-2020 Belledonne Communications SARL.
# Copyright (c) 2017-2023 Belledonne Communications SARL.
#
# This file is part of linphone-desktop
# (see https://www.linphone.org).
@ -19,7 +19,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.22)
project(app-plugins)
@ -36,8 +37,6 @@ macro(get_all_subdirs result curdir)
endmacro()
get_all_subdirs(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${CMAKE_INSTALL_PREFIX}/include")
foreach(subdir ${SUBDIRS})
message("Adding ${subdir} plugin")
add_subdirectory(${subdir})