view seobeo/BUILD @ 130:3a564ffb2092 websocket-blog

Wrote my blog.
author June Park <parkjune1995@gmail.com>
date Fri, 09 Jan 2026 07:19:09 -0800
parents 7b1719fa918c
children dbf14f84d51c
line wrap: on
line source

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

filegroup(
  name = "seobeo_hdrs",
  srcs = [
    "seobeo.h",
    "seobeo_internal.h",
    "snapshot_creator.h",
  ],
  visibility = ["//visibility:public"],
)

alias(
  name = "seobeo_server",
  actual = select({
    "//config:macos":  ":seobeo_server_macos",
    "//config:linux":  ":seobeo_server_linux",
    "//conditions:default": ":seobeo_server_linux",
  }),
  visibility = ["//visibility:public"],
)

alias(
  name = "seobeo_server_dev",
  actual = select({
    "//config:macos":  ":seobeo_server_macos_dev",
    "//config:linux":  ":seobeo_server_linux_dev",
    "//conditions:default": ":seobeo_server_linux_dev",
  }),
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_server_macos",
  srcs = [
    "s__network.c",
    "s_web.c",
    "s_ssl.c",
    "os/s_macos_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
  ],
  defines = ["SEOBEO_NO_SSL"],
  target_compatible_with = [
    "@platforms//os:osx",
  ],
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_server_macos_dev",
  srcs = [
    "s_network.c",
    "s_web.c",
    "s_ssl.c",
    "os/s_macos_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
  ],
  defines = ["SEOBEO_NO_SSL", "SEOBEO_ENABLE_DEBUG"],
  target_compatible_with = [
    "@platforms//os:osx",
  ],
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_server_linux",
  srcs = [
    "s_network.c",
    "s_web.c",
    "s_ssl.c",
    "os/s_linux_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
  ],
  defines = ["SEOBEO_NO_SSL"],
  target_compatible_with = [
    "@platforms//os:linux",
  ],
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_server_linux_dev",
  srcs = [
    "s_network.c",
    "s_web.c",
    "s_ssl.c",
    "os/s_linux_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
  ],
  defines = ["SEOBEO_NO_SSL", "SEOBEO_ENABLE_DEBUG"],
  target_compatible_with = [
    "@platforms//os:linux",
  ],
  visibility = ["//visibility:public"],
)

# Client target with SSL support (full functionality)
alias(
  name = "seobeo_client",
  actual = select({
    "//config:macos":  ":seobeo_client_macos",
    "//config:linux":  ":seobeo_client_linux",
    "//conditions:default": ":seobeo_client_linux",
  }),
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_client_macos",
  srcs = [
    "s_network.c",
    "s_web.c",
    "s_ssl.c",
    "s_http_client.c",
    "s_websocket.c",
    "s_websocket_server.c",
    "snapshot_creator.c",
    "os/s_macos_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
    "@openssl//:ssl",
  ],
  target_compatible_with = [
    "@platforms//os:osx",
  ],
  visibility = ["//visibility:public"],
)

cc_library(
  name = "seobeo_client_linux",
  srcs = [
    "s_network.c",
    "s_web.c",
    "s_ssl.c",
    "s_http_client.c",
    "s_websocket.c",
    "s_websocket_server.c",
    "snapshot_creator.c",
    "os/s_linux_edge.c",
  ],
  hdrs = [":seobeo_hdrs"],
  deps = [
    "//dowa:dowa",
    "@openssl//:ssl",
  ],
  target_compatible_with = [
    "@platforms//os:linux",
  ],
  visibility = ["//visibility:public"],
)

# Default target for backward compatibility (points to client with SSL)
alias(
  name = "seobeo",
  actual = ":seobeo_client",
  visibility = ["//visibility:public"],
)

# Examples
cc_binary(
  name = "websocket_server_example",
  srcs = ["examples/websocket_server_example.c"],
  deps = [":seobeo_client"],
  visibility = ["//visibility:public"],
)

# Tests
cc_test(
  name = "seobeo_client_test",
  srcs = ["tests/seobeo_client_test.c"],
  deps = [":seobeo_client"],
  visibility = ["//visibility:public"],
)

cc_test(
  name = "seobeo_websocket_test",
  srcs = ["tests/seobeo_websocket_test.c"],
  deps = [":seobeo_client"],
  size = "small",
  timeout = "short",
  visibility = ["//visibility:public"],
)

cc_test(
  name = "seobeo_websocket_server_test",
  srcs = ["tests/seobeo_web_server_test.c"],
  deps = [":seobeo_client"],
  data = [
    ":websocket_server_example",
  ],
  size = "large",
  timeout = "long",
  args = ["$(location //seobeo:websocket_server_example)"],
)