### Install PySide6-QtAds Source: https://github.com/mborgerson/pyside6_qtads/blob/main/README.md Install the library using pip. This is the recommended method for most users. ```bash pip install PySide6-QtAds ``` -------------------------------- ### Installation Rules Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Defines installation rules for the bindings library, project library, and license files. ```cmake # ================================= Dubious deployment section ================================ install(TARGETS ${bindings_library} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} ) if(NOT BUILD_STATIC) install(TARGETS ${project_library} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() install(FILES "${qtads_dir}/LICENSE" "${qtads_dir}/gnu-lgpl-v2.1.md" DESTINATION license/ads COMPONENT license ) ``` -------------------------------- ### Basic CMake Setup Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets the minimum CMake version and policy. Enables the CMP0071 policy for automoc on generated files. ```cmake cmake_minimum_required(VERSION 3.16) cmake_policy(VERSION 3.16) # Enable policy to run automoc on generated files. if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() ``` -------------------------------- ### Build PySide6-QtAds from Source on Ubuntu 24.04 Source: https://github.com/mborgerson/pyside6_qtads/blob/main/README.md Build the library from source. This involves installing Qt using aqtinstall and then building the PySide6-QtAds package. ```bash # Install Qt (for example, using aqtinstall) pip install aqtinstall aqt install-qt linux desktop 6.11.0 --outputdir qt # Build PySide6-QtAds LD_LIBRARY_PATH=$PWD/qt/6.11.0/gcc_64/lib \ CMAKE_PREFIX_PATH=$PWD/qt/6.11.0/gcc_64/lib/cmake/ \ pip install -v . ``` -------------------------------- ### RPATH Configuration for Libraries Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Configures the RPATH (runtime search path) for dynamic libraries based on the operating system. This ensures that libraries can be found at runtime after installation. ```cmake set(CMAKE_SKIP_BUILD_RPATH TRUE) if(UNIX AND NOT APPLE) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib:$ORIGIN/../PySide6/:$ORIGIN/../PySide6/Qt/lib:$ORIGIN/../shiboken6") endif() if(APPLE) set(CMAKE_INSTALL_RPATH "@loader_path/lib;@loader_path/../PySide6/;@loader_path/../PySide6/Qt/lib;@loader_path/../shiboken6") set(MACOSX_RPATH TRUE) endif() ``` -------------------------------- ### Setting up PySide6 Additional Includes Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Appends the necessary PySide6 module include directories (QtCore, QtGui, QtWidgets) to a list for use in the build process. This ensures that PySide6 headers are found. ```cmake set(pyside_additional_includes "") foreach(INCLUDE_DIR ${pyside_include_dir}) list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtCore") list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtGui") list(APPEND pyside_additional_includes "${INCLUDE_DIR}/QtWidgets") endforeach() ``` -------------------------------- ### Shiboken Options Configuration Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets up the options for the shiboken generator, including various heuristics and include paths. ```cmake set(shiboken_options --generator-set=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero --avoid-protected-hack ${QT_INCLUDES} ${implicit_includes} -I${qtads_dir}/src -T${CMAKE_CURRENT_SOURCE_DIR} -T${pyside_path}/typesystems --output-directory=${CMAKE_CURRENT_BINARY_DIR} ) ``` -------------------------------- ### Qt and OpenGL Configuration Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets the OpenGL preference to LEGACY to address a specific Qt bug. Finds the required Qt6 components (Core, Gui, Widgets). ```cmake # https://bugreports.qt.io/browse/QTBUG-89754 set(OpenGL_GL_PREFERENCE "LEGACY") # Find the required Qt packages find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) ``` -------------------------------- ### Bindings Library Include Directories Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Applies relevant include directories for the bindings library, including PySide, Python, and shiboken paths. ```cmake # Apply relevant include and link flags. target_include_directories(${bindings_library} PRIVATE ${pyside_additional_includes}) target_include_directories(${bindings_library} PRIVATE ${pyside_include_dir}) target_include_directories(${bindings_library} PRIVATE ${python_include_dir}) target_include_directories(${bindings_library} PRIVATE ${shiboken_include_dir}) target_include_directories(${bindings_library} PRIVATE "${CMAKE_SOURCE_DIR}/src") ``` -------------------------------- ### Generated Source Files for Bindings Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Lists the C++ source files that will be generated by Shiboken for the PySide6QtAds module. These are essential for building the module's shared library. ```cmake # Specify which C++ files will be generated by shiboken. This includes the module wrapper # and a '.cpp' file per C++ type. These are needed for generating the module shared # library. set(generated_sources ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cautohidedockcontainer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cautohidesidebar_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cautohidetab_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockareatabbar_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockareatitlebar_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockareawidget_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockcomponentsfactory_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockcontainerwidget_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockfocuscontroller_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockingstatereader_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockmanager_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockoverlay_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockoverlaycross_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdocksplitter_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockwidget_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cdockwidgettab_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_celidinglabel_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cfloatingdockcontainer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cfloatingdragpreview_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_ciconprovider_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cspacerwidget_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_ctitlebarbutton_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_ifloatingwidget_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cpushbutton_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_cresizehandle_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/ads_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/pyside6qtads_module_wrapper.cpp ) ``` -------------------------------- ### Bindings Library Link Libraries Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Links the bindings library against necessary Qt, project, PySide, and shiboken libraries. ```cmake target_link_libraries(${bindings_library} PRIVATE Qt6::Widgets) target_link_libraries(${bindings_library} PRIVATE ${project_library}) target_link_libraries(${bindings_library} PRIVATE ${pyside_shared_libraries}) target_link_libraries(${bindings_library} PRIVATE ${shiboken_module_shared_libraries}) ``` -------------------------------- ### Compile Options and Definitions Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets compile options and definitions for the bindings library, including optimization flags and Python API version. ```cmake if(NOT WIN32) target_compile_options(qtadvanceddocking-qt6 PRIVATE -Og -fPIC) target_compile_options(${bindings_library} PRIVATE -Og -fPIC) endif() target_compile_definitions(${bindings_library} PRIVATE "-DPy_LIMITED_API=0x030A0000") ``` -------------------------------- ### Collecting Qt Include Directories Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Gathers include directories for Qt modules (Core, GUI, Widgets) to be passed to Shiboken. It specifically handles Qt framework builds on macOS. ```cmake set(QT_INCLUDE_DIR "") get_target_property(QT_INCLUDE_DIR_LIST Qt6::Core INTERFACE_INCLUDE_DIRECTORIES) foreach(_Q ${QT_INCLUDE_DIR_LIST}) if(NOT "${_Q}" MATCHES "QtCore$") set(QT_INCLUDE_DIR "${_Q}") endif() endforeach() if(QT_INCLUDE_DIR STREQUAL "") message(FATAL_ERROR "Unable to obtain the Qt include directory") endif() set(QT_INCLUDES "") list(APPEND QT_INCLUDES "-I${QT_INCLUDE_DIR}") get_property(QT_CORE_INCLUDE_DIRS TARGET Qt6::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES) foreach(INCLUDE_DIR ${QT_CORE_INCLUDE_DIRS}) list(APPEND QT_INCLUDES "-I${INCLUDE_DIR}") endforeach() get_property(QT_GUI_INCLUDE_DIRS TARGET Qt6::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES) foreach(INCLUDE_DIR ${QT_GUI_INCLUDE_DIRS}) list(APPEND QT_INCLUDES "-I${INCLUDE_DIR}") endforeach() get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt6::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES) foreach(INCLUDE_DIR ${QT_WIDGETS_INCLUDE_DIRS}) list(APPEND QT_INCLUDES "-I${INCLUDE_DIR}") endforeach() # Check if Qt is a framework build on macOS. 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 Qt framework dir. set(QT_FRAMEWORK_INCLUDE_DIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_LIBS}") message(STATUS "*** QT_FRAMEWORK_INCLUDE_DIR is ${QT_FRAMEWORK_INCLUDE_DIR}") list(APPEND QT_INCLUDES "--framework-include-paths=${QT_FRAMEWORK_INCLUDE_DIR}") endif() ``` -------------------------------- ### Project and Python Configuration Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Defines the project name and finds the Python 3 interpreter. It ensures Python 3 is available and reports the executable path. ```cmake # ================================ General configuration ====================================== project(PySide6QtAds) # Find Python find_package (Python3 COMPONENTS Interpreter) if(NOT Python3_Interpreter_FOUND) message(FATAL_ERROR "Python3 not found") endif() message(STATUS "Using python: ${Python3_EXECUTABLE}") ``` -------------------------------- ### C++ Standard and Library Paths Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets the minimum C++ standard to C++11. Configures the module path to include the Qt-Advanced-Docking-System's cmake modules. ```cmake # Set CPP standard to C++11 minimum. set(CMAKE_CXX_STANDARD 11) # The C++ project library for which we will create bindings. set(qtads_subdir "Qt-Advanced-Docking-System") set(qtads_dir ${CMAKE_CURRENT_SOURCE_DIR}/${qtads_subdir}) set(CMAKE_MODULE_PATH ${qtads_dir}/cmake/modules ${CMAKE_MODULE_PATH}) add_subdirectory(${qtads_subdir} EXCLUDE_FROM_ALL) set(project_library "qtadvanceddocking-qt6") ``` -------------------------------- ### Custom Command for Shiboken Generation Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Adds a custom command to run shiboken for generating C++ binding files based on the typesystem. ```cmake set(generated_sources_dependencies ${wrapped_header} ${typesystem_file}) # Add custom target to run shiboken to generate the binding cpp files. add_custom_command(OUTPUT ${generated_sources} COMMAND ${shiboken_path} ${shiboken_options} ${wrapped_header} ${typesystem_file} DEPENDS ${generated_sources_dependencies} IMPLICIT_DEPENDS CXX ${wrapped_header} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Running generator for ${typesystem_file}.") ``` -------------------------------- ### Link Directories for Windows Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Adds Python library directory to link directories on Windows. ```cmake if (WIN32) list(GET python_linking_data 0 python_libdir) target_link_directories(${bindings_library} PRIVATE ${python_libdir}) endif() ``` -------------------------------- ### Shiboken Target for Binding Generation Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Prepares a list of implicit include directories for the C++ compiler, which will be used by Shiboken when generating C++ binding files for PySide6. ```cmake set(implicit_includes) foreach(_current ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) set(implicit_includes ${implicit_includes} "-I${_current}") endforeach() ``` -------------------------------- ### Querying PySide6 Paths Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Uses the pyside_config macro to query essential paths for Shiboken and PySide6, including generator paths, module paths, and include directories. These are crucial for the build process. ```cmake pyside_config(--shiboken-module-path shiboken_module_path) pyside_config(--shiboken-generator-path shiboken_generator_path) pyside_config(--pyside-path pyside_path) pyside_config(--python-include-path python_include_dir) pyside_config(--shiboken-include-path shiboken_include_dir 1) pyside_config(--pyside-include-path pyside_include_dir 1) pyside_config(--python-link-flags-cmake python_linking_data 0) pyside_config(--shiboken-module-shared-libraries-cmake shiboken_module_shared_libraries 0) pyside_config(--pyside-shared-libraries-cmake pyside_shared_libraries 0) ``` -------------------------------- ### Bindings Library Definition Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Defines and builds the shared library for the PySide6 bindings, including source files and dependencies. ```cmake # Set the cpp files which will be used for the bindings library. set(${bindings_library}_sources ${generated_sources}) # Define and build the bindings library. add_library(${bindings_library} MODULE ${${bindings_library}_sources}) ``` -------------------------------- ### Binding and Typesystem Configuration Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Defines the name of the generated Python bindings library and the main header file for bindings. Specifies the typesystem XML file for C++ to Python type mapping. ```cmake # The name of the generated bindings module (as imported in Python). set(bindings_library "PySide6QtAds") # The header file with all the types and functions for which bindings will be generated. # Usually it simply includes other headers of the library you are creating bindings for. set(wrapped_header ${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.h) # The typesystem xml file which defines the relationships between the C++ types / functions # and the corresponding Python equivalents. set(typesystem_file ${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.xml) ``` -------------------------------- ### Output Name and Suffix Configuration Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Adjusts the output name and suffix of the generated module to match Python extension naming conventions. ```cmake # Adjust the name of generated module. set_property(TARGET ${bindings_library} PROPERTY PREFIX "") set_property(TARGET ${bindings_library} PROPERTY OUTPUT_NAME "${bindings_library}${PYTHON_EXTENSION_SUFFIX}") if(WIN32) set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd") endif() ``` -------------------------------- ### PySide6 Configuration Macro Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Defines a macro to execute Python scripts for PySide6 configuration, extracting paths and settings. It handles optional list conversion for output variables. ```cmake macro(pyside_config option output_var) if(${ARGC} GREATER 2) set(is_list ${ARGV2}) else() set(is_list "") endif() execute_process( COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pyside_config.py" ${option} OUTPUT_VARIABLE ${output_var} OUTPUT_STRIP_TRAILING_WHITESPACE) if ("${${output_var}}" STREQUAL "") message(FATAL_ERROR "Error: Calling ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pyside_config.py ${option} returned no output.") endif() if(is_list) string (REPLACE " " ";" ${output_var} "${${output_var}}") endif() endmacro() ``` -------------------------------- ### Linker Flags for macOS Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt Sets linker flags for macOS to avoid issues with undefined symbols. ```cmake # Make sure the linker doesn't complain about not finding Python symbols on macOS. if(APPLE) set_target_properties(${bindings_library} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif(APPLE) ``` -------------------------------- ### Shiboken Detection Placeholder Source: https://github.com/mborgerson/pyside6_qtads/blob/main/CMakeLists.txt A placeholder comment indicating where Shiboken detection logic would typically reside in a CMake build for Python bindings. ```cmake # ================================== Shiboken detection ====================================== # Macro to get various pyside / python include / link flags and paths. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.