|
| 1 | +# Copyright (c) 2023 Project CHIP Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +config("libwebsockets_config") { |
| 16 | + include_dirs = [ |
| 17 | + ".", |
| 18 | + "repo/include", |
| 19 | + ] |
| 20 | + |
| 21 | + defines = [] |
| 22 | +} |
| 23 | + |
| 24 | +config("libwebsockets_config_disable_warnings") { |
| 25 | + cflags = [ |
| 26 | + "-Wno-shadow", |
| 27 | + "-Wno-unreachable-code", |
| 28 | + "-Wno-format-nonliteral", |
| 29 | + "-Wno-implicit-fallthrough", |
| 30 | + ] |
| 31 | +} |
| 32 | + |
| 33 | +source_set("libwebsockets") { |
| 34 | + include_dirs = [ |
| 35 | + "repo/lib/plat/windows", |
| 36 | + "repo/lib/plat/freertos", |
| 37 | + "repo/lib/plat/unix", |
| 38 | + "repo/lib/secure-streams", |
| 39 | + "repo/lib/event-libs", |
| 40 | + "repo/lib/roles", |
| 41 | + "repo/lib/roles/http", |
| 42 | + "repo/lib/roles/h1", |
| 43 | + "repo/lib/roles/h2", |
| 44 | + "repo/lib/roles/ws", |
| 45 | + "repo/lib/system/metrics", |
| 46 | + "repo/lib/system/smd", |
| 47 | + "repo/lib/system/async-dns", |
| 48 | + "repo/lib/core", |
| 49 | + "repo/lib/core-net", |
| 50 | + ] |
| 51 | + |
| 52 | + sources = [ |
| 53 | + "repo/lib/core-net/adopt.c", |
| 54 | + "repo/lib/core-net/close.c", |
| 55 | + "repo/lib/core-net/dummy-callback.c", |
| 56 | + "repo/lib/core-net/network.c", |
| 57 | + "repo/lib/core-net/output.c", |
| 58 | + "repo/lib/core-net/pollfd.c", |
| 59 | + "repo/lib/core-net/service.c", |
| 60 | + "repo/lib/core-net/sorted-usec-list.c", |
| 61 | + "repo/lib/core-net/vhost.c", |
| 62 | + "repo/lib/core-net/wsi-timeout.c", |
| 63 | + "repo/lib/core-net/wsi.c", |
| 64 | + "repo/lib/core/alloc.c", |
| 65 | + "repo/lib/core/buflist.c", |
| 66 | + "repo/lib/core/context.c", |
| 67 | + "repo/lib/core/libwebsockets.c", |
| 68 | + "repo/lib/core/logs.c", |
| 69 | + "repo/lib/core/lws_dll2.c", |
| 70 | + "repo/lib/event-libs/poll/poll.c", |
| 71 | + "repo/lib/misc/base64-decode.c", |
| 72 | + "repo/lib/misc/sha-1.c", |
| 73 | + "repo/lib/roles/h1/ops-h1.c", |
| 74 | + "repo/lib/roles/http/date.c", |
| 75 | + "repo/lib/roles/http/header.c", |
| 76 | + "repo/lib/roles/http/parsers.c", |
| 77 | + "repo/lib/roles/http/server/server.c", |
| 78 | + "repo/lib/roles/listen/ops-listen.c", |
| 79 | + "repo/lib/roles/pipe/ops-pipe.c", |
| 80 | + "repo/lib/roles/raw-skt/ops-raw-skt.c", |
| 81 | + "repo/lib/roles/ws/ops-ws.c", |
| 82 | + "repo/lib/roles/ws/server-ws.c", |
| 83 | + "repo/lib/system/system.c", |
| 84 | + ] |
| 85 | + |
| 86 | + if (current_os == "freertos") { |
| 87 | + sources += [ |
| 88 | + "repo/lib/plat/freertos/freertos-fds.c", |
| 89 | + "repo/lib/plat/freertos/freertos-init.c", |
| 90 | + "repo/lib/plat/freertos/freertos-misc.c", |
| 91 | + "repo/lib/plat/freertos/freertos-pipe.c", |
| 92 | + "repo/lib/plat/freertos/freertos-service.c", |
| 93 | + "repo/lib/plat/freertos/freertos-sockets.c", |
| 94 | + ] |
| 95 | + |
| 96 | + cflags = [ "-DLWS_PLAT_FREERTOS" ] |
| 97 | + } else { |
| 98 | + sources += [ |
| 99 | + "repo/lib/plat/unix/unix-caps.c", |
| 100 | + "repo/lib/plat/unix/unix-fds.c", |
| 101 | + "repo/lib/plat/unix/unix-init.c", |
| 102 | + "repo/lib/plat/unix/unix-misc.c", |
| 103 | + "repo/lib/plat/unix/unix-pipe.c", |
| 104 | + "repo/lib/plat/unix/unix-service.c", |
| 105 | + "repo/lib/plat/unix/unix-sockets.c", |
| 106 | + ] |
| 107 | + |
| 108 | + cflags = [ "-DLWS_PLAT_UNIX" ] |
| 109 | + |
| 110 | + if (target_os == "ios") { |
| 111 | + cflags += [ "-DLWS_DETECTED_PLAT_IOS" ] |
| 112 | + } |
| 113 | + } |
| 114 | + |
| 115 | + public_configs = [ ":libwebsockets_config" ] |
| 116 | + configs += [ ":libwebsockets_config_disable_warnings" ] |
| 117 | +} |
0 commit comments