1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-13 03:55:23 +02:00
jami-client-qt/extras/build/cmake/contrib_tools.cmake
Andreas Traczyk 35482fa92f misc: implement frameless window
Several major changes to the layout have been made.
- The chat search bar is moved into the message search layout.
- The Searchbar component is stripped of unused features.
- Some remaining logic that was used to switch main loader components is removed.
- ViewCoordinator.getView gets a "force create" parameter and we no longer preload low-cost views.

NOTE: the option to use a frameless window is available within general settings

Gitlab: #1524 (Frameless Window)
Change-Id: Iec6bdf162cb0335d3ae3d9bd09dd9783991a4a57
2024-01-26 18:14:55 -05:00

84 lines
3.1 KiB
CMake

# Copyright (C) 2024 Savoir-faire Linux Inc.
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include(FetchContent)
include(CMakeParseArguments)
# Helper function to check if the current distribution is Red Hat-based
function(check_redhat_based IS_REDHAT_BASED)
set(${IS_REDHAT_BASED} FALSE PARENT_SCOPE)
# Check for the existence of /etc/os-release
if(EXISTS "/etc/os-release")
# Read the content of the file
file(READ "/etc/os-release" OS_RELEASE_CONTENT)
# Check if the distribution is Fedora or Red Hat-based
string(REGEX MATCH "ID=fedora|ID_LIKE=\"rhel fedora\"" MATCH_RESULT "${OS_RELEASE_CONTENT}")
if(MATCH_RESULT)
set(${IS_REDHAT_BASED} TRUE PARENT_SCOPE)
message(STATUS "Running on a Red Hat-based distribution (Fedora, RHEL, CentOS, etc.)")
else()
message(STATUS "Not a Red Hat-based distribution")
endif()
else()
message(STATUS "Cannot determine the distribution type: /etc/os-release not found")
endif()
endfunction()
# Helper function to add external content with patches and options.
# Parameters:
# TARGET: Name of the target to create
# URL: URL of the git repository
# BRANCH: Branch to checkout
# PATCHES: List of patch files to apply
# OPTIONS: List of options to set prior to calling FetchContent_MakeAvailable
function(add_fetch_content)
# Parse function arguments
set(oneValueArgs TARGET URL BRANCH)
set(multiValueArgs PATCHES OPTIONS)
cmake_parse_arguments(PARSE_ARGV 0 AFCWP "" "${oneValueArgs}" "${multiValueArgs}")
# Create a string for the patch command
set(patch_cmd "")
# If patches is not empty, start the command with "git apply"
if(NOT "${AFCWP_PATCHES}" STREQUAL "")
set(patch_cmd git apply)
endif()
foreach(patch_file IN LISTS AFCWP_PATCHES)
list(APPEND patch_cmd "${patch_file}")
endforeach()
# Declare the external content
FetchContent_Declare(
${AFCWP_TARGET}
GIT_REPOSITORY ${AFCWP_URL}
GIT_TAG ${AFCWP_BRANCH}
PATCH_COMMAND ${patch_cmd}
UPDATE_DISCONNECTED 1
)
# Apply options
list(LENGTH AFCWP_OPTIONS options_length)
math(EXPR max_idx "${options_length} - 1")
foreach(idx RANGE 0 ${max_idx} 2)
list(GET AFCWP_OPTIONS ${idx} key)
math(EXPR value_idx "${idx} + 1")
list(GET AFCWP_OPTIONS ${value_idx} value)
set(${key} ${value} CACHE STRING "${key}" FORCE)
endforeach()
# Make the content available
FetchContent_MakeAvailable(${AFCWP_TARGET})
endfunction()