First Commit
This commit is contained in:
28
3rdparty/kddockwidgets/cmake/ECM/modules/BSD-3-Clause.txt
vendored
Normal file
28
3rdparty/kddockwidgets/cmake/ECM/modules/BSD-3-Clause.txt
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
This license applies to the CMake ECM modules only.
|
||||
|
||||
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 above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its 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.
|
||||
167
3rdparty/kddockwidgets/cmake/ECM/modules/ECMEnableSanitizers.cmake
vendored
Normal file
167
3rdparty/kddockwidgets/cmake/ECM/modules/ECMEnableSanitizers.cmake
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# SPDX-FileCopyrightText: 2014 Mathieu Tarral <mathieu.tarral@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMEnableSanitizers
|
||||
-------------------
|
||||
|
||||
Enable compiler sanitizer flags.
|
||||
|
||||
The following sanitizers are supported:
|
||||
|
||||
- Address Sanitizer
|
||||
- Memory Sanitizer
|
||||
- Thread Sanitizer
|
||||
- Leak Sanitizer
|
||||
- Undefined Behaviour Sanitizer
|
||||
|
||||
All of them are implemented in Clang, depending on your version, and
|
||||
there is an work in progress in GCC, where some of them are currently
|
||||
implemented.
|
||||
|
||||
This module will check your current compiler version to see if it
|
||||
supports the sanitizers that you want to enable
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Simply add::
|
||||
|
||||
include(ECMEnableSanitizers)
|
||||
|
||||
to your ``CMakeLists.txt``. Note that this module is included in
|
||||
:kde-module:`KDECompilerSettings`, so projects using that module do not need to also
|
||||
include this one.
|
||||
|
||||
The sanitizers are not enabled by default. Instead, you must set
|
||||
``ECM_ENABLE_SANITIZERS`` (either in your ``CMakeLists.txt`` or on the
|
||||
command line) to a semicolon-separated list of sanitizers you wish to enable.
|
||||
The options are:
|
||||
|
||||
- address
|
||||
- memory
|
||||
- thread
|
||||
- leak
|
||||
- undefined
|
||||
- fuzzer
|
||||
|
||||
The sanitizers "address", "memory" and "thread" are mutually exclusive. You
|
||||
cannot enable two of them in the same build.
|
||||
|
||||
"leak" requires the "address" sanitizer.
|
||||
|
||||
.. note::
|
||||
|
||||
To reduce the overhead induced by the instrumentation of the sanitizers, it
|
||||
is advised to enable compiler optimizations (``-O1`` or higher).
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
This is an example of usage::
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DECM_ENABLE_SANITIZERS='address;leak;undefined' ..
|
||||
|
||||
.. note::
|
||||
|
||||
Most of the sanitizers will require Clang. To enable it, use::
|
||||
|
||||
-DCMAKE_CXX_COMPILER=clang++
|
||||
|
||||
Since 1.3.0.
|
||||
#]=======================================================================]
|
||||
|
||||
# MACRO check_compiler_version
|
||||
#-----------------------------
|
||||
macro (check_compiler_version gcc_required_version clang_required_version msvc_required_version)
|
||||
if (
|
||||
(
|
||||
CMAKE_CXX_COMPILER_ID MATCHES "GNU"
|
||||
AND
|
||||
CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_required_version}
|
||||
)
|
||||
OR
|
||||
(
|
||||
CMAKE_CXX_COMPILER_ID MATCHES "Clang"
|
||||
AND
|
||||
CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${clang_required_version}
|
||||
)
|
||||
OR
|
||||
(
|
||||
CMAKE_CXX_COMPILER_ID MATCHES "MSVC"
|
||||
AND
|
||||
CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${msvc_required_version}
|
||||
)
|
||||
)
|
||||
# error !
|
||||
message(STATUS "You ask to enable the sanitizer ${CUR_SANITIZER},
|
||||
but your compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}
|
||||
does not support it !
|
||||
You should use at least GCC ${gcc_required_version}, Clang ${clang_required_version}
|
||||
or MSVC ${msvc_required_version}
|
||||
(99.99 means not implemented yet)")
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# MACRO check_compiler_support
|
||||
#------------------------------
|
||||
macro (enable_sanitizer_flags sanitize_option)
|
||||
if (${sanitize_option} MATCHES "address")
|
||||
check_compiler_version("4.8" "3.1" "19.28")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=address")
|
||||
else()
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
set(XSAN_LINKER_FLAGS "asan")
|
||||
endif()
|
||||
elseif (${sanitize_option} MATCHES "thread")
|
||||
check_compiler_version("4.8" "3.1" "99.99")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
|
||||
set(XSAN_LINKER_FLAGS "tsan")
|
||||
elseif (${sanitize_option} MATCHES "memory")
|
||||
check_compiler_version("99.99" "3.1" "99.99")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=memory")
|
||||
elseif (${sanitize_option} MATCHES "leak")
|
||||
check_compiler_version("4.9" "3.4" "99.99")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=leak")
|
||||
set(XSAN_LINKER_FLAGS "lsan")
|
||||
elseif (${sanitize_option} MATCHES "undefined")
|
||||
check_compiler_version("4.9" "3.1" "99.99")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
elseif (${sanitize_option} MATCHES "fuzzer")
|
||||
check_compiler_version("99.99" "6.0" "99.99")
|
||||
set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer")
|
||||
else ()
|
||||
message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.")
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
if (ECM_ENABLE_SANITIZERS)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
# for each element of the ECM_ENABLE_SANITIZERS list
|
||||
foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} )
|
||||
# lowercase filter
|
||||
string(TOLOWER ${CUR_SANITIZER} CUR_SANITIZER)
|
||||
# check option and enable appropriate flags
|
||||
enable_sanitizer_flags ( ${CUR_SANITIZER} )
|
||||
# TODO: GCC will not link pthread library if enabled ASan
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XSAN_COMPILE_FLAGS}" )
|
||||
endif()
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" )
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
link_libraries(${XSAN_LINKER_FLAGS})
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
endif ()
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "Tried to enable sanitizers (-DECM_ENABLE_SANITIZERS=${ECM_ENABLE_SANITIZERS}), \
|
||||
but compiler (${CMAKE_CXX_COMPILER_ID}) does not have sanitizer support")
|
||||
endif()
|
||||
endif()
|
||||
222
3rdparty/kddockwidgets/cmake/ECM/modules/ECMGenerateHeaders.cmake
vendored
Normal file
222
3rdparty/kddockwidgets/cmake/ECM/modules/ECMGenerateHeaders.cmake
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
# SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kdemail.net>
|
||||
# SPDX-FileCopyrightText: 2015 Patrick Spendrin <patrick.spendrin@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMGenerateHeaders
|
||||
------------------
|
||||
|
||||
Generate C/C++ CamelCase forwarding headers.
|
||||
|
||||
::
|
||||
|
||||
ecm_generate_headers(<camelcase_forwarding_headers_var>
|
||||
HEADER_NAMES <CamelCaseName> [<CamelCaseName> [...]]
|
||||
[ORIGINAL <CAMELCASE|LOWERCASE>]
|
||||
[HEADER_EXTENSION <header_extension>]
|
||||
[OUTPUT_DIR <output_dir>]
|
||||
[PREFIX <prefix>]
|
||||
[REQUIRED_HEADERS <variable>]
|
||||
[COMMON_HEADER <HeaderName>]
|
||||
[RELATIVE <relative_path>])
|
||||
|
||||
For each CamelCase header name passed to ``HEADER_NAMES``, a file of that name
|
||||
will be generated that will include a version with ``.h`` or, if set,
|
||||
``.<header_extension>`` appended.
|
||||
For example, the generated header ``ClassA`` will include ``classa.h`` (or
|
||||
``ClassA.h``, see ``ORIGINAL``).
|
||||
If a CamelCaseName consists of multiple comma-separated files, e.g.
|
||||
``ClassA,ClassB,ClassC``, then multiple camelcase header files will be
|
||||
generated which are redirects to the first header file.
|
||||
The file locations of these generated headers will be stored in
|
||||
<camelcase_forwarding_headers_var>.
|
||||
|
||||
``ORIGINAL`` specifies how the name of the original header is written: lowercased
|
||||
or also camelcased. The default is "LOWERCASE". Since 1.8.0.
|
||||
|
||||
``HEADER_EXTENSION`` specifies what file name extension is used for the header
|
||||
files. The default is "h". Since 5.48.0.
|
||||
|
||||
``PREFIX`` places the generated headers in subdirectories. This should be a
|
||||
CamelCase name like ``KParts``, which will cause the CamelCase forwarding
|
||||
headers to be placed in the ``KParts`` directory (e.g. ``KParts/Part``). It
|
||||
will also, for the convenience of code in the source distribution, generate
|
||||
forwarding headers based on the original names (e.g. ``kparts/part.h``). This
|
||||
allows includes like ``"#include <kparts/part.h>"`` to be used before
|
||||
installation, as long as the include_directories are set appropriately.
|
||||
|
||||
``OUTPUT_DIR`` specifies where the files will be generated; this should be within
|
||||
the build directory. By default, ``${CMAKE_CURRENT_BINARY_DIR}`` will be used.
|
||||
This option can be used to avoid file conflicts.
|
||||
|
||||
``REQUIRED_HEADERS`` specifies an output variable name where all the required
|
||||
headers will be appended so that they can be installed together with the
|
||||
generated ones. This is mostly intended as a convenience so that adding a new
|
||||
header to a project only requires specifying the CamelCase variant in the
|
||||
CMakeLists.txt file; the original variant will then be added to this
|
||||
variable.
|
||||
|
||||
``COMMON_HEADER`` generates an additional convenience header which includes all
|
||||
other header files.
|
||||
|
||||
The ``RELATIVE`` argument indicates where the original headers can be found
|
||||
relative to ``CMAKE_CURRENT_SOURCE_DIR``. It does not affect the generated
|
||||
CamelCase forwarding files, but ``ecm_generate_headers()`` uses it when checking
|
||||
that the original header exists, and to generate originally named forwarding
|
||||
headers when ``PREFIX`` is set.
|
||||
|
||||
To allow other parts of the source distribution (eg: tests) to use the
|
||||
generated headers before installation, it may be desirable to set the
|
||||
``INCLUDE_DIRECTORIES`` property for the library target to output_dir. For
|
||||
example, if ``OUTPUT_DIR`` is ``CMAKE_CURRENT_BINARY_DIR`` (the default), you could do
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
|
||||
|
||||
Example usage (without ``PREFIX``):
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_headers(
|
||||
MyLib_FORWARDING_HEADERS
|
||||
HEADERS
|
||||
MLFoo
|
||||
MLBar
|
||||
# etc
|
||||
REQUIRED_HEADERS MyLib_HEADERS
|
||||
COMMON_HEADER MLGeneral
|
||||
)
|
||||
install(FILES ${MyLib_FORWARDING_HEADERS} ${MyLib_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
|
||||
COMPONENT Devel)
|
||||
|
||||
Example usage (with ``PREFIX``):
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_headers(
|
||||
MyLib_FORWARDING_HEADERS
|
||||
HEADERS
|
||||
Foo
|
||||
# several classes are contained in bar.h, so generate
|
||||
# additional files
|
||||
Bar,BarList
|
||||
# etc
|
||||
PREFIX MyLib
|
||||
REQUIRED_HEADERS MyLib_HEADERS
|
||||
)
|
||||
install(FILES ${MyLib_FORWARDING_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/MyLib
|
||||
COMPONENT Devel)
|
||||
install(FILES ${MyLib_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/mylib
|
||||
COMPONENT Devel)
|
||||
|
||||
Since pre-1.0.0.
|
||||
#]=======================================================================]
|
||||
|
||||
function(ECM_GENERATE_HEADERS camelcase_forwarding_headers_var)
|
||||
set(options)
|
||||
set(oneValueArgs ORIGINAL HEADER_EXTENSION OUTPUT_DIR PREFIX REQUIRED_HEADERS COMMON_HEADER RELATIVE)
|
||||
set(multiValueArgs HEADER_NAMES)
|
||||
cmake_parse_arguments(EGH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (EGH_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unexpected arguments to ECM_GENERATE_HEADERS: ${EGH_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_HEADER_NAMES)
|
||||
message(FATAL_ERROR "Missing header_names argument to ECM_GENERATE_HEADERS")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_ORIGINAL)
|
||||
# default
|
||||
set(EGH_ORIGINAL "LOWERCASE")
|
||||
endif()
|
||||
if(NOT EGH_ORIGINAL STREQUAL "LOWERCASE" AND NOT EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
message(FATAL_ERROR "Unexpected value for original argument to ECM_GENERATE_HEADERS: ${EGH_ORIGINAL}")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_HEADER_EXTENSION)
|
||||
set(EGH_HEADER_EXTENSION "h")
|
||||
endif()
|
||||
|
||||
if(NOT EGH_OUTPUT_DIR)
|
||||
set(EGH_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# Make sure EGH_RELATIVE is /-terminated when it's not empty
|
||||
if (EGH_RELATIVE AND NOT "${EGH_RELATIVE}" MATCHES "^.*/$")
|
||||
set(EGH_RELATIVE "${EGH_RELATIVE}/")
|
||||
endif()
|
||||
|
||||
set(originalprefix)
|
||||
if (EGH_PREFIX)
|
||||
if (NOT "${EGH_PREFIX}" MATCHES "^.*/$")
|
||||
set(EGH_PREFIX "${EGH_PREFIX}/")
|
||||
endif()
|
||||
if (EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalprefix "${EGH_PREFIX}")
|
||||
else()
|
||||
string(TOLOWER "${EGH_PREFIX}" originalprefix)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(_classnameentry ${EGH_HEADER_NAMES})
|
||||
string(REPLACE "," ";" _classnames ${_classnameentry})
|
||||
list(GET _classnames 0 _baseclass)
|
||||
|
||||
if (EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalbasename "${_baseclass}")
|
||||
else()
|
||||
string(TOLOWER "${_baseclass}" originalbasename)
|
||||
endif()
|
||||
|
||||
set(_actualheader "${CMAKE_CURRENT_SOURCE_DIR}/${EGH_RELATIVE}${originalbasename}.${EGH_HEADER_EXTENSION}")
|
||||
get_source_file_property(_generated "${_actualheader}" GENERATED)
|
||||
if (NOT _generated AND NOT EXISTS ${_actualheader})
|
||||
message(FATAL_ERROR "Could not find \"${_actualheader}\"")
|
||||
endif()
|
||||
|
||||
foreach(_CLASSNAME ${_classnames})
|
||||
set(FANCY_HEADER_FILE "${EGH_OUTPUT_DIR}/${EGH_PREFIX}${_CLASSNAME}")
|
||||
if (NOT EXISTS ${FANCY_HEADER_FILE})
|
||||
file(WRITE ${FANCY_HEADER_FILE} "#include \"${originalprefix}${originalbasename}.${EGH_HEADER_EXTENSION}\"\n")
|
||||
endif()
|
||||
list(APPEND ${camelcase_forwarding_headers_var} "${FANCY_HEADER_FILE}")
|
||||
if (EGH_PREFIX)
|
||||
# Local forwarding header, for namespaced headers, e.g. kparts/part.h
|
||||
if(EGH_ORIGINAL STREQUAL "CAMELCASE")
|
||||
set(originalclassname "${_CLASSNAME}")
|
||||
else()
|
||||
string(TOLOWER "${_CLASSNAME}" originalclassname)
|
||||
endif()
|
||||
set(REGULAR_HEADER_NAME ${EGH_OUTPUT_DIR}/${originalprefix}${originalclassname}.${EGH_HEADER_EXTENSION})
|
||||
if (NOT EXISTS ${REGULAR_HEADER_NAME})
|
||||
file(WRITE ${REGULAR_HEADER_NAME} "#include \"${_actualheader}\"\n")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND _REQUIRED_HEADERS "${_actualheader}")
|
||||
endforeach()
|
||||
|
||||
if(EGH_COMMON_HEADER)
|
||||
#combine required headers into 1 big convenience header
|
||||
set(COMMON_HEADER ${EGH_OUTPUT_DIR}/${EGH_PREFIX}${EGH_COMMON_HEADER})
|
||||
file(WRITE ${COMMON_HEADER} "// convenience header\n")
|
||||
foreach(_header ${_REQUIRED_HEADERS})
|
||||
get_filename_component(_base ${_header} NAME)
|
||||
file(APPEND ${COMMON_HEADER} "#include \"${_base}\"\n")
|
||||
endforeach()
|
||||
list(APPEND ${camelcase_forwarding_headers_var} "${COMMON_HEADER}")
|
||||
endif()
|
||||
|
||||
set(${camelcase_forwarding_headers_var} ${${camelcase_forwarding_headers_var}} PARENT_SCOPE)
|
||||
if (EGH_REQUIRED_HEADERS)
|
||||
set(${EGH_REQUIRED_HEADERS} ${${EGH_REQUIRED_HEADERS}} ${_REQUIRED_HEADERS} PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
256
3rdparty/kddockwidgets/cmake/ECM/modules/ECMGeneratePriFile.cmake
vendored
Normal file
256
3rdparty/kddockwidgets/cmake/ECM/modules/ECMGeneratePriFile.cmake
vendored
Normal file
@@ -0,0 +1,256 @@
|
||||
# SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMGeneratePriFile
|
||||
------------------
|
||||
|
||||
Generate a ``.pri`` file for the benefit of qmake-based projects.
|
||||
|
||||
As well as the function below, this module creates the cache variable
|
||||
``ECM_MKSPECS_INSTALL_DIR`` and sets the default value to ``mkspecs/modules``.
|
||||
This assumes Qt and the current project are both installed to the same
|
||||
non-system prefix. Packagers who use ``-DCMAKE_INSTALL_PREFIX=/usr`` will
|
||||
certainly want to set ``ECM_MKSPECS_INSTALL_DIR`` to something like
|
||||
``share/qt5/mkspecs/modules``.
|
||||
|
||||
The main thing is that this should be the ``modules`` subdirectory of either
|
||||
the default qmake ``mkspecs`` directory or of a directory that will be in the
|
||||
``$QMAKEPATH`` environment variable when qmake is run.
|
||||
|
||||
::
|
||||
|
||||
ecm_generate_pri_file(BASE_NAME <baseName>
|
||||
LIB_NAME <libName>
|
||||
[VERSION <version>] # since 5.83
|
||||
[DEPS "<dep> [<dep> [...]]"]
|
||||
[FILENAME_VAR <filename_variable>]
|
||||
[INCLUDE_INSTALL_DIRS <dir> [<dir> [...]]] # since 5.92
|
||||
[INCLUDE_INSTALL_DIR <dir>] # deprecated since 5.92
|
||||
[LIB_INSTALL_DIR <dir>])
|
||||
|
||||
If your CMake project produces a Qt-based library, you may expect there to be
|
||||
applications that wish to use it that use a qmake-based build system, rather
|
||||
than a CMake-based one. Creating a ``.pri`` file will make use of your
|
||||
library convenient for them, in much the same way that CMake config files make
|
||||
things convenient for CMake-based applications. ``ecm_generate_pri_file()``
|
||||
generates just such a file.
|
||||
|
||||
``VERSION`` specifies the version of the library the ``.pri`` file describes. If
|
||||
not set, the value is taken from the context variable ``PROJECT_VERSION``.
|
||||
This variable is usually set by the ``project(... VERSION ...)`` command or,
|
||||
if CMake policy CMP0048 is not ``NEW``, by :module:`ECMSetupVersion`.
|
||||
For backward-compatibility with older ECM versions the
|
||||
``PROJECT_VERSION_STRING`` variable as set by :module:`ECMSetupVersion`
|
||||
will be preferred over ``PROJECT_VERSION`` if set, unless the minimum
|
||||
required version of ECM is 5.83 and newer. Since 5.83.
|
||||
|
||||
``BASE_NAME`` specifies the name qmake project (.pro) files should use to refer to
|
||||
the library (eg: KArchive). ``LIB_NAME`` is the name of the actual library to
|
||||
link to (ie: the first argument to add_library()). ``DEPS`` is a space-separated
|
||||
list of the base names of other libraries (for Qt libraries, use the same
|
||||
names you use with the ``QT`` variable in a qmake project file, such as "core"
|
||||
for QtCore). ``FILENAME_VAR`` specifies the name of a variable to store the path
|
||||
to the generated file in.
|
||||
|
||||
``INCLUDE_INSTALL_DIRS`` are the paths (relative to ``CMAKE_INSTALL_PREFIX``) that
|
||||
include files will be installed to. It defaults to
|
||||
``${INCLUDE_INSTALL_DIR}/<baseName>`` if the ``INCLUDE_INSTALL_DIR`` variable
|
||||
is set. If that variable is not set, the ``CMAKE_INSTALL_INCLUDEDIR`` variable
|
||||
is used instead, and if neither are set ``include`` is used. ``LIB_INSTALL_DIR``
|
||||
operates similarly for the installation location for libraries; it defaults to
|
||||
``${LIB_INSTALL_DIR}``, ``${CMAKE_INSTALL_LIBDIR}`` or ``lib``, in that order.
|
||||
|
||||
``INCLUDE_INSTALL_DIR`` is the old variant of ``INCLUDE_INSTALL_DIRS``, taking only one
|
||||
directory.
|
||||
|
||||
Example usage:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ecm_generate_pri_file(
|
||||
BASE_NAME KArchive
|
||||
LIB_NAME KF5KArchive
|
||||
DEPS "core"
|
||||
FILENAME_VAR pri_filename
|
||||
VERSION 4.2.0
|
||||
)
|
||||
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
|
||||
|
||||
A qmake-based project that wished to use this would then do::
|
||||
|
||||
QT += KArchive
|
||||
|
||||
in their ``.pro`` file.
|
||||
|
||||
Since pre-1.0.0.
|
||||
#]=======================================================================]
|
||||
|
||||
# Replicate the logic from KDEInstallDirs.cmake as we can't depend on it
|
||||
# Ask qmake if we're using the same prefix as Qt
|
||||
set(_should_query_qt OFF)
|
||||
if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
|
||||
include(ECMQueryQt)
|
||||
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
|
||||
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
|
||||
set(_should_query_qt ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _should_query_qt)
|
||||
include(ECMQueryQt)
|
||||
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX)
|
||||
ecm_query_qt(qt_host_data_dir QT_HOST_DATA)
|
||||
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
|
||||
file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
|
||||
endif()
|
||||
if(qt_host_data_dir STREQUAL "")
|
||||
set(mkspecs_install_dir mkspecs/modules)
|
||||
else()
|
||||
set(mkspecs_install_dir ${qt_host_data_dir}/mkspecs/modules)
|
||||
endif()
|
||||
set(ECM_MKSPECS_INSTALL_DIR ${mkspecs_install_dir} CACHE PATH "The directory where mkspecs will be installed to.")
|
||||
else()
|
||||
set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
|
||||
endif()
|
||||
|
||||
function(ECM_GENERATE_PRI_FILE)
|
||||
set(options )
|
||||
set(oneValueArgs BASE_NAME LIB_NAME DEPS FILENAME_VAR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR VERSION)
|
||||
set(multiValueArgs INCLUDE_INSTALL_DIRS)
|
||||
|
||||
cmake_parse_arguments(EGPF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(EGPF_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown keywords given to ECM_GENERATE_PRI_FILE(): \"${EGPF_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0)
|
||||
set(_support_backward_compat_version_string_var TRUE)
|
||||
else()
|
||||
set(_support_backward_compat_version_string_var FALSE)
|
||||
endif()
|
||||
|
||||
if(NOT EGPF_BASE_NAME)
|
||||
message(FATAL_ERROR "Required argument BASE_NAME missing in ECM_GENERATE_PRI_FILE() call")
|
||||
endif()
|
||||
if(NOT EGPF_LIB_NAME)
|
||||
message(FATAL_ERROR "Required argument LIB_NAME missing in ECM_GENERATE_PRI_FILE() call")
|
||||
endif()
|
||||
if(NOT EGPF_VERSION)
|
||||
if(_support_backward_compat_version_string_var)
|
||||
if(NOT PROJECT_VERSION_STRING AND NOT PROJECT_VERSION)
|
||||
message(FATAL_ERROR "Required variable PROJECT_VERSION_STRING or PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
|
||||
endif()
|
||||
else()
|
||||
if(NOT PROJECT_VERSION)
|
||||
message(FATAL_ERROR "Required variable PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(EGPF_INCLUDE_INSTALL_DIR)
|
||||
if(EGPF_INCLUDE_INSTALL_DIRS)
|
||||
message(FATAL_ERROR "Only one argument of INCLUDE_INSTALL_DIR & INCLUDE_INSTALL_DIRS can be used in ECM_GENERATE_PRI_FILE() call")
|
||||
endif()
|
||||
set(EGPF_INCLUDE_INSTALL_DIRS ${EGPF_INCLUDE_INSTALL_DIR})
|
||||
endif()
|
||||
if(NOT EGPF_INCLUDE_INSTALL_DIRS)
|
||||
if(INCLUDE_INSTALL_DIR)
|
||||
set(EGPF_INCLUDE_INSTALL_DIRS "${INCLUDE_INSTALL_DIR}/${EGPF_BASE_NAME}")
|
||||
elseif(CMAKE_INSTALL_INCLUDEDIR)
|
||||
set(EGPF_INCLUDE_INSTALL_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${EGPF_BASE_NAME}")
|
||||
else()
|
||||
set(EGPF_INCLUDE_INSTALL_DIRS "include/${EGPF_BASE_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT EGPF_LIB_INSTALL_DIR)
|
||||
if(LIB_INSTALL_DIR)
|
||||
set(EGPF_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}")
|
||||
elseif(CMAKE_INSTALL_LIBDIR)
|
||||
set(EGPF_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
else()
|
||||
set(EGPF_LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EGPF_VERSION)
|
||||
set(PRI_VERSION "${EGPF_VERSION}")
|
||||
else()
|
||||
if(_support_backward_compat_version_string_var AND PROJECT_VERSION_STRING)
|
||||
set(PRI_VERSION "${PROJECT_VERSION_STRING}")
|
||||
if(NOT PROJECT_VERSION_STRING STREQUAL PROJECT_VERSION)
|
||||
message(DEPRECATION "ECM_GENERATE_PRI_FILE() will no longer support PROJECT_VERSION_STRING when the required minimum version of ECM is 5.83 or newer. Set VERSION parameter or use PROJECT_VERSION instead.")
|
||||
endif()
|
||||
else()
|
||||
set(PRI_VERSION "${PROJECT_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PRI_VERSION_MAJOR "${PRI_VERSION}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" PRI_VERSION_MINOR "${PRI_VERSION}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PRI_VERSION_PATCH "${PRI_VERSION}")
|
||||
|
||||
# Prepare the right number of "../.." to go from ECM_MKSPECS_INSTALL_DIR to the install prefix
|
||||
# This allows to make the generated pri files relocatable (no absolute paths)
|
||||
if (IS_ABSOLUTE ${ECM_MKSPECS_INSTALL_DIR})
|
||||
set(BASEPATH ${CMAKE_INSTALL_PREFIX})
|
||||
else()
|
||||
string(REGEX REPLACE "[^/]+" ".." PRI_ROOT_RELATIVE_TO_MKSPECS ${ECM_MKSPECS_INSTALL_DIR})
|
||||
set(BASEPATH "$$PWD/${PRI_ROOT_RELATIVE_TO_MKSPECS}")
|
||||
endif()
|
||||
|
||||
set(PRI_TARGET_BASENAME ${EGPF_BASE_NAME})
|
||||
set(PRI_TARGET_LIBNAME ${EGPF_LIB_NAME})
|
||||
set(PRI_TARGET_QTDEPS ${EGPF_DEPS})
|
||||
set(PRI_TARGET_INCLUDES)
|
||||
foreach(_dir ${EGPF_INCLUDE_INSTALL_DIRS})
|
||||
# separate list entries with space
|
||||
if(IS_ABSOLUTE "${_dir}")
|
||||
string(APPEND PRI_TARGET_INCLUDES " ${_dir}")
|
||||
else()
|
||||
string(APPEND PRI_TARGET_INCLUDES " ${BASEPATH}/${_dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(IS_ABSOLUTE "${EGPF_LIB_INSTALL_DIR}")
|
||||
set(PRI_TARGET_LIBS "${EGPF_LIB_INSTALL_DIR}")
|
||||
else()
|
||||
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
|
||||
endif()
|
||||
set(PRI_TARGET_DEFINES "")
|
||||
|
||||
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
|
||||
if (EGPF_FILENAME_VAR)
|
||||
set(${EGPF_FILENAME_VAR} ${PRI_FILENAME} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(PRI_TARGET_MODULE_CONFIG "")
|
||||
# backward compat: it was not obvious LIB_NAME needs to be a target name,
|
||||
# and some projects where the target name was not the actual library output name
|
||||
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
|
||||
# TODO: improve API dox, allow control over module name if target name != output name
|
||||
if(TARGET ${EGPF_LIB_NAME})
|
||||
get_target_property(target_type ${EGPF_LIB_NAME} TYPE)
|
||||
if (target_type STREQUAL "STATIC_LIBRARY")
|
||||
set(PRI_TARGET_MODULE_CONFIG "staticlib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT ${PRI_FILENAME}
|
||||
CONTENT
|
||||
"QT.${PRI_TARGET_BASENAME}.VERSION = ${PRI_VERSION}
|
||||
QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
|
||||
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
|
||||
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
|
||||
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
|
||||
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_LIBNAME}
|
||||
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES}
|
||||
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
|
||||
QT.${PRI_TARGET_BASENAME}.private_includes =
|
||||
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}
|
||||
QT.${PRI_TARGET_BASENAME}.depends = ${PRI_TARGET_QTDEPS}
|
||||
QT.${PRI_TARGET_BASENAME}.module_config = ${PRI_TARGET_MODULE_CONFIG}
|
||||
"
|
||||
)
|
||||
endfunction()
|
||||
98
3rdparty/kddockwidgets/cmake/ECM/modules/ECMQueryQt.cmake
vendored
Normal file
98
3rdparty/kddockwidgets/cmake/ECM/modules/ECMQueryQt.cmake
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# SPDX-FileCopyrightText: 2014 Rohan Garg <rohan16garg@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
|
||||
# SPDX-FileCopyrightText: 2014-2016 Aleix Pol <aleixpol@kde.org>
|
||||
# SPDX-FileCopyrightText: 2017 Friedrich W. H. Kossebau <kossebau@kde.org>
|
||||
# SPDX-FileCopyrightText: 2022 Ahmad Samir <a.samir78@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#[=======================================================================[.rst:
|
||||
ECMQueryQt
|
||||
---------------
|
||||
This module can be used to query the installation paths used by Qt.
|
||||
|
||||
For Qt5 this uses ``qmake``, and for Qt6 this used ``qtpaths`` (the latter has built-in
|
||||
support to query the paths of a target platform when cross-compiling).
|
||||
|
||||
This module defines the following function:
|
||||
::
|
||||
|
||||
ecm_query_qt(<result_variable> <qt_variable> [TRY])
|
||||
|
||||
Passing ``TRY`` will result in the method not making the build fail if the executable
|
||||
used for querying has not been found, but instead simply print a warning message and
|
||||
return an empty string.
|
||||
|
||||
Example usage:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
include(ECMQueryQt)
|
||||
ecm_query_qt(bin_dir QT_INSTALL_BINS)
|
||||
|
||||
If the call succeeds ``${bin_dir}`` will be set to ``<prefix>/path/to/bin/dir`` (e.g.
|
||||
``/usr/lib64/qt/bin/``).
|
||||
|
||||
Since: 5.93
|
||||
#]=======================================================================]
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/QtVersionOption.cmake)
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
||||
if (CMAKE_CXX_COMPILER)
|
||||
# Enable the CXX language to let CMake look for config files in library dirs.
|
||||
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/23266
|
||||
enable_language(CXX)
|
||||
endif()
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
# QUIET to accommodate the TRY option
|
||||
find_package(Qt${QT_MAJOR_VERSION}Core QUIET)
|
||||
set(_exec_name_text "Qt5 qmake")
|
||||
if(TARGET Qt5::qmake)
|
||||
get_target_property(_qmake_executable_default Qt5::qmake LOCATION)
|
||||
|
||||
set(QUERY_EXECUTABLE ${_qmake_executable_default})
|
||||
set(_cli_option "-query")
|
||||
endif()
|
||||
elseif(QT_MAJOR_VERSION STREQUAL "6")
|
||||
# QUIET to accommodate the TRY option
|
||||
find_package(Qt6 COMPONENTS CoreTools QUIET CONFIG)
|
||||
set(_exec_name_text "Qt6 qtpaths")
|
||||
if (TARGET Qt6::qtpaths)
|
||||
get_target_property(_qtpaths_executable Qt6::qtpaths LOCATION)
|
||||
|
||||
set(QUERY_EXECUTABLE ${_qtpaths_executable})
|
||||
set(_cli_option "--query")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(ecm_query_qt result_variable qt_variable)
|
||||
set(options TRY)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs)
|
||||
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT QUERY_EXECUTABLE)
|
||||
if(ARGS_TRY)
|
||||
set(${result_variable} "" PARENT_SCOPE)
|
||||
message(STATUS "No ${_exec_name_text} executable found. Can't check ${qt_variable}")
|
||||
return()
|
||||
else()
|
||||
message(FATAL_ERROR "No ${_exec_name_text} executable found. Can't check ${qt_variable} as required")
|
||||
endif()
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${QUERY_EXECUTABLE} ${_cli_option} "${qt_variable}"
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE output
|
||||
)
|
||||
if(return_code EQUAL 0)
|
||||
string(STRIP "${output}" output)
|
||||
file(TO_CMAKE_PATH "${output}" output_path)
|
||||
set(${result_variable} "${output_path}" PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "Failed call: ${QUERY_EXECUTABLE} ${_cli_option} ${qt_variable}")
|
||||
message(FATAL_ERROR "${_exec_name_text} call failed: ${return_code}")
|
||||
endif()
|
||||
endfunction()
|
||||
213
3rdparty/kddockwidgets/cmake/ECM/modules/ECMSetupVersion.cmake
vendored
Normal file
213
3rdparty/kddockwidgets/cmake/ECM/modules/ECMSetupVersion.cmake
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
|
||||
# SPDX-FileCopyrightText: 2012 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMSetupVersion
|
||||
---------------
|
||||
|
||||
Handle library version information.
|
||||
|
||||
::
|
||||
|
||||
ecm_setup_version(<version>
|
||||
VARIABLE_PREFIX <prefix>
|
||||
[SOVERSION <soversion>]
|
||||
[VERSION_HEADER <filename>]
|
||||
[PACKAGE_VERSION_FILE <filename> [COMPATIBILITY <compat>]] )
|
||||
|
||||
This parses a version string and sets up a standard set of version variables.
|
||||
It can optionally also create a C version header file and a CMake package
|
||||
version file to install along with the library.
|
||||
|
||||
If the ``<version>`` argument is of the form ``<major>.<minor>.<patch>``
|
||||
(or ``<major>.<minor>.<patch>.<tweak>``), The following CMake variables are
|
||||
set::
|
||||
|
||||
<prefix>_VERSION_MAJOR - <major>
|
||||
<prefix>_VERSION_MINOR - <minor>
|
||||
<prefix>_VERSION_PATCH - <patch>
|
||||
<prefix>_VERSION - <version>
|
||||
<prefix>_SOVERSION - <soversion>, or <major> if SOVERSION was not given
|
||||
|
||||
For backward-compatibility also this variable is set (only if the minimum required
|
||||
version of ECM is < 5.83)::
|
||||
|
||||
<prefix>_VERSION_STRING - <version> (use <prefix>_VERSION instead)
|
||||
|
||||
If CMake policy CMP0048 is not ``NEW``, the following CMake variables will also
|
||||
be set::
|
||||
|
||||
PROJECT_VERSION_MAJOR - <major>
|
||||
PROJECT_VERSION_MINOR - <minor>
|
||||
PROJECT_VERSION_PATCH - <patch>
|
||||
PROJECT_VERSION - <version>
|
||||
|
||||
For backward-compatibility, if CMake policy CMP0048 is not ``NEW``, also this variable is set
|
||||
(only if the minimum required version of ECM is < 5.83)::
|
||||
|
||||
PROJECT_VERSION_STRING - <version> (use PROJECT_VERSION instead)
|
||||
|
||||
If the ``VERSION_HEADER`` option is used, a simple C header is generated with the
|
||||
given filename. If filename is a relative path, it is interpreted as relative
|
||||
to ``CMAKE_CURRENT_BINARY_DIR``. The generated header contains the following
|
||||
macros::
|
||||
|
||||
<prefix>_VERSION_MAJOR - <major> as an integer
|
||||
<prefix>_VERSION_MINOR - <minor> as an integer
|
||||
<prefix>_VERSION_PATCH - <patch> as an integer
|
||||
<prefix>_VERSION_STRING - <version> as a C string
|
||||
<prefix>_VERSION - the version as an integer
|
||||
|
||||
``<prefix>_VERSION`` has ``<patch>`` in the bottom 8 bits, ``<minor>`` in the
|
||||
next 8 bits and ``<major>`` in the remaining bits. Note that ``<patch>`` and
|
||||
``<minor>`` must be less than 256.
|
||||
|
||||
If the ``PACKAGE_VERSION_FILE`` option is used, a simple CMake package version
|
||||
file is created using the ``write_basic_package_version_file()`` macro provided by
|
||||
CMake. It should be installed in the same location as the Config.cmake file of
|
||||
the library so that it can be found by ``find_package()``. If the filename is a
|
||||
relative path, it is interpreted as relative to ``CMAKE_CURRENT_BINARY_DIR``. The
|
||||
optional ``COMPATIBILITY`` option is forwarded to
|
||||
``write_basic_package_version_file()``, and defaults to ``AnyNewerVersion``.
|
||||
|
||||
If CMake policy CMP0048 is ``NEW``, an alternative form of the command is
|
||||
available::
|
||||
|
||||
ecm_setup_version(PROJECT
|
||||
[VARIABLE_PREFIX <prefix>]
|
||||
[SOVERSION <soversion>]
|
||||
[VERSION_HEADER <filename>]
|
||||
[PACKAGE_VERSION_FILE <filename>] )
|
||||
|
||||
This will use the version information set by the ``project()`` command.
|
||||
``VARIABLE_PREFIX`` defaults to the project name. Note that ``PROJECT`` must be the
|
||||
first argument. In all other respects, it behaves like the other form of the
|
||||
command.
|
||||
|
||||
Since pre-1.0.0.
|
||||
|
||||
``COMPATIBILITY`` option available since 1.6.0.
|
||||
#]=======================================================================]
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# save the location of the header template while CMAKE_CURRENT_LIST_DIR
|
||||
# has the value we want
|
||||
set(_ECM_SETUP_VERSION_HEADER_TEMPLATE "${CMAKE_CURRENT_LIST_DIR}/ECMVersionHeader.h.in")
|
||||
|
||||
function(ecm_setup_version _version)
|
||||
set(options )
|
||||
set(oneValueArgs VARIABLE_PREFIX SOVERSION VERSION_HEADER PACKAGE_VERSION_FILE COMPATIBILITY)
|
||||
set(multiValueArgs )
|
||||
|
||||
cmake_parse_arguments(ESV "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(ESV_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown keywords given to ECM_SETUP_VERSION(): \"${ESV_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
set(project_manages_version FALSE)
|
||||
set(use_project_version FALSE)
|
||||
cmake_policy(GET CMP0048 project_version_policy)
|
||||
if(project_version_policy STREQUAL "NEW")
|
||||
set(project_manages_version TRUE)
|
||||
if(_version STREQUAL "PROJECT")
|
||||
set(use_project_version TRUE)
|
||||
endif()
|
||||
elseif(_version STREQUAL "PROJECT")
|
||||
message(FATAL_ERROR "ecm_setup_version given PROJECT argument, but CMP0048 is not NEW")
|
||||
endif()
|
||||
|
||||
set(should_set_prefixed_vars TRUE)
|
||||
if(NOT ESV_VARIABLE_PREFIX)
|
||||
if(use_project_version)
|
||||
set(ESV_VARIABLE_PREFIX "${PROJECT_NAME}")
|
||||
set(should_set_prefixed_vars FALSE)
|
||||
else()
|
||||
message(FATAL_ERROR "Required argument PREFIX missing in ECM_SETUP_VERSION() call")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(use_project_version)
|
||||
set(_version "${PROJECT_VERSION}")
|
||||
# drop leading 0 from values to avoid bogus octal values in c/C++ e.g. with 08 or 09
|
||||
string(REGEX REPLACE "0*([0-9]+)" "\\1" _major "${PROJECT_VERSION_MAJOR}")
|
||||
string(REGEX REPLACE "0*([0-9]+)" "\\1" _minor "${PROJECT_VERSION_MINOR}")
|
||||
string(REGEX REPLACE "0*([0-9]+)" "\\1" _patch "${PROJECT_VERSION_PATCH}")
|
||||
else()
|
||||
string(REGEX REPLACE "^0*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major "${_version}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.0*([0-9]+)\\.[0-9]+.*" "\\1" _minor "${_version}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.0*([0-9]+).*" "\\1" _patch "${_version}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ESV_SOVERSION) # use DEFINED, so "0" as valid SO version is not evaluated to FALSE
|
||||
set(ESV_SOVERSION ${_major})
|
||||
endif()
|
||||
|
||||
if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0)
|
||||
set(_set_backward_compat_version_string_vars TRUE)
|
||||
else()
|
||||
set(_set_backward_compat_version_string_vars FALSE)
|
||||
endif()
|
||||
|
||||
if(should_set_prefixed_vars)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION "${_version}")
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_MAJOR ${_major})
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_MINOR ${_minor})
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_PATCH ${_patch})
|
||||
endif()
|
||||
|
||||
set(${ESV_VARIABLE_PREFIX}_SOVERSION ${ESV_SOVERSION})
|
||||
|
||||
if(NOT project_manages_version)
|
||||
set(PROJECT_VERSION "${_version}")
|
||||
set(PROJECT_VERSION_MAJOR "${_major}")
|
||||
set(PROJECT_VERSION_MINOR "${_minor}")
|
||||
set(PROJECT_VERSION_PATCH "${_patch}")
|
||||
endif()
|
||||
|
||||
if(_set_backward_compat_version_string_vars)
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION}")
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}")
|
||||
endif()
|
||||
|
||||
if(ESV_VERSION_HEADER)
|
||||
set(HEADER_PREFIX "${ESV_VARIABLE_PREFIX}")
|
||||
set(HEADER_VERSION "${_version}")
|
||||
set(HEADER_VERSION_MAJOR "${_major}")
|
||||
set(HEADER_VERSION_MINOR "${_minor}")
|
||||
set(HEADER_VERSION_PATCH "${_patch}")
|
||||
configure_file("${_ECM_SETUP_VERSION_HEADER_TEMPLATE}" "${ESV_VERSION_HEADER}")
|
||||
endif()
|
||||
|
||||
if(ESV_PACKAGE_VERSION_FILE)
|
||||
if(NOT ESV_COMPATIBILITY)
|
||||
set(ESV_COMPATIBILITY AnyNewerVersion)
|
||||
endif()
|
||||
write_basic_package_version_file("${ESV_PACKAGE_VERSION_FILE}" VERSION ${_version} COMPATIBILITY ${ESV_COMPATIBILITY})
|
||||
endif()
|
||||
|
||||
if(should_set_prefixed_vars)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_MAJOR "${${ESV_VARIABLE_PREFIX}_VERSION_MAJOR}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_MINOR "${${ESV_VARIABLE_PREFIX}_VERSION_MINOR}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_PATCH "${${ESV_VARIABLE_PREFIX}_VERSION_PATCH}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# always set the soversion
|
||||
set(${ESV_VARIABLE_PREFIX}_SOVERSION "${${ESV_VARIABLE_PREFIX}_SOVERSION}" PARENT_SCOPE)
|
||||
|
||||
if(NOT project_manages_version)
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION}" PARENT_SCOPE)
|
||||
set(PROJECT_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}" PARENT_SCOPE)
|
||||
set(PROJECT_VERSION_MINOR "${PROJECT_VERSION_MINOR}" PARENT_SCOPE)
|
||||
set(PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(_set_backward_compat_version_string_vars)
|
||||
set(PROJECT_VERSION_STRING "${PROJECT_VERSION_STRING}" PARENT_SCOPE)
|
||||
set(${ESV_VARIABLE_PREFIX}_VERSION_STRING "${${ESV_VARIABLE_PREFIX}_VERSION}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
50
3rdparty/kddockwidgets/cmake/ECM/modules/ECMUninstallTarget.cmake
vendored
Normal file
50
3rdparty/kddockwidgets/cmake/ECM/modules/ECMUninstallTarget.cmake
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# SPDX-FileCopyrightText: 2015 Alex Merry <alex.merry@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
ECMUninstallTarget
|
||||
------------------
|
||||
|
||||
Add an ``uninstall`` target.
|
||||
|
||||
By including this module, an ``uninstall`` target will be added to your CMake
|
||||
project. This will remove all files installed (or updated) by a previous
|
||||
invocation of the ``install`` target. It will not remove files created or
|
||||
modified by an ``install(SCRIPT)`` or ``install(CODE)`` command; you should
|
||||
create a custom uninstallation target for these and use ``add_dependency`` to
|
||||
make the ``uninstall`` target depend on it:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
include(ECMUninstallTarget)
|
||||
install(SCRIPT install-foo.cmake)
|
||||
add_custom_target(uninstall_foo COMMAND ${CMAKE_COMMAND} -P uninstall-foo.cmake)
|
||||
add_dependency(uninstall uninstall_foo)
|
||||
|
||||
The target will fail if the ``install`` target has not yet been run (so it is
|
||||
not possible to run CMake on the project and then immediately run the
|
||||
``uninstall`` target).
|
||||
|
||||
.. warning::
|
||||
|
||||
CMake deliberately does not provide an ``uninstall`` target by default on
|
||||
the basis that such a target has the potential to remove important files
|
||||
from a user's computer. Use with caution.
|
||||
|
||||
Since 1.7.0.
|
||||
#]=======================================================================]
|
||||
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ecm_uninstall.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/ecm_uninstall.cmake"
|
||||
IMMEDIATE
|
||||
@ONLY
|
||||
)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/ecm_uninstall.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
)
|
||||
endif()
|
||||
17
3rdparty/kddockwidgets/cmake/ECM/modules/ECMVersionHeader.h.in
vendored
Normal file
17
3rdparty/kddockwidgets/cmake/ECM/modules/ECMVersionHeader.h.in
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// This file was generated by ecm_setup_version(): DO NOT EDIT!
|
||||
|
||||
#ifndef @HEADER_PREFIX@_VERSION_H
|
||||
#define @HEADER_PREFIX@_VERSION_H
|
||||
|
||||
#define @HEADER_PREFIX@_VERSION_STRING "@HEADER_VERSION@"
|
||||
#define @HEADER_PREFIX@_VERSION_MAJOR @HEADER_VERSION_MAJOR@
|
||||
#define @HEADER_PREFIX@_VERSION_MINOR @HEADER_VERSION_MINOR@
|
||||
#define @HEADER_PREFIX@_VERSION_PATCH @HEADER_VERSION_PATCH@
|
||||
#define @HEADER_PREFIX@_VERSION @HEADER_PREFIX@_VERSION_CHECK(@HEADER_PREFIX@_VERSION_MAJOR, @HEADER_PREFIX@_VERSION_MINOR, @HEADER_PREFIX@_VERSION_PATCH)
|
||||
|
||||
/*
|
||||
for example: @HEADER_PREFIX@_VERSION >= @HEADER_PREFIX@_VERSION_CHECK(1, 2, 2))
|
||||
*/
|
||||
#define @HEADER_PREFIX@_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
||||
|
||||
#endif
|
||||
43
3rdparty/kddockwidgets/cmake/ECM/modules/QtVersionOption.cmake
vendored
Normal file
43
3rdparty/kddockwidgets/cmake/ECM/modules/QtVersionOption.cmake
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
QtVersionOption
|
||||
---------------
|
||||
|
||||
Adds a build option to select the major Qt version if necessary,
|
||||
that is, if the major Qt version has not yet been determined otherwise
|
||||
(e.g. by a corresponding ``find_package()`` call).
|
||||
This module is typically included by other modules requiring knowledge
|
||||
about the major Qt version.
|
||||
|
||||
If the ECM version passed to find_package was at least 5.240.0 Qt6 is picked by default.
|
||||
Otherwise Qt5 is picked.
|
||||
|
||||
``QT_MAJOR_VERSION`` is defined to either be "5" or "6".
|
||||
|
||||
Since 5.82.0.
|
||||
#]=======================================================================]
|
||||
|
||||
if (DEFINED QT_MAJOR_VERSION)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (TARGET Qt5::Core)
|
||||
set(QT_MAJOR_VERSION 5)
|
||||
elseif (TARGET Qt6::Core)
|
||||
set(QT_MAJOR_VERSION 6)
|
||||
else()
|
||||
if (ECM_GLOBAL_FIND_VERSION VERSION_GREATER_EQUAL 5.240)
|
||||
option(BUILD_WITH_QT6 "Build against Qt 6" ON)
|
||||
else()
|
||||
option(BUILD_WITH_QT6 "Build against Qt 6" OFF)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_QT6)
|
||||
set(QT_MAJOR_VERSION 6)
|
||||
else()
|
||||
set(QT_MAJOR_VERSION 5)
|
||||
endif()
|
||||
endif()
|
||||
21
3rdparty/kddockwidgets/cmake/ECM/modules/ecm_uninstall.cmake.in
vendored
Normal file
21
3rdparty/kddockwidgets/cmake/ECM/modules/ecm_uninstall.cmake.in
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
endif()
|
||||
|
||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif()
|
||||
endforeach()
|
||||
163
3rdparty/kddockwidgets/cmake/KDAB/modules/FindPySide2.cmake
vendored
Normal file
163
3rdparty/kddockwidgets/cmake/KDAB/modules/FindPySide2.cmake
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# PYSIDE_BASEDIR - Top of the PySide2 installation
|
||||
# PYSIDE_INCLUDE_DIR - Directories to include to use PySide2
|
||||
# PYSIDE_LIBRARY - Files to link against to use PySide2
|
||||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide2
|
||||
#
|
||||
# You can install PySide2 from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside2
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PYSIDE2_PRIV QUIET pyside2)
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND FALSE)
|
||||
|
||||
if(PYSIDE2_PRIV_FOUND)
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "Using PySide2 found in the system!")
|
||||
pkg_get_variable(SHIBOKEN_BINARY pyside2 generator_location)
|
||||
pkg_get_variable(PYSIDE2_BASEDIR pyside2 typesystemdir)
|
||||
pkg_get_variable(PYSIDE_INCLUDE_DIR pyside2 includedir)
|
||||
set(PYSIDE_TYPESYSTEMS ${PYSIDE2_BASEDIR})
|
||||
set(PYSIDE2_SO_VERSION ${PYSIDE2_PRIV_VERSION})
|
||||
set(PYSIDE_LIBRARY ${PYSIDE2_PRIV_LINK_LIBRARIES})
|
||||
list(GET PYSIDE_LIBRARY 0 PYSIDE_LIBRARY)
|
||||
else()
|
||||
# extract python library basename
|
||||
list(GET Python3_LIBRARIES 0 PYTHON_LIBRARY_FILENAME)
|
||||
get_filename_component(PYTHON_LIBRARY_FILENAME ${PYTHON_LIBRARY_FILENAME} NAME)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os, sys
|
||||
try:
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PYSIDE2_BASEDIR)
|
||||
message(FATAL_ERROR "The PySide2 module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
|
||||
set(PYSIDE_BASEDIR
|
||||
${PYSIDE2_BASEDIR}
|
||||
CACHE PATH "Top level install of PySide2" FORCE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide2.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE2_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET PYSIDE2_SO_VERSION 0 PYSIDE2_SO_MACRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 1 PYSIDE2_SO_MICRO_VERSION)
|
||||
list(GET PYSIDE2_SO_VERSION 2 PYSIDE2_SO_MINOR_VERSION)
|
||||
string(REPLACE ";" "." PYSIDE2_SO_VERSION "${PYSIDE2_SO_VERSION}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}")
|
||||
else()
|
||||
string(REPLACE ".so" "" PYSIDE2_SUFFIX ${PYSIDE2_SUFFIX})
|
||||
set(PYSIDE2_SUFFIX "${PYSIDE2_SUFFIX}.${PYSIDE2_SO_MACRO_VERSION}.${PYSIDE2_SO_MICRO_VERSION}.dylib")
|
||||
endif()
|
||||
|
||||
set(PYSIDE2_FOUND TRUE)
|
||||
message(STATUS "PySide2 base dir: ${PYSIDE2_BASEDIR}")
|
||||
message(STATUS "PySide2 suffix: ${PYSIDE2_SUFFIX}")
|
||||
|
||||
#PySide
|
||||
#===============================================================================
|
||||
if(PYSIDE_CUSTOM_PREFIX STREQUAL "")
|
||||
set(PYSIDE_CUSTOM_PREFIX ${PYSIDE2_BASEDIR})
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
PYSIDE_INCLUDE_DIR pyside.h
|
||||
PATHS ${PYSIDE2_BASEDIR}/include ${PYSIDE_CUSTOM_PREFIX}/include/PySide2
|
||||
NO_DEFAULT_PATH NO_CACHE NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "pyside2.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
else()
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside2.${PYSIDE2_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_file(
|
||||
PYSIDE_LIBRARY ${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE2_BASEDIR} ${PYSIDE_CUSTOM_PREFIX}/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_path(
|
||||
PYSIDE_TYPESYSTEMS typesystem_core.xml
|
||||
PATHS ${PYSIDE2_BASEDIR}/typesystems ${PYSIDE_CUSTOM_PREFIX}/share/PySide2/typesystems
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PYSIDE2_FOUND)
|
||||
message(STATUS "PySide include dir: ${PYSIDE_INCLUDE_DIR}")
|
||||
message(STATUS "PySide library: ${PYSIDE_LIBRARY}")
|
||||
message(STATUS "PySide typesystems: ${PYSIDE_TYPESYSTEMS}")
|
||||
message(STATUS "PySide2 version: ${PYSIDE2_SO_VERSION}")
|
||||
|
||||
# Create PySide2 target
|
||||
add_library(PySide2::pyside2 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET PySide2::pyside2 PROPERTY IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(
|
||||
TARGET PySide2::pyside2
|
||||
APPEND
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${PYSIDE_INCLUDE_DIR}
|
||||
${PYSIDE_INCLUDE_DIR}/QtCore/
|
||||
${PYSIDE_INCLUDE_DIR}/QtGui/
|
||||
${PYSIDE_INCLUDE_DIR}/QtWidgets/
|
||||
${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
PySide2
|
||||
REQUIRED_VARS PYSIDE2_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE2_SO_VERSION
|
||||
)
|
||||
147
3rdparty/kddockwidgets/cmake/KDAB/modules/FindPySide6.cmake
vendored
Normal file
147
3rdparty/kddockwidgets/cmake/KDAB/modules/FindPySide6.cmake
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# PYSIDE_BASEDIR - Top of the PySide6 installation
|
||||
# PYSIDE_INCLUDE_DIR - Directories to include to use PySide6
|
||||
# PYSIDE_LIBRARY - Files to link against to use PySide6
|
||||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide6
|
||||
#
|
||||
# You can install PySide6 from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython --trusted-host download.qt.io pyside6
|
||||
|
||||
set(PYSIDE6_FOUND FALSE)
|
||||
|
||||
# extract python library basename
|
||||
list(GET Python3_LIBRARIES 0 PYTHON_LIBRARY_FILENAME)
|
||||
get_filename_component(PYTHON_LIBRARY_FILENAME ${PYTHON_LIBRARY_FILENAME} NAME)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os, sys
|
||||
try:
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.dirname(QtCore.__file__))
|
||||
except Exception as error:
|
||||
print(error, file=sys.stderr)
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PYSIDE6_BASEDIR)
|
||||
message(FATAL_ERROR "The PySide6 module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PYSIDE6_BASEDIR)
|
||||
set(PYSIDE_BASEDIR
|
||||
${PYSIDE6_BASEDIR}
|
||||
CACHE PATH "Top level install of PySide6" FORCE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(os.path.basename(QtCore.__file__).split('.', 1)[1])
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SUFFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import PySide6.QtCore as QtCore
|
||||
print(';'.join(map(str, QtCore.__version_info__)))
|
||||
"
|
||||
OUTPUT_VARIABLE PYSIDE6_SO_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET PYSIDE6_SO_VERSION 0 PYSIDE6_SO_MACRO_VERSION)
|
||||
list(GET PYSIDE6_SO_VERSION 1 PYSIDE6_SO_MICRO_VERSION)
|
||||
list(GET PYSIDE6_SO_VERSION 2 PYSIDE6_SO_MINOR_VERSION)
|
||||
string(REPLACE ";" "." PYSIDE6_SO_VERSION "${PYSIDE6_SO_VERSION}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(PYSIDE6_SUFFIX "${PYSIDE6_SUFFIX}.${PYSIDE6_SO_MACRO_VERSION}.${PYSIDE6_SO_MICRO_VERSION}")
|
||||
else()
|
||||
string(REPLACE ".so" "" PYSIDE6_SUFFIX ${PYSIDE6_SUFFIX})
|
||||
set(PYSIDE6_SUFFIX "${PYSIDE6_SUFFIX}.${PYSIDE6_SO_MACRO_VERSION}.${PYSIDE6_SO_MICRO_VERSION}.dylib")
|
||||
endif()
|
||||
|
||||
set(PYSIDE6_FOUND TRUE)
|
||||
message(STATUS "PySide6 base dir: ${PYSIDE6_BASEDIR}")
|
||||
message(STATUS "PySide6 suffix: ${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(PYSIDE6_FOUND)
|
||||
#PySide
|
||||
#===============================================================================
|
||||
find_path(
|
||||
PYSIDE_INCLUDE_DIR pyside.h
|
||||
PATH_SUFFIXES PySide6
|
||||
PATHS ${PYSIDE6_BASEDIR}/include ${PYSIDE_CUSTOM_PREFIX}/include
|
||||
)
|
||||
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "pyside6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
else()
|
||||
set(PYSIDE_LIBRARY_BASENAMES "libpyside6.${PYSIDE6_SUFFIX}")
|
||||
endif()
|
||||
|
||||
find_library(
|
||||
PYSIDE_LIBRARY
|
||||
NAMES ${PYSIDE_LIBRARY_BASENAMES}
|
||||
PATHS ${PYSIDE6_BASEDIR} ${PYSIDE_CUSTOM_PREFIX}/lib
|
||||
)
|
||||
|
||||
find_path(
|
||||
PYSIDE_TYPESYSTEMS typesystem_core.xml
|
||||
PATHS ${PYSIDE6_BASEDIR}/typesystems ${PYSIDE_CUSTOM_PREFIX}/share/PySide6/typesystems
|
||||
/usr/share/PySide6/typesystems
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PYSIDE6_FOUND)
|
||||
message(STATUS "PySide include dir: ${PYSIDE_INCLUDE_DIR}")
|
||||
message(STATUS "PySide library: ${PYSIDE_LIBRARY}")
|
||||
message(STATUS "PySide typesystems: ${PYSIDE_TYPESYSTEMS}")
|
||||
message(STATUS "PySide6 version: ${PYSIDE6_SO_VERSION}")
|
||||
|
||||
# Create PySide6 target
|
||||
add_library(PySide6::pyside6 SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY IMPORTED_IMPLIB ${PYSIDE_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET PySide6::pyside6 PROPERTY IMPORTED_LOCATION ${PYSIDE_LIBRARY})
|
||||
set_property(
|
||||
TARGET PySide6::pyside6
|
||||
APPEND
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
${PYSIDE_INCLUDE_DIR}
|
||||
${PYSIDE_INCLUDE_DIR}/QtCore/
|
||||
${PYSIDE_INCLUDE_DIR}/QtGui/
|
||||
${PYSIDE_INCLUDE_DIR}/QtWidgets/
|
||||
${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
PySide6
|
||||
REQUIRED_VARS PYSIDE6_BASEDIR PYSIDE_INCLUDE_DIR PYSIDE_LIBRARY PYSIDE_TYPESYSTEMS
|
||||
VERSION_VAR PYSIDE6_SO_VERSION
|
||||
)
|
||||
201
3rdparty/kddockwidgets/cmake/KDAB/modules/FindShiboken2.cmake
vendored
Normal file
201
3rdparty/kddockwidgets/cmake/KDAB/modules/FindShiboken2.cmake
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
|
||||
# SHIBOKEN_LIBRARY - Files to link against to use SHIBOKEN
|
||||
# SHIBOKEN_BINARY - Executable name
|
||||
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
|
||||
|
||||
# You can install Shiboken from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython \
|
||||
# --trusted-host download.qt.io shiboken2-generator
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(SHIBOKEN2_PRIV QUIET shiboken2)
|
||||
endif()
|
||||
|
||||
set(SHIBOKEN_FOUND FALSE)
|
||||
|
||||
if(SHIBOKEN2_PRIV_FOUND)
|
||||
set(SHIBOKEN_FOUND TRUE)
|
||||
message(STATUS "Using shiboken found in the system!")
|
||||
pkg_get_variable(SHIBOKEN_BINARY shiboken2 generator_location)
|
||||
pkg_get_variable(SHIBOKEN_BASEDIR shiboken2 libdir)
|
||||
pkg_get_variable(SHIBOKEN_INCLUDE_DIR shiboken2 includedir)
|
||||
set(SHIBOKEN_VERSION ${SHIBOKEN2_PRIV_VERSION})
|
||||
set(SHIBOKEN_LIBRARY ${SHIBOKEN2_PRIV_LINK_LIBRARIES})
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken2_generator
|
||||
print(shiboken2_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_GENERATOR_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken2_generator module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken2
|
||||
print(shiboken2.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken2 module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import shiboken2
|
||||
print(';'.join(filter(None, map(str, shiboken2.__version_info__))))
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET SHIBOKEN_VERSION 0 SHIBOKEN_MACRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 1 SHIBOKEN_MICRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 2 SHIBOKEN_MINOR_VERSION)
|
||||
string(REPLACE ";" "." SHIBOKEN_VERSION "${SHIBOKEN_VERSION}")
|
||||
|
||||
if(SHIBOKEN_CUSTOM_PREFIX STREQUAL "")
|
||||
set(SHIBOKEN_CUSTOM_PREFIX ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
endif()
|
||||
|
||||
message(STATUS "ShibokenGenerator base dir: ${SHIBOKEN_GENERATOR_BASEDIR}")
|
||||
message(STATUS "Shiboken base dir: ${SHIBOKEN_BASEDIR}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PREFIX}")
|
||||
|
||||
if(SHIBOKEN_BASEDIR)
|
||||
find_path(
|
||||
SHIBOKEN_INCLUDE_DIR shiboken.h
|
||||
PATHS ${SHIBOKEN_CUSTOM_PREFIX} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
NO_DEFAULT_PATH NO_CACHE NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
if(MSVC)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "shiboken2.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "libshiboken2.${PYSIDE2_SUFFIX}")
|
||||
elseif(APPLE)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.dylib libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken2.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
)
|
||||
else()
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken2.abi3.so libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken2.abi3.so.${SHIBOKEN_VERSION}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
return()
|
||||
endif()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PREFIX})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
find_file(
|
||||
SHIBOKEN_LIBRARY ${SHIBOKEN_LIBRARY_BASENAMES}
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_program(
|
||||
SHIBOKEN_BINARY shiboken2
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
if(SHIBOKEN_INCLUDE_DIR
|
||||
AND SHIBOKEN_LIBRARY
|
||||
AND SHIBOKEN_BINARY
|
||||
)
|
||||
set(SHIBOKEN_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(SHIBOKEN_FOUND)
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# On Windows we must link to python3.dll that is a small library that links against python3x.dll
|
||||
# that allow us to choose any python3x.dll at runtime
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
for lib in '${Python3_LIBRARIES}'.split(';'):
|
||||
if '/' in lib:
|
||||
prefix, py = lib.rsplit('/', 1)
|
||||
if py.startswith('python3'):
|
||||
print(prefix + '/python3.lib')
|
||||
break
|
||||
"
|
||||
OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
set(PYTHON_LIMITED_LIBRARIES "")
|
||||
endif()
|
||||
endif()
|
||||
if(SHIBOKEN_FOUND)
|
||||
message(STATUS "Shiboken include dir: ${SHIBOKEN_INCLUDE_DIR}")
|
||||
message(STATUS "Shiboken library: ${SHIBOKEN_LIBRARY}")
|
||||
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
|
||||
message(STATUS "Shiboken version: ${SHIBOKEN_VERSION}")
|
||||
|
||||
# Create shiboke2 target
|
||||
add_library(Shiboken2::libshiboken SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET Shiboken2::libshiboken PROPERTY IMPORTED_IMPLIB ${SHIBOKEN_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET Shiboken2::libshiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(
|
||||
TARGET Shiboken2::libshiboken
|
||||
APPEND
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
set_property(
|
||||
TARGET Shiboken2::libshiboken
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES}
|
||||
)
|
||||
|
||||
# Generator target
|
||||
add_executable(Shiboken2::shiboken IMPORTED GLOBAL)
|
||||
set_property(TARGET Shiboken2::shiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
Shiboken2
|
||||
REQUIRED_VARS SHIBOKEN_BASEDIR SHIBOKEN_INCLUDE_DIR SHIBOKEN_LIBRARY SHIBOKEN_BINARY
|
||||
VERSION_VAR SHIBOKEN_VERSION
|
||||
)
|
||||
181
3rdparty/kddockwidgets/cmake/KDAB/modules/FindShiboken6.cmake
vendored
Normal file
181
3rdparty/kddockwidgets/cmake/KDAB/modules/FindShiboken6.cmake
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
|
||||
# SHIBOKEN_LIBRARY - Files to link against to use SHIBOKEN
|
||||
# SHIBOKEN_BINARY - Executable name
|
||||
# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
|
||||
|
||||
# You can install Shiboken from Qt repository with
|
||||
# pip3 install --index-url=https://download.qt.io/official_releases/QtForPython \
|
||||
# --trusted-host download.qt.io shiboken6-generator
|
||||
|
||||
set(SHIBOKEN_FOUND FALSE)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken6_generator
|
||||
print(shiboken6_generator.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_GENERATOR_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_GENERATOR_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken6_generator module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
try:
|
||||
import shiboken6
|
||||
print(shiboken6.__path__[0])
|
||||
except:
|
||||
exit()
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_BASEDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT SHIBOKEN_BASEDIR)
|
||||
message(FATAL_ERROR "The shiboken6 module could not be imported. Make sure you have it installed "
|
||||
"by checking the output of \"pip${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} list\""
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
import os
|
||||
import shiboken6
|
||||
print(';'.join(filter(None, map(str, shiboken6.__version_info__))))
|
||||
"
|
||||
OUTPUT_VARIABLE SHIBOKEN_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
list(GET SHIBOKEN_VERSION 0 SHIBOKEN_MACRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 1 SHIBOKEN_MICRO_VERSION)
|
||||
list(GET SHIBOKEN_VERSION 2 SHIBOKEN_MINOR_VERSION)
|
||||
string(REPLACE ";" "." SHIBOKEN_VERSION "${SHIBOKEN_VERSION}")
|
||||
|
||||
message(STATUS "ShibokenGenerator base dir: ${SHIBOKEN_GENERATOR_BASEDIR}")
|
||||
message(STATUS "Shiboken base dir: ${SHIBOKEN_BASEDIR}")
|
||||
message(STATUS "Shiboken custom path: ${SHIBOKEN_CUSTOM_PREFIX}")
|
||||
|
||||
if(SHIBOKEN_BASEDIR)
|
||||
# Alternatively we could do find_package(Shiboken6Tools)?
|
||||
find_path(
|
||||
SHIBOKEN_INCLUDE_DIR shiboken.h
|
||||
PATH_SUFFIXES shiboken6
|
||||
PATHS ${SHIBOKEN_CUSTOM_PREFIX} ${SHIBOKEN_GENERATOR_BASEDIR}/include
|
||||
)
|
||||
if(MSVC)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "shiboken6.abi3.lib")
|
||||
elseif(CYGWIN)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "")
|
||||
elseif(WIN32)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES "libshiboken6.${PYSIDE2_SUFFIX}")
|
||||
elseif(APPLE)
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.dylib libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}.dylib
|
||||
libshiboken6.abi3.${SHIBOKEN_VERSION}.dylib
|
||||
)
|
||||
else()
|
||||
set(SHIBOKEN_LIBRARY_BASENAMES
|
||||
libshiboken6.abi3.so libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_MACRO_VERSION}.${SHIBOKEN_MICRO_VERSION}
|
||||
libshiboken6.abi3.so.${SHIBOKEN_VERSION}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
message(STATUS "No include dir found for Shiboken")
|
||||
return()
|
||||
endif()
|
||||
set(SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_CUSTOM_PREFIX})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_BASEDIR})
|
||||
list(APPEND SHIBOKEN_SEARCH_PATHS ${SHIBOKEN_GENERATOR_BASEDIR})
|
||||
find_library(
|
||||
SHIBOKEN_LIBRARY
|
||||
NAMES ${SHIBOKEN_LIBRARY_BASENAMES}
|
||||
PATHS ${SHIBOKEN_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
find_program(SHIBOKEN_BINARY shiboken6 PATHS ${SHIBOKEN_SEARCH_PATHS})
|
||||
endif()
|
||||
if(SHIBOKEN_INCLUDE_DIR
|
||||
AND SHIBOKEN_LIBRARY
|
||||
AND SHIBOKEN_BINARY
|
||||
)
|
||||
set(SHIBOKEN_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(SHIBOKEN_FOUND)
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# On Windows we must link to python3.dll that is a small library that links against python3x.dll
|
||||
# that allow us to choose any python3x.dll at runtime
|
||||
execute_process(
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} -c "if True:
|
||||
for lib in '${Python3_LIBRARIES}'.split(';'):
|
||||
if '/' in lib:
|
||||
prefix, py = lib.rsplit('/', 1)
|
||||
if py.startswith('python3'):
|
||||
print(prefix + '/python3.lib')
|
||||
break
|
||||
"
|
||||
OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
# On Linux and MacOs our modules should not link with any python library
|
||||
# that must be handled by the main process
|
||||
set(PYTHON_LIMITED_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
if(SHIBOKEN_FOUND)
|
||||
message(STATUS "Shiboken include dir: ${SHIBOKEN_INCLUDE_DIR}")
|
||||
message(STATUS "Shiboken library: ${SHIBOKEN_LIBRARY}")
|
||||
message(STATUS "Shiboken binary: ${SHIBOKEN_BINARY}")
|
||||
message(STATUS "Shiboken version: ${SHIBOKEN_VERSION}")
|
||||
|
||||
# Create shiboken2 target
|
||||
add_library(Shiboken6::libshiboken SHARED IMPORTED GLOBAL)
|
||||
if(MSVC)
|
||||
set_property(TARGET Shiboken6::libshiboken PROPERTY IMPORTED_IMPLIB ${SHIBOKEN_LIBRARY})
|
||||
endif()
|
||||
set_property(TARGET Shiboken6::libshiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_LIBRARY})
|
||||
set_property(
|
||||
TARGET Shiboken6::libshiboken
|
||||
APPEND
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SHIBOKEN_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
set_property(
|
||||
TARGET Shiboken6::libshiboken
|
||||
APPEND
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIMITED_LIBRARIES}
|
||||
)
|
||||
|
||||
# Generator target
|
||||
add_executable(Shiboken6::shiboken IMPORTED GLOBAL)
|
||||
set_property(TARGET Shiboken6::shiboken PROPERTY IMPORTED_LOCATION ${SHIBOKEN_BINARY})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
Shiboken6
|
||||
REQUIRED_VARS SHIBOKEN_BASEDIR SHIBOKEN_INCLUDE_DIR SHIBOKEN_LIBRARY SHIBOKEN_BINARY
|
||||
VERSION_VAR SHIBOKEN_VERSION
|
||||
)
|
||||
36
3rdparty/kddockwidgets/cmake/KDAB/modules/KDFixupShiboken2.py
vendored
Executable file
36
3rdparty/kddockwidgets/cmake/KDAB/modules/KDFixupShiboken2.py
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
"""
|
||||
Script to fix bugs in code generated by shiboken-generator vr2
|
||||
"""
|
||||
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
def removeExtraNamespaceForDefaultEnumValue(filename):
|
||||
"""
|
||||
Remove namespace from default flag value
|
||||
this is a shiboken2 bug fixed on shiboken6
|
||||
"""
|
||||
regex = re.compile(r"\s=\s[^\s]+::{}")
|
||||
newContent = ""
|
||||
with open(filename, encoding='utf-8') as f:
|
||||
for line in f:
|
||||
newContent += re.sub(regex, ' = {}', line)
|
||||
|
||||
with open(filename, "w", encoding='utf-8') as f:
|
||||
f.write(newContent)
|
||||
|
||||
|
||||
# Usage: <script> <list-of-files>
|
||||
# It will fix the file inplace
|
||||
if __name__ == '__main__':
|
||||
for fileToFix in sys.argv[1:]:
|
||||
print("Fixup: {}".format(fileToFix))
|
||||
removeExtraNamespaceForDefaultEnumValue(fileToFix)
|
||||
41
3rdparty/kddockwidgets/cmake/KDAB/modules/KDInstallLocation.cmake
vendored
Normal file
41
3rdparty/kddockwidgets/cmake/KDAB/modules/KDInstallLocation.cmake
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2012 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Some default installation locations. These should be global, with any project
|
||||
# specific locations added to the end. These paths are all relative to the
|
||||
# install prefix.
|
||||
#
|
||||
# These paths attempt to adhere to the FHS, and are similar to those provided
|
||||
# by autotools and used in many Linux distributions.
|
||||
|
||||
# Use GNU install directories
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT INSTALL_RUNTIME_DIR)
|
||||
set(INSTALL_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_LIBRARY_DIR)
|
||||
set(INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_ARCHIVE_DIR)
|
||||
set(INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_INCLUDE_DIR)
|
||||
set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
if(NOT INSTALL_DATADIR)
|
||||
set(INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR})
|
||||
endif()
|
||||
if(NOT INSTALL_DOC_DIR)
|
||||
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}${${PROJECT_NAME}_LIBRARY_QTID})
|
||||
endif()
|
||||
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
if(APPLE)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${INSTALL_LIBRARY_DIR}")
|
||||
endif()
|
||||
173
3rdparty/kddockwidgets/cmake/KDAB/modules/KDPySide2ModuleBuild.cmake
vendored
Normal file
173
3rdparty/kddockwidgets/cmake/KDAB/modules/KDPySide2ModuleBuild.cmake
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Save path to this cmake file (so it can be used later in the macros)
|
||||
set(THIS_CMAKE_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
# cmake-lint: disable=C0103
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
CACHE FILEPATH "Custom path to install python bindings."
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
|
||||
if(WIN32)
|
||||
set(PATH_SEP "\;")
|
||||
else()
|
||||
set(PATH_SEP ":")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
|
||||
endif()
|
||||
|
||||
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
|
||||
get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
|
||||
if(QtCore_is_framework)
|
||||
# Get the path to the framework dir.
|
||||
list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
|
||||
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
|
||||
|
||||
# QT_INCLUDE_DIR points to the QtCore.framework directory, so we need to adjust this to point
|
||||
# to the actual include directory, which has include files for non-framework parts of Qt.
|
||||
get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE)
|
||||
endif()
|
||||
|
||||
# Flags that we will pass to shiboken-generator
|
||||
# --generator-set=shiboken: tells the generator that we want to use shiboken to generate code,
|
||||
# a doc generator is also available
|
||||
# --enable-parent-ctor-heuristic: Enable heuristics to detect parent relationship on constructors,
|
||||
# this try to guess parent ownership based on the arguments of the constructors
|
||||
# --enable-pyside-extensionsL: This will generate code for Qt based classes, adding extra attributes,
|
||||
# like signal, slot;
|
||||
# --enable-return-value-heuristic: Similar as --enable-parent-ctor-heuristic this use some logic to guess
|
||||
# parent child relationship based on the returned argument
|
||||
# --use-isnull-as-nb_nonzero: If a class have an isNull() const method, it will be used to compute
|
||||
# the value of boolean casts.
|
||||
# Example, QImage::isNull() will be used when on python side you do `if (myQImage)`
|
||||
set(GENERATOR_EXTRA_FLAGS
|
||||
--generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
)
|
||||
|
||||
# 2017-04-24 The protected hack can unfortunately not be disabled, because
|
||||
# Clang does produce linker errors when we disable the hack.
|
||||
# But the ugly workaround in Python is replaced by a shiboken change.
|
||||
if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
|
||||
set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack)
|
||||
add_definitions(-DAVOID_PROTECTED_HACK)
|
||||
endif()
|
||||
|
||||
# Replace all semicolons in a string with this platform's path separator
|
||||
macro(make_path varname)
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
endmacro()
|
||||
|
||||
# Creates a PySide module target based on the arguments
|
||||
# This will:
|
||||
# 1 - Create a Cmake custom-target that call shiboken-generator passign the correct arguments
|
||||
# 2 - Create a Cmake library target called "Py${libraryName}" the output name of this target
|
||||
# will be changed to match PySide template
|
||||
# Args:
|
||||
# libraryName - The name of the output module
|
||||
# typesystemPaths - A list of paths where shiboken should look for typesystem files
|
||||
# includePaths - Include paths necessary to parse your class. *This is not the same as build*
|
||||
# outputSource - The files that will be generated by shiboken
|
||||
# targetIncludeDirs - This will be passed to target_include_directories
|
||||
# targetLinkLibraries - This will be passed to targetLinkLibraries
|
||||
# globalInclude - A header-file that contains all classes that will be generated
|
||||
# typesystemXML - The target binding typesystem (that should be the full path)
|
||||
# dependsArg - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
|
||||
# trigger if one of these files changes
|
||||
# moduleOutputDir - Where the library file should be stored
|
||||
macro(
|
||||
create_python_bindings
|
||||
libraryName
|
||||
typesystemPaths
|
||||
includePaths
|
||||
outputSource
|
||||
targetIncludeDirs
|
||||
targetLinkLibraries
|
||||
globalInclude
|
||||
typesystemXML
|
||||
dependsArg
|
||||
moduleOutputDir
|
||||
)
|
||||
|
||||
# Transform the path separators into something shiboken understands.
|
||||
make_path(shiboken_include_dirs ${includePaths})
|
||||
make_path(shiboken_typesystem_dirs ${typesystemPaths})
|
||||
get_property(
|
||||
raw_python_dir_include_dirs
|
||||
DIRECTORY
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
)
|
||||
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
|
||||
set(shiboken_include_dirs "${shiboken_include_dirs}${PATH_SEP}${python_dir_include_dirs}")
|
||||
|
||||
set(shiboken_framework_include_dirs_option "")
|
||||
if(CMAKE_HOST_APPLE)
|
||||
set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}")
|
||||
make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs})
|
||||
set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
|
||||
endif()
|
||||
set_property(SOURCE ${outputSource} PROPERTY SKIP_AUTOGEN ON)
|
||||
add_custom_command(
|
||||
OUTPUT ${outputSource}
|
||||
COMMAND
|
||||
$<TARGET_PROPERTY:Shiboken2::shiboken,LOCATION> ${GENERATOR_EXTRA_FLAGS} ${globalInclude}
|
||||
--include-paths=${shiboken_include_dirs} --typesystem-paths=${shiboken_typesystem_dirs}
|
||||
${shiboken_framework_include_dirs_option} --output-directory=${CMAKE_CURRENT_BINARY_DIR} ${typesystemXML}
|
||||
COMMAND ${Python3_EXECUTABLE} ${THIS_CMAKE_LIST_DIR}/KDFixupShiboken2.py ${outputSource}
|
||||
DEPENDS ${typesystemXML} ${dependsArg}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running generator for ${libraryName} binding..."
|
||||
)
|
||||
|
||||
set(TARGET_NAME "Py${libraryName}")
|
||||
set(MODULE_NAME "${libraryName}")
|
||||
add_library(${TARGET_NAME} MODULE ${outputSource})
|
||||
|
||||
set_target_properties(
|
||||
${TARGET_NAME}
|
||||
PROPERTIES PREFIX ""
|
||||
OUTPUT_NAME ${MODULE_NAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${moduleOutputDir}
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||
elseif(NOT WIN32) #ie. linux
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${targetIncludeDirs})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${targetLinkLibraries} PySide2::pyside2 Shiboken2::libshiboken)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE Py_LIMITED_API=0x03050000)
|
||||
if(APPLE)
|
||||
set_property(
|
||||
TARGET ${TARGET_NAME}
|
||||
APPEND
|
||||
PROPERTY LINK_FLAGS "-undefined dynamic_lookup"
|
||||
)
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
|
||||
endmacro()
|
||||
170
3rdparty/kddockwidgets/cmake/KDAB/modules/KDPySide6ModuleBuild.cmake
vendored
Normal file
170
3rdparty/kddockwidgets/cmake/KDAB/modules/KDPySide6ModuleBuild.cmake
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
if(NOT ${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX)
|
||||
# cmake-lint: disable=C0103
|
||||
set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
CACHE FILEPATH "Custom path to install python bindings."
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "PYTHON INSTALL PREFIX ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}")
|
||||
|
||||
if(WIN32)
|
||||
set(PATH_SEP "\;")
|
||||
else()
|
||||
set(PATH_SEP ":")
|
||||
endif()
|
||||
#Qt6 requires C++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
#remove noisy compiler warnings (as the generated code is not necessarily super-warning-free)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all -Wno-extra")
|
||||
endif()
|
||||
|
||||
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
|
||||
get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)
|
||||
if(QtCore_is_framework)
|
||||
# Get the path to the framework dir.
|
||||
list(GET Qt6Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
|
||||
get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE)
|
||||
|
||||
# QT_INCLUDE_DIR points to the QtCore.framework directory, so we need to adjust this to point
|
||||
# to the actual include directory, which has include files for non-framework parts of Qt.
|
||||
get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE)
|
||||
endif()
|
||||
|
||||
# Flags that we will pass to shiboken-generator
|
||||
# --generator-set=shiboken: tells the generator that we want to use shiboken to generate code,
|
||||
# a doc generator is also available
|
||||
# --enable-parent-ctor-heuristic: Enable heuristics to detect parent relationship on constructors,
|
||||
# this try to guess parent ownership based on the arguments of the constructors
|
||||
# --enable-pyside-extensionsL: This will generate code for Qt based classes, adding extra attributes,
|
||||
# like signal, slot;
|
||||
# --enable-return-value-heuristic: Similar as --enable-parent-ctor-heuristic this use some logic to guess
|
||||
# parent child relationship based on the returned argument
|
||||
# --use-isnull-as-nb_nonzero: If a class have an isNull() const method, it will be used to compute
|
||||
# the value of boolean casts.
|
||||
# Example, QImage::isNull() will be used when on python side you do `if (myQImage)`
|
||||
set(GENERATOR_EXTRA_FLAGS
|
||||
--generator-set=shiboken
|
||||
--enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions
|
||||
--enable-return-value-heuristic
|
||||
--use-isnull-as-nb_nonzero
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
)
|
||||
|
||||
# 2017-04-24 The protected hack can unfortunately not be disabled, because
|
||||
# Clang does produce linker errors when we disable the hack.
|
||||
# But the ugly workaround in Python is replaced by a shiboken change.
|
||||
if(WIN32 OR DEFINED AVOID_PROTECTED_HACK)
|
||||
set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack)
|
||||
add_definitions(-DAVOID_PROTECTED_HACK)
|
||||
endif()
|
||||
|
||||
# Replace all semicolons in a string with this platform's path separator
|
||||
macro(make_path varname)
|
||||
# accepts any number of path variables
|
||||
string(REPLACE ";" "${PATH_SEP}" ${varname} "${ARGN}")
|
||||
endmacro()
|
||||
|
||||
# Creates a PySide module target based on the arguments
|
||||
# This will:
|
||||
# 1 - Create a Cmake custom-target that call shiboken-generator passign the correct arguments
|
||||
# 2 - Create a Cmake library target called "Py${libraryName}" the output name of this target
|
||||
# will be changed to match PySide template
|
||||
# Args:
|
||||
# libraryName - The name of the output module
|
||||
# typesystemPaths - A list of paths where shiboken should look for typesystem files
|
||||
# includePaths - Include paths necessary to parse your class. *This is not the same as build*
|
||||
# outputSource - The files that will be generated by shiboken
|
||||
# targetIncludeDirs - This will be passed to target_include_directories
|
||||
# targetLinkLibraries - This will be passed to targetLinkLibraries
|
||||
# globalInclude - A header-file that contains all classes that will be generated
|
||||
# typesystemXML - The target binding typesystem (that should be the full path)
|
||||
# dependsArg - This var will be passed to add_custom_command(DEPENDS) so a new generation will be
|
||||
# trigger if one of these files changes
|
||||
# moduleOutputDir - Where the library file should be stored
|
||||
macro(
|
||||
create_python_bindings
|
||||
libraryName
|
||||
typesystemPaths
|
||||
includePaths
|
||||
outputSource
|
||||
targetIncludeDirs
|
||||
targetLinkLibraries
|
||||
globalInclude
|
||||
typesystemXML
|
||||
dependsArg
|
||||
moduleOutputDir
|
||||
)
|
||||
|
||||
# Transform the path separators into something shiboken understands.
|
||||
make_path(shiboken_include_dirs ${includePaths})
|
||||
make_path(shiboken_typesystem_dirs ${typesystemPaths})
|
||||
get_property(
|
||||
raw_python_dir_include_dirs
|
||||
DIRECTORY
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
)
|
||||
make_path(python_dir_include_dirs ${raw_python_dir_include_dirs})
|
||||
|
||||
set(shiboken_framework_include_dirs_option "")
|
||||
if(CMAKE_HOST_APPLE)
|
||||
# We need to pass "-iframework /path/to/Qt/<version>/macos/lib/" to shiboken
|
||||
set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}/..")
|
||||
make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dirs})
|
||||
set(shiboken_framework_include_dirs_option "--framework-include-paths=${shiboken_framework_include_dirs}")
|
||||
endif()
|
||||
set_property(SOURCE ${outputSource} PROPERTY SKIP_AUTOGEN ON)
|
||||
add_custom_command(
|
||||
OUTPUT ${outputSource}
|
||||
COMMAND
|
||||
$<TARGET_PROPERTY:Shiboken6::shiboken,LOCATION> ${GENERATOR_EXTRA_FLAGS} ${globalInclude}
|
||||
--include-paths=${shiboken_include_dirs} --typesystem-paths=${shiboken_typesystem_dirs}
|
||||
${shiboken_framework_include_dirs_option} --output-directory=${CMAKE_CURRENT_BINARY_DIR} ${typesystemXML}
|
||||
DEPENDS ${typesystemXML} ${dependsArg}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running generator for ${libraryName} binding..."
|
||||
)
|
||||
|
||||
set(TARGET_NAME "Py${libraryName}")
|
||||
set(MODULE_NAME "${libraryName}")
|
||||
add_library(${TARGET_NAME} MODULE ${outputSource})
|
||||
|
||||
set_target_properties(
|
||||
${TARGET_NAME}
|
||||
PROPERTIES PREFIX ""
|
||||
OUTPUT_NAME ${MODULE_NAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${moduleOutputDir}
|
||||
)
|
||||
if(APPLE)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||
elseif(NOT WIN32) #ie. linux
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${targetIncludeDirs})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${targetLinkLibraries} PySide6::pyside6 Shiboken6::libshiboken)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE Py_LIMITED_API=0x03050000)
|
||||
if(APPLE)
|
||||
set_property(
|
||||
TARGET ${TARGET_NAME}
|
||||
APPEND
|
||||
PROPERTY LINK_FLAGS "-undefined dynamic_lookup"
|
||||
)
|
||||
endif()
|
||||
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
|
||||
endmacro()
|
||||
58
3rdparty/kddockwidgets/cmake/KDAB/modules/KDQtInstallPaths.cmake
vendored
Normal file
58
3rdparty/kddockwidgets/cmake/KDAB/modules/KDQtInstallPaths.cmake
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Allen Winter <allen.winter@kdab.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Assumes you've already found Qt and QT_VERSION_MAJOR is set
|
||||
#
|
||||
# Create variables for all the various install paths for the Qt version in use
|
||||
# Make sure to have found Qt before using this.
|
||||
# sets variables like QT_INSTALL_PREFIX, QT_INSTALL_DATA, QT_INSTALL_DOCS, etc.
|
||||
# run qmake -query to see a full list
|
||||
|
||||
if(NOT DEFINED QT_VERSION_MAJOR)
|
||||
message(FATAL_ERROR "Please set QT_VERSION_MAJOR first (ie. set(QT_VERSION_MAJOR 5))")
|
||||
endif()
|
||||
|
||||
# use qtpaths if qmake not found
|
||||
if(TARGET Qt${QT_VERSION_MAJOR}::qmake)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake LOCATION)
|
||||
elseif(TARGET Qt${QT_VERSION_MAJOR}::qtpaths)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qtpaths LOCATION)
|
||||
else()
|
||||
message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${QT_QMAKE_EXECUTABLE} -query
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE ALL_VARS
|
||||
)
|
||||
if(NOT return_code EQUAL 0)
|
||||
message(WARNING "Failed call: ${QT_QMAKE_EXECUTABLE} -query")
|
||||
message(FATAL_ERROR "QMake call failed: ${return_code}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" VARS_LIST ${ALL_VARS})
|
||||
foreach(qval ${VARS_LIST})
|
||||
if(qval MATCHES "QT_INSTALL_")
|
||||
string(REPLACE ":" ";" QVAL_LIST ${qval})
|
||||
list(LENGTH QVAL_LIST listlen)
|
||||
list(GET QVAL_LIST 0 var)
|
||||
if(WIN32 AND ${listlen} GREATER 2)
|
||||
list(GET QVAL_LIST 2 path)
|
||||
list(GET QVAL_LIST 1 drive)
|
||||
set(path "${drive}:${path}")
|
||||
else()
|
||||
list(GET QVAL_LIST 1 path)
|
||||
endif()
|
||||
if(NOT ${var}) #if set already on the command line for example
|
||||
set(${var}
|
||||
${path}
|
||||
CACHE PATH "Qt install path for ${var}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
Reference in New Issue
Block a user