| 1 |
option(DTK_DISABLE_XCB "Disable XCB Protocols" OFF) |
| 2 |
|
| 3 |
option(DTK_DISABLE_TREELAND "Disable Treeland Protocols" OFF) |
| 4 |
|
| 5 |
file(GLOB PLATFORM_INTERFACE_HEADER |
| 6 |
${CMAKE_CURRENT_LIST_DIR}/*.h |
| 7 |
) |
| 8 |
file(GLOB PLATFORM_INTERFACE_SOURCE |
| 9 |
${CMAKE_CURRENT_LIST_DIR}/*.cpp |
| 10 |
) |
| 11 |
|
| 12 |
set(platform_interface_SRC |
| 13 |
${PLATFORM_INTERFACE_HEADER} |
| 14 |
${PLATFORM_INTERFACE_SOURCE} |
| 15 |
) |
| 16 |
target_sources(${LIB_NAME} PRIVATE |
| 17 |
${platform_interface_SRC} |
| 18 |
) |
| 19 |
|
| 20 |
set(PRIVATE_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/private/dplatforminterface_p.h) |
| 21 |
set(PRIVATE_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${PROJECT_VERSION_MAJOR}/DGui/Private") |
| 22 |
|
| 23 |
# XCB |
| 24 |
if(NOT DTK_DISABLE_XCB) |
| 25 |
message("Support XCB!") |
| 26 |
include(plugins/platform/xcb/xcb.cmake) |
| 27 |
target_sources(${LIB_NAME} PRIVATE |
| 28 |
${xcb_SRC} |
| 29 |
) |
| 30 |
else() |
| 31 |
target_compile_definitions(${LIB_NAME} PRIVATE DTK_DISABLE_XCB) |
| 32 |
endif() |
| 33 |
|
| 34 |
# Treeland |
| 35 |
|
| 36 |
try_compile(DEEPIN_WAYLAND_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/treeland_test |
| 37 |
${CMAKE_CURRENT_LIST_DIR}/platform/config.tests/treeland_test treeland_test CMAKE_FLAGS -DQT_VERSION_MAJOR=${QT_VERSION_MAJOR}) |
| 38 |
|
| 39 |
if(NOT DEEPIN_WAYLAND_TEST_COMPILE_RESULT) |
| 40 |
message("wayland_test failed, disable treeland support") |
| 41 |
set(DTK_DISABLE_TREELAND ON) |
| 42 |
endif() |
| 43 |
|
| 44 |
if(NOT DTK_DISABLE_TREELAND) |
| 45 |
find_package(TreelandProtocols) |
| 46 |
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS WaylandClient) |
| 47 |
set(TreelandProtocols_FOUND ${TreelandProtocols_FOUND}) |
| 48 |
endif() |
| 49 |
|
| 50 |
if(NOT DTK_DISABLE_TREELAND AND TreelandProtocols_FOUND) |
| 51 |
message("Support Treeland!") |
| 52 |
if("${QT_VERSION_MAJOR}" STREQUAL "6") |
| 53 |
qt6_generate_wayland_protocol_client_sources(${LIB_NAME} FILES |
| 54 |
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml |
| 55 |
) |
| 56 |
else() |
| 57 |
# ECM setup |
| 58 |
include(FeatureSummary) |
| 59 |
find_package(ECM REQUIRED NO_MODULE) |
| 60 |
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ECM_MODULE_PATH}") |
| 61 |
find_package(QtWaylandScanner) |
| 62 |
ecm_add_qtwayland_client_protocol(CLIENT_LIB_SRCS |
| 63 |
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml |
| 64 |
BASENAME treeland-personalization-manager-v1 |
| 65 |
) |
| 66 |
target_sources(${LIB_NAME} PRIVATE |
| 67 |
${CLIENT_LIB_SRCS} |
| 68 |
) |
| 69 |
endif() |
| 70 |
|
| 71 |
include(plugins/platform/treeland/treeland.cmake) |
| 72 |
target_sources(${LIB_NAME} PRIVATE |
| 73 |
${treeland_SRC} |
| 74 |
) |
| 75 |
else() |
| 76 |
target_compile_definitions(${LIB_NAME} PRIVATE DTK_DISABLE_TREELAND) |
| 77 |
endif() |
| 78 |
|
| 79 |
install(FILES ${PRIVATE_HEADER_FILES} DESTINATION "${PRIVATE_INCLUDE_INSTALL_DIR}") |