File: FindDawn.cmake

package info (click to toggle)
webkit2gtk 2.42.2-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 362,452 kB
  • sloc: cpp: 2,881,971; javascript: 282,447; ansic: 134,088; python: 43,789; ruby: 18,308; perl: 15,872; asm: 14,389; xml: 4,395; yacc: 2,350; sh: 2,074; java: 1,734; lex: 1,323; makefile: 288; pascal: 60
file content (209 lines) | stat: -rw-r--r-- 6,612 bytes parent folder | download | duplicates (14)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Copyright (c) 2020 Sony Interactive Entertainment Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#   list of conditions and the following disclaimer.
# * 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.
# * Neither the name of Intel Corporation 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 PARTNativeLAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
#
# Try to find Harfbuzz include and library directories.
#
# After successful discovery, this will set for inclusion where needed:
# Dawn_INCLUDE_DIRS - containg the Dawn headers
# Dawn_LIBRARIES - containg the Dawn library

#[=======================================================================[.rst:
FindDawn
--------------

Find Dawn headers and libraries.

Imported Targets
^^^^^^^^^^^^^^^^

``Dawn::dawn``
  The Dawn library, if found.

``Dawn::native``
  The Dawn Native library, if found.

``Dawn::wire```
  The Dawn Wire library, if found.

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables in your project:

``Dawn_FOUND``
  true if (the requested version of) Dawn is available.
``Dawn_LIBRARIES``
  the libraries to link against to use Dawn.
``Dawn_INCLUDE_DIRS``
  where to find the Dawn headers.
``Dawn_COMPILE_OPTIONS``
  this should be passed to target_compile_options(), if the
  target is not used for linking

#]=======================================================================]

find_path(WebGPU_INCLUDE_DIR
    NAMES webgpu/webgpu.h
)

find_path(Dawn_INCLUDE_DIR
    NAMES dawn/dawn_proc.h
)

find_library(Dawn_LIBRARY
    NAMES ${Dawn_NAMES} dawn_proc
)

# Find components
if (WebGPU_INCLUDE_DIR AND Dawn_INCLUDE_DIR AND Dawn_LIBRARY)
    set(_Dawn_REQUIRED_LIBS_FOUND ON)
    set(Dawn_LIBS_FOUND "Dawn (required): ${Dawn_LIBRARY}")
else ()
    set(_Dawn_REQUIRED_LIBS_FOUND OFF)
    set(Dawn_LIBS_NOT_FOUND "Dawn (required)")
endif ()

if ("native" IN_LIST Dawn_FIND_COMPONENTS)
    find_path(Dawn_Native_INCLUDE_DIR
        NAMES dawn_native/dawn_native_export.h
    )

    find_library(Dawn_Native_LIBRARY
        NAMES dawn_native
    )

    if (Dawn_Native_INCLUDE_DIR AND Dawn_Native_LIBRARY)
        if (Dawn_FIND_REQUIRED_native)
            list(APPEND Dawn_LIBS_FOUND "Native (required): ${Dawn_Native_LIBRARY}")
        else ()
           list(APPEND Dawn_LIBS_FOUND "Native (optional): ${Dawn_Native_LIBRARY}")
        endif ()
    else ()
        if (Dawn_FIND_REQUIRED_native)
           set(_Dawn_REQUIRED_LIBS_FOUND OFF)
           list(APPEND Dawn_LIBS_NOT_FOUND "Native (required)")
        else ()
           list(APPEND Dawn_LIBS_NOT_FOUND "Native (optional)")
        endif ()
    endif ()
endif ()

if ("wire" IN_LIST Dawn_FIND_COMPONENTS)
    find_path(Dawn_Wire_INCLUDE_DIR
        NAMES dawn_wire/dawn_wire_export.h
    )

    find_library(Dawn_Wire_LIBRARY
        NAMES dawn_wire
    )

    if (Dawn_Wire_INCLUDE_DIR AND Dawn_Wire_LIBRARY)
        if (Dawn_FIND_REQUIRED_wire)
            list(APPEND Dawn_LIBS_FOUND "Wire (required): ${Dawn_Wire_LIBRARY}")
        else ()
           list(APPEND Dawn_LIBS_FOUND "Wire (optional): ${Dawn_Wire_LIBRARY}")
        endif ()
    else ()
        if (Dawn_FIND_REQUIRED_wire)
           set(_Dawn_REQUIRED_LIBS_FOUND OFF)
           list(APPEND Dawn_LIBS_NOT_FOUND "Wire (required)")
        else ()
           list(APPEND Dawn_LIBS_NOT_FOUND "Wire (optional)")
        endif ()
    endif ()
endif ()

if (NOT Dawn_FIND_QUIETLY)
    if (Dawn_LIBS_FOUND)
        message(STATUS "Found the following Dawn libraries:")
        foreach (found ${Dawn_LIBS_FOUND})
            message(STATUS " ${found}")
        endforeach ()
    endif ()
    if (Dawn_LIBS_NOT_FOUND)
        message(STATUS "The following Dawn libraries were not found:")
        foreach (found ${Dawn_LIBS_NOT_FOUND})
            message(STATUS " ${found}")
        endforeach ()
    endif ()
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Dawn
    FOUND_VAR Dawn_FOUND
    REQUIRED_VARS
        WebGPU_INCLUDE_DIR
        Dawn_INCLUDE_DIR
        Dawn_LIBRARY
        _Dawn_REQUIRED_LIBS_FOUND
)

if (Dawn_LIBRARY AND NOT TARGET Dawn::dawn)
    add_library(Dawn::dawn UNKNOWN IMPORTED GLOBAL)
    set_target_properties(Dawn::dawn PROPERTIES
        IMPORTED_LOCATION "${Dawn_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${WebGPU_INCLUDE_DIR};${Dawn_INCLUDE_DIR}"
    )
endif ()

if (Dawn_Native_LIBRARY AND NOT TARGET Dawn::native)
    add_library(Dawn::native UNKNOWN IMPORTED GLOBAL)
    set_target_properties(Dawn::native PROPERTIES
        IMPORTED_LOCATION "${Dawn_Native_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${Dawn_INCLUDE_DIR};${Dawn_Native_INCLUDE_DIR}"
    )
endif ()

if (Dawn_Native_LIBRARY AND NOT TARGET Dawn::wire)
    add_library(Dawn::wire UNKNOWN IMPORTED GLOBAL)
    set_target_properties(Dawn::wire PROPERTIES
        IMPORTED_LOCATION "${Dawn_Wire_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${Dawn_INCLUDE_DIR};${Dawn_Wire_INCLUDE_DIR}"
    )
endif ()

mark_as_advanced(
    Dawn_INCLUDE_DIR
    Dawn_LIBRARY
    Dawn_Native_INCLUDE_DIR
    Dawn_Native_LIBRARY
    Dawn_Wire_INCLUDE_DIR
    Dawn_Wire_LIBRARY
)

if (Dawn_FOUND)
    set(Dawn_LIBRARIES
        ${Dawn_LIBRARY}
        ${Dawn_Native_LIBRARY}
        ${Dawn_Wire_LIBRARY}
    )
    set(Dawn_INCLUDE_DIRS
        ${WebGPU_INCLUDE_DIR}
        ${Dawn_INCLUDE_DIR}
        ${Dawn_Native_INCLUDE_DIR}
        ${Dawn_Wire_INCLUDE_DIR}
    )
endif ()