summaryrefslogtreecommitdiffstats
path: root/cmake/platforms/FindPlatformGraphics.cmake
blob: af8d3341dbc6cba32ad62e9d186e35437124c898 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

#.rst:
# PlatformGraphics
# ---------

if(CMAKE_SYSTEM_NAME STREQUAL "Integrity")
    set(platform Integrity)
elseif(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
    set(platform VxWorks)
else()
    set(PlatformGraphics_FOUND FALSE)
    return()
endif()

find_package(${platform}PlatformGraphics)

set(platform_target ${platform}PlatformGraphics::${platform}PlatformGraphics)
if(NOT ${platform}PlatformGraphics_FOUND OR
    NOT TARGET ${platform_target})
    set(PlatformGraphics_FOUND FALSE)
    return()
endif()

if(NOT TARGET PlatformGraphics::PlatformGraphics)
    add_library(PlatformGraphics::PlatformGraphics INTERFACE IMPORTED)
    target_link_libraries(PlatformGraphics::PlatformGraphics INTERFACE ${platform_target})

    # The list of libraries that are required to pass the EGL/OpenGL/GLESv2
    # compile checks. The list might or might not be provided by platforms or
    # toolchain files.
    foreach(known_var LIBRARIES INCLUDES DEFINITIONS)
        string(TOLOWER "${known_var}" known_var_lc)
        if(${platform}PlatformGraphics_REQUIRED_${known_var})
            set_property(TARGET PlatformGraphics::PlatformGraphics PROPERTY
                _qt_internal_platform_graphics_required_${known_var_lc}
                "${${platform}PlatformGraphics_REQUIRED_${known_var}}"
            )
        endif()
    endforeach()
    unset(known_var)
    unset(known_var_lc)
endif()

function(platform_graphics_extend_check_cxx_source_required_variables)
    foreach(known_var LIBRARIES INCLUDES DEFINITIONS)
        string(TOLOWER "${known_var}" known_var_lc)
        get_target_property(platform_graphics_required_${known_var_lc}
            PlatformGraphics::PlatformGraphics
            _qt_internal_platform_graphics_required_${known_var_lc}
        )
        if(platform_graphics_required_${known_var_lc})
            list(APPEND CMAKE_REQUIRED_${known_var} ${platform_graphics_required_${known_var_lc}})
            set(CMAKE_REQUIRED_${known_var} "${CMAKE_REQUIRED_${known_var}}" PARENT_SCOPE)
        endif()
    endforeach()
endfunction()

unset(platform)
unset(platform_target)

set(PlatformGraphics_FOUND TRUE)