Initial QSfera import
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,13 @@
|
||||
CMake - Cross Platform Makefile Generator
|
||||
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,66 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindSQLite3
|
||||
-----------
|
||||
|
||||
Find the SQLite libraries, v3
|
||||
|
||||
IMPORTED targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``SQLite::SQLite3``
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables if found:
|
||||
|
||||
``SQLite3_INCLUDE_DIRS``
|
||||
where to find sqlite3.h, etc.
|
||||
``SQLite3_LIBRARIES``
|
||||
the libraries to link against to use SQLite3.
|
||||
``SQLite3_VERSION``
|
||||
version of the SQLite3 library found
|
||||
``SQLite3_FOUND``
|
||||
TRUE if found
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
# Look for the necessary header
|
||||
find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
|
||||
mark_as_advanced(SQLite3_INCLUDE_DIR)
|
||||
|
||||
# Look for the necessary library
|
||||
find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
|
||||
mark_as_advanced(SQLite3_LIBRARY)
|
||||
|
||||
# Extract version information from the header file
|
||||
if(SQLite3_INCLUDE_DIR)
|
||||
file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
|
||||
REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
|
||||
LIMIT_COUNT 1)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
SQLite3_VERSION "${_ver_line}")
|
||||
unset(_ver_line)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SQLite3
|
||||
REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
|
||||
VERSION_VAR SQLite3_VERSION)
|
||||
|
||||
# Create the imported target
|
||||
if(SQLite3_FOUND)
|
||||
set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
|
||||
set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
|
||||
if(NOT TARGET SQLite::SQLite3)
|
||||
add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties(SQLite::SQLite3 PROPERTIES
|
||||
IMPORTED_LOCATION "${SQLite3_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,21 @@
|
||||
# Find Sparkle.framework
|
||||
#
|
||||
# Once done this will define
|
||||
# SPARKLE_FOUND - system has Sparkle
|
||||
# SPARKLE_LIBRARY - The framework needed to use Sparkle
|
||||
# Copyright (c) 2009, Vittorio Giovara <vittorio.giovara@gmail.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_library(SPARKLE_LIBRARY NAMES Sparkle)
|
||||
|
||||
find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_LIBRARY)
|
||||
mark_as_advanced(SPARKLE_LIBRARY)
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_DIR "${PROJECT_SOURCE_DIR}/.git")
|
||||
if (NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
set(HEAD_HASH "${HEAD_REF}")
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
@@ -0,0 +1,37 @@
|
||||
include(OCApplyCommonSettings)
|
||||
|
||||
function(add_vfs_plugin)
|
||||
set(options "")
|
||||
set(oneValueArgs NAME)
|
||||
set(multiValueArgs SRC LIBS)
|
||||
cmake_parse_arguments(__PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
add_library(vfs_${__PLUGIN_NAME} MODULE
|
||||
${__PLUGIN_SRC}
|
||||
)
|
||||
apply_common_target_settings(vfs_${__PLUGIN_NAME})
|
||||
|
||||
|
||||
set_target_properties(vfs_${__PLUGIN_NAME} PROPERTIES OUTPUT_NAME "QSfera_vfs_${__PLUGIN_NAME}")
|
||||
|
||||
target_link_libraries(vfs_${__PLUGIN_NAME} PRIVATE
|
||||
libsync
|
||||
${__PLUGIN_LIBS}
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(vfs_${__PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:qsfera>/../PlugIns/")
|
||||
# make the plugins available to the tests
|
||||
add_custom_command(TARGET vfs_${__PLUGIN_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E create_symlink "$<TARGET_FILE:vfs_${__PLUGIN_NAME}>" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<TARGET_FILE_NAME:vfs_${__PLUGIN_NAME}>")
|
||||
|
||||
else()
|
||||
install(TARGETS vfs_${__PLUGIN_NAME} DESTINATION "${KDE_INSTALL_PLUGINDIR}")
|
||||
endif()
|
||||
|
||||
if (TARGET qsfera)
|
||||
add_dependencies(qsfera vfs_${__PLUGIN_NAME})
|
||||
endif()
|
||||
if (TARGET cmd)
|
||||
add_dependencies(cmd vfs_${__PLUGIN_NAME})
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,70 @@
|
||||
include(OCRcVersion)
|
||||
|
||||
if (MSVC)
|
||||
# ecm sets /W3 we set /W4
|
||||
string(REGEX REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# common target settings that are used by all important targets
|
||||
function(apply_common_target_settings targetName)
|
||||
add_windows_version_info(${targetName})
|
||||
if(FORCE_ASSERTS)
|
||||
target_compile_definitions(${targetName}
|
||||
PRIVATE
|
||||
QT_FORCE_ASSERTS
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${targetName}
|
||||
PRIVATE
|
||||
QT_NO_CAST_TO_ASCII
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
QT_NO_URL_CAST_FROM_STRING
|
||||
QT_NO_CAST_FROM_BYTEARRAY
|
||||
QT_USE_QSTRINGBUILDER
|
||||
QT_MESSAGELOGCONTEXT # enable function name and line number in debug output
|
||||
QT_NO_FOREACH
|
||||
QT_DISABLE_DEPRECATED_BEFORE=0x060200
|
||||
QT_NO_CONTEXTLESS_CONNECT
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(${targetName}
|
||||
PRIVATE
|
||||
# Get APIs from from Win10 onwards.
|
||||
_WIN32_WINNT=_WIN32_WINNT_WIN10
|
||||
WINVER=_WIN32_WINNT_WIN10
|
||||
NTDDI_VERSION=NTDDI_WIN10_RS2
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(${targetName}
|
||||
PRIVATE
|
||||
# enable linter like warnings with msvc
|
||||
# this includes deprecations
|
||||
# https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170
|
||||
/W4
|
||||
# treat unhandled switch cases as error
|
||||
/we4062
|
||||
# Worder
|
||||
/w15038
|
||||
# werror on unused function
|
||||
# The given function is local and not referenced in the body of the module; therefore, the function is dead code.
|
||||
/we4505
|
||||
# 4505 for anonymous namespaces, apparently undocumented https://developercommunity.visualstudio.com/t/warning-C4505-missing-on-anonymous-names/10413660
|
||||
/we5245
|
||||
/we4930
|
||||
# A variable is declared and initialized but not used.
|
||||
/we4189
|
||||
)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(${targetName}
|
||||
PRIVATE
|
||||
# treat unhandled switch cases as error
|
||||
-Werror=switch
|
||||
-Werror=unused-function
|
||||
-Werror=unused-but-set-variable
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,170 @@
|
||||
function(__add_file_to_qrc_file)
|
||||
set(options "")
|
||||
set(oneValueArgs QRC_PATH FILE_PATH ALIAS)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(__ADD_FILE_TO_QRC_FILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(param QRC_PATH FILE_PATH)
|
||||
if(NOT __ADD_FILE_TO_QRC_FILE_${param})
|
||||
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: Argument missing: ${param}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(line "<file ")
|
||||
if(__ADD_FILE_TO_QRC_FILE_ALIAS)
|
||||
set(line "${line} alias=\"${__ADD_FILE_TO_QRC_FILE_ALIAS}\"")
|
||||
endif()
|
||||
set(line "${line}>${__ADD_FILE_TO_QRC_FILE_FILE_PATH}</file>")
|
||||
|
||||
file(APPEND ${__ADD_FILE_TO_QRC_FILE_QRC_PATH} " ${line}\n")
|
||||
endfunction()
|
||||
|
||||
|
||||
function(__addIcon QRC_PATH THEME ICON_NAME)
|
||||
set(options)
|
||||
set(oneValueArgs SRC_PATH)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_ICON "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT _ICON_SRC_PATH)
|
||||
set(_ICON_SRC_PATH ${THEME})
|
||||
endif()
|
||||
|
||||
set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}.svg")
|
||||
set(iconAlias "${APPLICATION_SHORTNAME}/theme/${THEME}/${ICON_NAME}.svg")
|
||||
if (EXISTS ${OEM_THEME_DIR}/${icon})
|
||||
file(APPEND "${QRC_PATH}" "<file alias=\"${iconAlias}\">${OEM_THEME_DIR}/${icon}</file>\n")
|
||||
else()
|
||||
set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}.png")
|
||||
set(iconAlias "${APPLICATION_SHORTNAME}/theme/${THEME}/${ICON_NAME}.png")
|
||||
if (EXISTS ${OEM_THEME_DIR}/${icon})
|
||||
__add_file_to_qrc_file(
|
||||
QRC_PATH ${QRC_PATH}
|
||||
FILE_PATH ${OEM_THEME_DIR}/${icon}
|
||||
ALIAS ${iconAlias}
|
||||
)
|
||||
else()
|
||||
set(SIZES "16;22;32;48;64;128;256;512;1024")
|
||||
foreach(size ${SIZES})
|
||||
set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}-${size}.png")
|
||||
set(iconAlias "${APPLICATION_SHORTNAME}/theme/${THEME}/${ICON_NAME}-${size}.png")
|
||||
if (EXISTS ${OEM_THEME_DIR}/${icon})
|
||||
__add_file_to_qrc_file(
|
||||
QRC_PATH ${QRC_PATH}
|
||||
FILE_PATH ${OEM_THEME_DIR}/${icon}
|
||||
ALIAS ${iconAlias}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(__write_qrc_file_header QRC_PATH FILES_PREFIX)
|
||||
file(WRITE ${QRC_PATH} "<RCC>\n")
|
||||
file(APPEND ${QRC_PATH} " <qresource prefix=\"/client/\">\n")
|
||||
endfunction()
|
||||
|
||||
function(__write_qrc_file_footer QRC_PATH)
|
||||
file(APPEND ${QRC_PATH} " </qresource>\n")
|
||||
file(APPEND ${QRC_PATH} "</RCC>\n")
|
||||
endfunction()
|
||||
|
||||
# add the icons for url buttons to the theme
|
||||
function(__addUrlIcons QRC_PATH)
|
||||
file(GLOB_RECURSE QSFERA_URL_ICONS "${OEM_THEME_DIR}/theme/universal/urlIcons/*")
|
||||
foreach(icon ${QSFERA_URL_ICONS})
|
||||
get_filename_component(iconName ${icon} NAME_WE)
|
||||
__addIcon(${QRC_PATH} "universal" "urlIcons/${iconName}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(generate_theme TARGET QSFERA_SIDEBAR_ICONS_OUT)
|
||||
if(NOT "${OEM_THEME_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}/src/resources/")
|
||||
set(QRC_PATH ${CMAKE_CURRENT_BINARY_DIR}/theme.qrc)
|
||||
__write_qrc_file_header(${QRC_PATH} theme)
|
||||
|
||||
# ownbrander
|
||||
__addIcon(${QRC_PATH} "universal" "${APPLICATION_ICON_NAME}-icon" SRC_PATH "colored")
|
||||
__addIcon(${QRC_PATH} "universal" "wizard_logo" SRC_PATH "colored")
|
||||
# full theme
|
||||
__addIcon(${QRC_PATH} "universal" "${APPLICATION_ICON_NAME}-icon")
|
||||
__addIcon(${QRC_PATH} "universal" "wizard_logo")
|
||||
|
||||
__addUrlIcons(${QRC_PATH})
|
||||
|
||||
foreach(theme IN ITEMS colored dark black white)
|
||||
foreach(state IN ITEMS ok error information offline pause sync)
|
||||
__addIcon(${QRC_PATH} ${theme} "state-${state}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
__write_qrc_file_footer(${QRC_PATH})
|
||||
|
||||
target_sources(${TARGET} PRIVATE ${QRC_PATH})
|
||||
target_compile_definitions(${TARGET} PRIVATE BRANDING_AVAILABLE)
|
||||
|
||||
# add executable icon on windows and osx
|
||||
file(GLOB_RECURSE QSFERA_SIDEBAR_ICONS "${OEM_THEME_DIR}/theme/colored/*-${APPLICATION_ICON_NAME}-sidebar.png")
|
||||
else()
|
||||
file(GLOB_RECURSE QSFERA_SIDEBAR_ICONS "${OEM_THEME_DIR}/theme/colored/*-${APPLICATION_ICON_NAME}-icon-sidebar.png")
|
||||
endif()
|
||||
if (NOT QSFERA_SIDEBAR_ICONS)
|
||||
message(WARNING "The branding does not provide sidebar icons falling back to vanilla icons")
|
||||
file(GLOB_RECURSE QSFERA_SIDEBAR_ICONS "${PROJECT_SOURCE_DIR}/src/resources/theme/colored/*-qsfera-icon-sidebar.png")
|
||||
endif()
|
||||
set(${QSFERA_SIDEBAR_ICONS_OUT} ${QSFERA_SIDEBAR_ICONS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(generate_qrc_file)
|
||||
set(options "")
|
||||
set(oneValueArgs QRC_PATH PREFIX)
|
||||
set(multiValueArgs FILES)
|
||||
cmake_parse_arguments(GENERATE_QRC_FILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(param ${oneValueArgs} ${multiValueArgs})
|
||||
if(NOT GENERATE_QRC_FILE_${param})
|
||||
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: Argument missing: ${param}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
__write_qrc_file_header(${GENERATE_QRC_FILE_QRC_PATH} ${GENERATE_QRC_FILE_PREFIX})
|
||||
|
||||
foreach(file ${GENERATE_QRC_FILE_FILES})
|
||||
get_filename_component(file_name ${file} NAME)
|
||||
set(file_alias ${GENERATE_QRC_FILE_PREFIX}/${file_name})
|
||||
__add_file_to_qrc_file(
|
||||
QRC_PATH ${GENERATE_QRC_FILE_QRC_PATH}
|
||||
FILE_PATH ${file}
|
||||
ALIAS ${file_alias}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
__write_qrc_file_footer(${GENERATE_QRC_FILE_QRC_PATH})
|
||||
endfunction()
|
||||
|
||||
# add resources to a target using the Qt resources system
|
||||
# parameters:
|
||||
# - TARGET: the target to bundle the resources with
|
||||
# - PREFIX: virtual "subdirectory" the files will be available from
|
||||
# - FILES: the files to bundle
|
||||
function(add_resources_to_target)
|
||||
set(options "")
|
||||
set(oneValueArgs TARGET PREFIX)
|
||||
set(multiValueArgs FILES)
|
||||
cmake_parse_arguments(ADD_RESOURCES_TO_TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(param ${oneValueArgs} ${multiValueArgs})
|
||||
if(NOT ADD_RESOURCES_TO_TARGET_${param})
|
||||
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: Argument missing: ${param}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(qrc_path ${CMAKE_CURRENT_BINARY_DIR}/${ADD_RESOURCES_TO_TARGET_TARGET}-${ADD_RESOURCES_TO_TARGET_PREFIX}.qrc)
|
||||
generate_qrc_file(
|
||||
QRC_PATH ${qrc_path}
|
||||
PREFIX ${ADD_RESOURCES_TO_TARGET_PREFIX}
|
||||
FILES "${ADD_RESOURCES_TO_TARGET_FILES}"
|
||||
)
|
||||
target_sources(${ADD_RESOURCES_TO_TARGET_TARGET} PRIVATE ${qrc_path})
|
||||
endfunction()
|
||||
@@ -0,0 +1,31 @@
|
||||
set(_VERSION_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(${PROJECT_SOURCE_DIR}/VERSION.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/THEME.cmake)
|
||||
|
||||
function(add_windows_version_info targetName)
|
||||
if(NOT WIN32)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(MIRALL_VERSION_BUILD)
|
||||
set(OC_RC_VERSION_BUILD ${MIRALL_VERSION_BUILD})
|
||||
else()
|
||||
set(OC_RC_VERSION_BUILD 0)
|
||||
endif()
|
||||
|
||||
get_target_property(TARGET_TYPE ${targetName} TYPE)
|
||||
if(${TARGET_TYPE} STREQUAL "EXECUTABLE")
|
||||
set(OC_RC_TYPE "VFT_APP")
|
||||
elseif(${TARGET_TYPE} STREQUAL "SHARED_LIBRARY" OR ${TARGET_TYPE} STREQUAL "MODULE_LIBRARY")
|
||||
set(OC_RC_TYPE "VFT_DLL")
|
||||
else()
|
||||
# only create version.rc for dll's and executables
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(OC_RC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${targetName}-oc_rc_version.rc)
|
||||
configure_file(${_VERSION_SOURCE_DIR}/version.rc.in ${OC_RC_OUTPUT} @ONLY)
|
||||
|
||||
target_sources(${targetName} PRIVATE ${OC_RC_OUTPUT})
|
||||
endfunction()
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <winresrc.h>
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @MIRALL_VERSION_MAJOR@,@MIRALL_VERSION_MINOR@,@MIRALL_VERSION_PATCH@,@OC_RC_VERSION_BUILD@
|
||||
PRODUCTVERSION @MIRALL_VERSION_MAJOR@,@MIRALL_VERSION_MINOR@,@MIRALL_VERSION_PATCH@,@OC_RC_VERSION_BUILD@
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE @OC_RC_TYPE@
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "@APPLICATION_VENDOR@\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 OpenCloud GmbH\r\nCopyright (C) 2014-@MIRALL_VERSION_YEAR@ ownCloud GmbH\0"
|
||||
VALUE "FileVersion", "@MIRALL_VERSION_FULL@\0"
|
||||
VALUE "Comments", "@MIRALL_VERSION_STRING@\0"
|
||||
VALUE "FileDescription", "@APPLICATION_NAME@\0"
|
||||
VALUE "ProductName", "@APPLICATION_NAME@\0"
|
||||
VALUE "ProductVersion", "@MIRALL_VERSION_STRING@\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
// English US, Unicode
|
||||
VALUE "Translation", 0x0409, 1200
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user