### Specify Plugin Sources and Installation Rules Source: https://github.com/albertlauncher/albert-plugin-python/blob/main/CMakeLists.txt This snippet adds 'albert.pyi' as a private source file to the main project target, essential for the plugin's functionality. It also defines comprehensive installation rules for the plugin's 'plugins/' directory, ensuring it's copied to the correct Albert data directory while explicitly excluding hidden files, Python bytecode caches (__pycache__), and markdown files. ```CMake target_sources(${PROJECT_NAME} PRIVATE albert.pyi) install( DIRECTORY "plugins/" DESTINATION "${CMAKE_INSTALL_DATADIR}/albert/${PROJECT_NAME}/plugins" REGEX "plugins\\/\\..+" EXCLUDE # exclude hidden files PATTERN "__pycache__" EXCLUDE PATTERN "*.md" EXCLUDE ) ``` -------------------------------- ### Initialize CMake Project and Find Albert Source: https://github.com/albertlauncher/albert-plugin-python/blob/main/CMakeLists.txt This snippet sets the minimum required CMake version, defines the project name and version for the Albert Python plugin, and locates the Albert framework package, which is a mandatory dependency for the plugin's build. ```CMake cmake_minimum_required(VERSION 3.16) project(python VERSION 6.19) find_package(Albert REQUIRED) ``` -------------------------------- ### Configure Pybind11 and Albert Plugin Properties Source: https://github.com/albertlauncher/albert-plugin-python/blob/main/CMakeLists.txt This section configures pybind11 for Python binding, including it as a subdirectory to integrate Python code with C++. It then defines the Albert plugin's specific properties, such as private include directories, necessary link libraries (pybind11::embed), and required Qt modules (Concurrent, Widgets) for UI and concurrency features. ```CMake set(PYBIND11_FINDPYTHON ON) #find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED) add_subdirectory(pybind11) albert_plugin( INCLUDE PRIVATE $ LINK PRIVATE pybind11::embed QT Concurrent Widgets ) ``` -------------------------------- ### Conditional Test Build Configuration Source: https://github.com/albertlauncher/albert-plugin-python/blob/main/CMakeLists.txt This block conditionally configures a test executable for the plugin, active only if the 'BUILD_TESTS' option is enabled. It locates the Qt6 Test module, retrieves properties from the main project, defines a new test target, adds necessary sources and include directories, links required libraries (Qt6::Test, libalbert), and sets target properties for automatic MOC, UIC, and RCC processing. Finally, it integrates the test into CTest for automated execution. ```CMake if (BUILD_TESTS) find_package(Qt6 REQUIRED COMPONENTS Test) get_target_property(SRC_TST ${PROJECT_NAME} SOURCES) get_target_property(INC_TST ${PROJECT_NAME} INCLUDE_DIRECTORIES) get_target_property(LIBS_TST ${PROJECT_NAME} LINK_LIBRARIES) set(TARGET_TST ${PROJECT_NAME}_test) add_executable(${TARGET_TST} ${SRC_TST} test/test.cpp) target_include_directories(${TARGET_TST} PRIVATE ${INC_TST} test src) target_link_libraries(${TARGET_TST} PRIVATE ${LIBS_TST} Qt6::Test libalbert) set_target_properties(${TARGET_TST} PROPERTIES AUTOMOC ON AUTOUIC ON AUTORCC ON ) set_property(TARGET ${TARGET_TST} APPEND PROPERTY AUTOMOC_MACRO_NAMES "ALBERT_PLUGIN") add_test(NAME ${TARGET_TST} COMMAND ${TARGET_TST}) endif() ``` -------------------------------- ### Commented-Out Python Debugging and Finding Attempts Source: https://github.com/albertlauncher/albert-plugin-python/blob/main/CMakeLists.txt This section contains commented-out CMake code, likely used during development for debugging issues related to finding Python packages. It includes attempts to locate Python, print various Python-related CMake variables (e.g., include directories, interpreters, libraries), and manually set the 'PYTHON_LIBRARY' variable to diagnose build problems. ```CMake # find_package(Python COMPONENTS Interpreter Development REQUIRED) # message(STATUS "Python3_INCLUDE_DIRS ${Python3_INCLUDE_DIRS}") # message(STATUS "Python3_INTERPRETER ${Python3_INTERPRETER}") # message(STATUS "Python3_LIBRARIES ${Python3_LIBRARIES}") # message(STATUS "Python3_LIBRARY ${Python3_LIBRARY}") # message(STATUS "Python_EXECUTABLE ${Python_EXECUTABLE}") # message(STATUS "Python_INCLUDE_DIRS ${Python_INCLUDE_DIRS}") # message(STATUS "Python_INTERPRETER ${Python_INTERPRETER}") # message(STATUS "Python_LIBRARIES ${Python_LIBRARIES}") # message(STATUS "Python_LIBRARY ${Python_LIBRARY}") # # set(PYTHON_LIBRARY ${Python_LIBRARIES}) # message(STATUS "PYTHON_LIBRARY ${PYTHON_LIBRARY}") # set(Python_LIBRARY ${Python_LIBRARIES}) # message(STATUS "Python_LIBRARY ${Python_LIBRARY}") # message(STATUS "PYTHON_LIBRARY ${PYTHON_LIBRARY}") # if (NOT Python_FOUND) # message(FATAL_ERROR "Python3 not found") # else() # endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.